Discuss Scratch

beansWithTheBeans
Scratcher
62 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
Scratcher
1000+ posts

Costume switching bug

beansWithTheBeans wrote:

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
Scratcher
62 posts

Costume switching bug

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
Okay I'll try that. I'm going to bed really soon so I’ll report on the results tomorrow.
beansWithTheBeans
Scratcher
62 posts

Costume switching bug

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
I actually got done earlier than I expected but it works!
N8_D_GR8_1
Scratcher
1000+ posts

Costume switching bug

beansWithTheBeans wrote:

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
I actually got done earlier than I expected but it works!
Sweet!
beansWithTheBeans
Scratcher
62 posts

Costume switching bug

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
I actually got done earlier than I expected but it works!
Sweet!
Thanks for helping btw!
N8_D_GR8_1
Scratcher
1000+ posts

Costume switching bug

beansWithTheBeans wrote:

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
I actually got done earlier than I expected but it works!
Sweet!
Thanks for helping btw!
You're welcome!
Com_engineer_Tom
Scratcher
100+ posts

Costume switching bug

beansWithTheBeans wrote:

N8_D_GR8_1 wrote:

beansWithTheBeans wrote:

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.
Okay I'll try that. I'm going to bed really soon so I’ll report on the results tomorrow.
A very simple hitbox solution would be:

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

Powered by DjangoBB