Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make 1 sprite stick to another
- SWORDTOOTH
- Scratcher
56 posts
How to make 1 sprite stick to another
So I’ve tried using the
go to [sprite]But it just makes the following sprite practically chase it and not stick to it. I’m making a gun for my top down shooter, so I need the gun to not float out of their hands
My best drawing is a rectangle with 2 legs
- awesome-llama
- Scratcher
1000+ posts
How to make 1 sprite stick to another
The reason why the sprite isn't “sticking” is because it is being placed at the wrong time. You are most likely using a loop of some sort in the sprite to move it to the other. The problem with this is that you can't control exactly when the go to block is being run within each frame. If the go to block runs before the other sprite gets positioned, it will end up in the position the sprite was in the previous frame.
To solve this, you need to make sure the go to block runs after the other sprite is positioned. The best way to do this is through broadcasts. Position the sprite, then broadcast to the one that should follow to go to it.
To solve this, you need to make sure the go to block runs after the other sprite is positioned. The best way to do this is through broadcasts. Position the sprite, then broadcast to the one that should follow to go to it.
- SWORDTOOTH
- Scratcher
56 posts
How to make 1 sprite stick to another
I like your funny words magic man The reason why the sprite isn't “sticking” is because it is being placed at the wrong time. You are most likely using a loop of some sort in the sprite to move it to the other. The problem with this is that you can't control exactly when the go to block is being run within each frame. If the go to block runs before the other sprite gets positioned, it will end up in the position the sprite was in the previous frame.
To solve this, you need to make sure the go to block runs after the other sprite is positioned. The best way to do this is through broadcasts. Position the sprite, then broadcast to the one that should follow to go to it.
Last edited by SWORDTOOTH (Oct. 3, 2021 20:24:50)
My best drawing is a rectangle with 2 legs
- SWORDTOOTH
- Scratcher
56 posts
How to make 1 sprite stick to another
It also worked, THANKS The reason why the sprite isn't “sticking” is because it is being placed at the wrong time. You are most likely using a loop of some sort in the sprite to move it to the other. The problem with this is that you can't control exactly when the go to block is being run within each frame. If the go to block runs before the other sprite gets positioned, it will end up in the position the sprite was in the previous frame.
To solve this, you need to make sure the go to block runs after the other sprite is positioned. The best way to do this is through broadcasts. Position the sprite, then broadcast to the one that should follow to go to it.
My best drawing is a rectangle with 2 legs
- Discussion Forums
- » Help with Scripts
- » How to make 1 sprite stick to another