Discuss Scratch

scratchcatzg
Scratcher
28 posts

Clones are confusing... HELP!

Hello there. I am trying to make a tower defense-type game, but I have a problem. I need a sprite to point towards the nearest enemy clone, but I don't know how to do it! Is this possible, and does anyone have any tips?
Awesome_Gabe
Scratcher
13 posts

Clones are confusing... HELP!

Tower defense games are very hard to make, it's harder than you think. Either make it so that they point at your mouse pointer, or use Fuelvin's tutorial on Youtube
Cubey_Dudey
Scratcher
100+ posts

Clones are confusing... HELP!

The easiest way I can think of is complicated. Make it so every enemy is constantly updating their position in a list and make it so the towers can calculate which one is closest. Even I haven't done this so it would be hard.
medians
Scratcher
1000+ posts

Clones are confusing... HELP!

You can use lists to keep track of the x and y positions of the clones, and use clone id to get them. Then use the distance formula to calculate each distance, and point towards the closest one.
Clone id can be accomplished because if you have:
whenclickedsetsprite onlyto0whenIstartasaclonesetsprite onlyto1
The clones will have the variable as 1, while the original sprite will have 0. It has to be sprite only or it will not work.

Last edited by medians (Feb. 11, 2023 01:22:04)

NeonG4
Scratcher
1000+ posts

Clones are confusing... HELP!

I would follow warefames' tutorial. They say about adding and updating the clone stats to the list.
scratchcatzg
Scratcher
28 posts

Clones are confusing... HELP!

Thanks for the advice everyone! I was not expecting to get replies this fast. Now I can get back to work on my game…
I think I will close this now because I know just what I need to do now.
whenclickedsayThanks guys!for2secsstopAll

Powered by DjangoBB