Discuss Scratch

ThatOneGuyTyGuy
New to Scratch
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/

Currently, I have ~860 posts.
I am a scratcher who used to be really active on the forums 5 or 6 years ago, I basically quit scratch since then but I still check out the website from time to time. Do not expect asap replies because scratch is really at the back of my head

ThatOneGuyTyGuy
New to Scratch
5 posts

How to Prevent Sprites from Overlapping!!!!

Invisible_Factory wrote:

Link to the project?
Like https://scratch.mit.edu/discuss/topic/178545/[/quote

Invisible_Factory wrote:

Link 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.



Precision Panic: Dodge the obstacles by moving your mouse! 5 difficult levels await you!
Bitcoin Clicker: Click a coin! Become a bitcoinaire!
Duck Life: Train your duck for races by playing minigames! Based off the popular flash game!


ThatOneGuyTyGuy
New to Scratch
5 posts

How to Prevent Sprites from Overlapping!!!!

PikaPal54 wrote:

Try having different movement behaviors for each enemy tank.

What do you mean??
footsocktoe
Scratcher
1000+ posts

How to Prevent Sprites from Overlapping!!!!

ThatOneGuyTyGuy wrote:

PikaPal54 wrote:

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.


SHOOT THE SPACE MONSTERS! ….. A game everyone can play! Bright colors, bonky sounds!
THE 12 BALLS OF CRAZY AL ……. New scrolling adventure game!

ThatOneGuyTyGuy
New to Scratch
5 posts

How to Prevent Sprites from Overlapping!!!!

footsocktoe wrote:

ThatOneGuyTyGuy wrote:

PikaPal54 wrote:

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:

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:
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.

Logic will get you from A to B. Imagination will take you everywhere.

- Albert Einstein
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!!!!

KoreanKidGamer wrote:

Oh my god thanks! I was so worried for my final project for winter but you saved me UwU Thanks so much! - KoreanKidGamer
No need to necropost to thank people though - all it does is move the topic back to the top of the forum.
Scratch_acc74
New to Scratch
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!!!!

Scratch_acc74 wrote:

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

Create your own new topic please.

Powered by DjangoBB