Need help with Tower Defense project
id: 753174
category: Help with Scripts
posts: 5
AlinGrozav
loading
Begginer scratcher here guys , I need your help with this one .
https://scratch.mit.edu/projects/996569433/ this is the link to the project.
Inside the enemy sprite , how can I update the enemy coordinates and enemy progress , inside the EnemyX , EnemyY and EnemyProgress lists , for each clone? (Right now its updating only the last clone spawned)
https://scratch.mit.edu/projects/996569433/ this is the link to the project.
Inside the enemy sprite , how can I update the enemy coordinates and enemy progress , inside the EnemyX , EnemyY and EnemyProgress lists , for each clone? (Right now its updating only the last clone spawned)
Pixilized
loading
Replace the cloneID variable with a new variable just called ID. This is because you need this variable to be “for this sprite only”. Then, each clone will have a different value if asked to report “ID” because the variable thinks the clones are new sprites. So, just use this block in the clone script.
define Update Position
replace item (ID) of [Enemy X v] with (x position)
replace item (ID) of [Enemy Y v] with (y position)
MKYCATS2
loading
I have a problem with something that could really help with this. i haven't tried this, but is it possible to have clones that have the same variable with a different number for each clone (an id variable) and use and change it without messing with the other clones' variables? if so, use that. like this:
when green flag clickedbut if it isn't possible, then do the hard way:
set [clones v] to (0)
when i receive [whatever you want v]
repeat (whatever)
change [clones v] by (1)
create clone of [myself v]
end
when i start as a clone
set [id variable v] to (clones)
add whatever you want here - the id variable will keep track of what list section it's supposed to
when i start as a clone
if <(clones) = (1)> then
do ... for first
else
if <(clones) = (2)> then
do ... for second
else
more ifs
end
end
AlinGrozav
loading
Replace the cloneID variable with a new variable just called ID. This is because you need this variable to be “for this sprite only”. Then, each clone will have a different value if asked to report “ID” because the variable thinks the clones are new sprites. So, just use this block in the clone script.define Update Position
replace item (ID) of [Enemy X v] with (x position)
replace item (ID) of [Enemy Y v] with (y position)
Thanks a lot , you`re a life saver.
Pixilized
loading
No problem! I’m happy to help.