Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Costume switching bug
- beansWithTheBeans
-
38 posts
Costume switching bug
So this is the link https://scratch.mit.edu/projects/1228487778/
and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.
- N8_D_GR8_1
-
1000+ posts
Costume switching bug
So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
- beansWithTheBeans
-
38 posts
Costume switching bug
Okay I'll try that. I'm going to bed really soon so I’ll report on the results tomorrow.So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
- beansWithTheBeans
-
38 posts
Costume switching bug
I actually got done earlier than I expected but it works!So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
- N8_D_GR8_1
-
1000+ posts
Costume switching bug
Sweet!I actually got done earlier than I expected but it works!So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
- beansWithTheBeans
-
38 posts
Costume switching bug
Thanks for helping btw!Sweet!I actually got done earlier than I expected but it works!So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
- N8_D_GR8_1
-
1000+ posts
Costume switching bug
You're welcome!Thanks for helping btw!Sweet!I actually got done earlier than I expected but it works!So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.

- Com_engineer_Tom
-
100+ posts
Costume switching bug
A very simple hitbox solution would be:Okay I'll try that. I'm going to bed really soon so I’ll report on the results tomorrow.So this is the link https://scratch.mit.edu/projects/1228487778/ and I need help with making it so that the bird switches straight to the perch costume when touching the tree instead of waiting a few seconds before switching.Can I suggest using a hitbox for the bird? Just create a new sprite, give it a single costume that is a square approximately the size of the bird, add all of your movement code from the burd to the hitbox, and make the burd always go to the hitbox. This will make <touching?> detections much more reliable, since they do not depend on the geometry of the current bird costume.
when flag clicked
forever
player tick
end
define player tick
set rotation style [don't rotate v]
switch costume to (hitbox v)
code for tree and other stuff goes here
switch costume to (bird v)
set rotation style [all around v]
Make a new costume in your bird sprite named “hitbox”. Draw a rectangle of an appropriate size.
You can't see the hitbox because that code occurs before the frame. Make sure to tick “run without screen refresh” when you define the definition.
#105
- Discussion Forums
- » Help with Scripts
- » Costume switching bug