Discuss Scratch

xXTurtleXxe
Scratcher
42 posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

please help me i dont understand the project is this https://scratch.mit.edu/projects/952274433/ view the code first to make my life easier
bombardingppl
Scratcher
500+ posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

I haven't even viewed the project, but correct me, each clone of the zombies should be numbered with “for this sprite only” variables during the production of the clones like this:
when I receive [create zombies]
set [zombie #] to [1]
repeat (5)
create clone of [myself]
change [zombie #] by (1)
end
then you could program the tower to aim at a specific zombie based on its corresponding zombie # variable.

If I had more detail, I could help further.
pythonicKI
Scratcher
100+ posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

xXTurtleXxe wrote:

(#1)
please help me i dont understand the project is this https://scratch.mit.edu/projects/952274433/ view the code first to make my life easier
What do you mean by “the first zombie”? I don't see any zombies. You could always make the original zombie sprite follow the x and y coordinates of the first zombie (by saving them in variables) with @bombardingppl's method. Then, you could put a “point in direction (zombie)” block in the tower sprite.
usefun
Scratcher
1000+ posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

Maybe like:
when green flag clicked
point towards [zombie v]
This is all I can do, sorry if it doesn't help.
InfernoCyclops123
Scratcher
66 posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

I would search up an in depth tutorial but I'm pretty sure (i think) each clone has a position and it updates on a list, so if there are 7 zombies then there are 7 items on a list of the coordinates and it looks for the nearest one to the tower. Something like that I think.
pythonicKI
Scratcher
100+ posts

how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)

usefun wrote:

(#4)
Maybe like:
when green flag clicked
point towards [zombie v]
This is all I can do, sorry if it doesn't help.
You could do this - but make sure that the original zombie sprite (preferably hidden) AND the first zombie clone are in the same position. Then, when the tower does “point toward zombie”, then it points to the first zombie clone.

Powered by DjangoBB