Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to Prevent Sprites from Overlapping!!!!
- ThatOneGuyTyGuy
-
New Scratcher
5 posts
How to Prevent Sprites from Overlapping!!!!
So i have created 10 enemy tanks. How do i prevent them from overlapping each other? When ever they chase my sprite that i am controlling they become one sprite but actually there are 10 of them but they look like 1. Any Solutions Pleez!!!!!!
- Invisible_Factory
-
Scratcher
500+ posts
How to Prevent Sprites from Overlapping!!!!
Link to the project?
Like https://scratch.mit.edu/discuss/topic/178545/
Like https://scratch.mit.edu/discuss/topic/178545/
- ThatOneGuyTyGuy
-
New Scratcher
5 posts
How to Prevent Sprites from Overlapping!!!!
Link to the project?
Like https://scratch.mit.edu/discuss/topic/178545/[/quoteLink to the project?
Like https://scratch.mit.edu/discuss/topic/178545/
https://scratch.mit.edu/projects/87084909/#editor
- PikaPal54
-
Scratcher
100+ posts
How to Prevent Sprites from Overlapping!!!!
Try having different movement behaviors for each enemy tank.
- ThatOneGuyTyGuy
-
New Scratcher
5 posts
How to Prevent Sprites from Overlapping!!!!
Try having different movement behaviors for each enemy tank.
What do you mean??
- footsocktoe
-
Scratcher
1000+ posts
How to Prevent Sprites from Overlapping!!!!
Try having different movement behaviors for each enemy tank.
What do you mean??
He means if they all have the same movement script then they will end up on top of each other. Each tank needs a script that is slightly different from the 9 others. For example, MOVE 7 instead of MOVE 6. Something like that.
- ThatOneGuyTyGuy
-
New Scratcher
5 posts
How to Prevent Sprites from Overlapping!!!!
Try having different movement behaviors for each enemy tank.
What do you mean??
He means if they all have the same movement script then they will end up on top of each other. Each tank needs a script that is slightly different from the 9 others. For example, MOVE 7 instead of MOVE 6. Something like that.
If you can, may you provide an example using visuals and scripts? How can i make the tanks scripts different?
- ErnieParke
-
Scratcher
1000+ posts
How to Prevent Sprites from Overlapping!!!!
Here's an example of what @footsocktoe was talking about. On the left is your current script, on the right is what it might be:

Of course, you can use numbers larger than 1 too.
Another option is that instead of aiming for the player, a tank might turn 5 degrees after pointing at nanoTank.
By the way, [go to ([x position v] of [Rhino Tank v])] doesn't do anything. The correct way to do that is:
However, that might make the game impossible to play. I recommend getting rid of the block.
Showing,
ErnieParke

Of course, you can use numbers larger than 1 too.
Another option is that instead of aiming for the player, a tank might turn 5 degrees after pointing at nanoTank.
By the way, [go to ([x position v] of [Rhino Tank v])] doesn't do anything. The correct way to do that is:
set x to ([x position v] of [Rhino Tank v])
However, that might make the game impossible to play. I recommend getting rid of the block.
Showing,
ErnieParke
- zp100
-
Scratcher
100+ posts
How to Prevent Sprites from Overlapping!!!!
Make a new script:
Or try:
I dunno if this would work. If not, you'll have to make a variable that senses where the other tank it is touching is.
when I start as a clone // Assuming the different tanks are clones. If not, use "When green flag clicked."
forever
if <touching [tank v] ?> then
move (-1) steps
end
end
Or try:
when I start as a clone
forever
if <touching [tank v] ?> then
turn ccw (90) degrees // Or turn clockwise. Whichever way turns it away from the other tank.
move (1) steps
turn cw (90) degrees // Again, reverse this if needed.
end
end
I dunno if this would work. If not, you'll have to make a variable that senses where the other tank it is touching is.
- KoreanKidGamer
-
Scratcher
2 posts
How to Prevent Sprites from Overlapping!!!!
Oh my god thanks! I was so worried for my final project for winter but you saved me UwU Thanks so much! - KoreanKidGamer
- deck26
-
Scratcher
1000+ posts
How to Prevent Sprites from Overlapping!!!!
Oh my god thanks! I was so worried for my final project for winter but you saved me UwU Thanks so much! - KoreanKidGamerNo need to necropost to thank people though - all it does is move the topic back to the top of the forum.
- Scratch_acc74
-
New Scratcher
2 posts
How to Prevent Sprites from Overlapping!!!!
i need help with my project as the Sprites used keep overlapping i need my spaceship and meteorite to collide in order the spaceship to restart Pls help
- deck26
-
Scratcher
1000+ posts
How to Prevent Sprites from Overlapping!!!!
i need help with my project as the Sprites used keep overlapping i need my spaceship and meteorite to collide in order the spaceship to restart Pls helpCreate your own new topic please.
- Discussion Forums
- » Help with Scripts
-
» How to Prevent Sprites from Overlapping!!!!







