Page 1 of 1
Moving an enemy image towards the player
Posted: Wed Mar 16, 2016 10:46 am
by antn18
So, i have the enemy following the player using
on opencard
set movespeed to 10
move image "Skeleton gif" to the loc of image "Grado gif" in 1 second
move image "Skeleton gif 2" to the loc of image "Grado gif" in 1 second
end opencard
grado is the name of my player by the way
anyways, once the 1 second passes, they follow but stop at the point where Grado started and stay there and stop following, how do i make it so they follow me constantly until i kill them
Ant
Re: Moving an enemy image towards the player
Posted: Wed Mar 16, 2016 5:42 pm
by richmond62
I think you need to explain a bit more.
Could you upload your stack here, as a ZIP file ?
Re: Moving an enemy image towards the player
Posted: Thu Mar 17, 2016 8:27 am
by AndyP
You're only requesting the move happens once.
Try this.
on opencard
moveGrado
end opencard
on moveGrado
put 10 into movespeed
move image "Skeleton gif" to the loc of image "Grado gif"
move image "Skeleton gif 2" to the loc of image "Grado gif"
send moveGrado to me in 1 second
end moveGrado
You may also want to put the movespeed value into a global so you can access and change it at any time from any card or script.
add this to your openStack script
global gmovespeed
put 10 into gmovespeed
https://livecode.com/resources/api/#liv ... cript/send
https://livecode.com/resources/api/#liv ... ipt/global
Re: Moving an enemy image towards the player
Posted: Fri Mar 18, 2016 12:54 pm
by antn18
i think you have misunderstood,
i want the enemy skeletons to continue to follow Grado throughout the level.
Ant
Re: Moving an enemy image towards the player
Posted: Fri Mar 18, 2016 9:15 pm
by jacque
i want the enemy skeletons to continue to follow Grado throughout the level.
That's what the script does. Every time moveGrado executes, it sends a command to itself to do it again in one second.
Technically, the command name should be in quotes though:
Code: Select all
send "moveGrado" to me in 1 second