Discuss Scratch

ZcutxBro5709
Scratcher
100+ posts

Hitbox in multi costume platformer

I want a Hitbox for my platformer, but my player had different costumes for jump, fall and run. Link - https://turbowarp.org/585089451/editor

Nope. An axolotl ate my signature.
awesome-llama
Scratcher
1000+ posts

Hitbox in multi costume platformer

Costumes can be changed multiple times in the same frame. Using this knowledge, you can switch to the hitbox only when you do the collision detection and once you are done, switch to the costume you want to display. The costume the sprite is at the end of the script will be the one that will be seen due to how loops work.
You also just have to keep track of what costume the sprite should be displayed with if you are switching to a hitbox costume at some point.

forever
switch costume to [hitbox v]
... // collision sensing
switch costume to [... v] // the costume you want to display
end
ZcutxBro5709
Scratcher
100+ posts

Hitbox in multi costume platformer

awesome-llama wrote:

Costumes can be changed multiple times in the same frame. Using this knowledge, you can switch to the hitbox only when you do the collision detection and once you are done, switch to the costume you want to display. The costume the sprite is at the end of the script will be the one that will be seen due to how loops work.
You also just have to keep track of what costume the sprite should be displayed with if you are switching to a hitbox costume at some point.

forever
switch costume to [hitbox v]
... // collision sensing
switch costume to [... v] // the costume you want to display
end
Ok. Will try that
forever
switch costume to [hitbox v]
set [costume] to [sense]
switch costume to (costume) //

Last edited by ZcutxBro5709 (Oct. 17, 2021 16:30:20)


Nope. An axolotl ate my signature.

Powered by DjangoBB

Standard | Mobile