Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)
- 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:
If I had more detail, I could help further.
when I receive [create zombies]then you could program the tower to aim at a specific zombie based on its corresponding zombie # variable.
set [zombie #] to [1]
repeat (5)
create clone of [myself]
change [zombie #] by (1)
end
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)
(#1)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.
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
- 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 clickedThis is all I can do, sorry if it doesn't help.
point towards [zombie v]
- 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)
(#4)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.
Maybe like:when green flag clickedThis is all I can do, sorry if it doesn't help.
point towards [zombie v]
- Discussion Forums
- » Help with Scripts
-
» how to make a tower point towards the first zombie in tower defense game (please explain in detail if can)