Moving an Enemy
peachpellen
Member Posts: 977
I have a platform with a ghost on it - I'd like this ghost to move left and right.
Can someone please tell me how to do it? I'm sure I've done this previously but I can't seem to make it work today >.<'
Thank you!
Peach
Can someone please tell me how to do it? I'm sure I've done this previously but I can't seem to make it work today >.<'
Thank you!
Peach
Comments
_________________________________
HOLY NOSE JOB!: Nesen Probe: Is this the single most unappealing game in the history of GameSalad? I can't seem to give it away! Anywhere. But if anyone want's to try it out, codes are still available! http://gamesalad.com/forums/topic.php?id=8097
Say you have a platform from x coordinates 100 and 200
Attr - enemyMoveLeft
Rule
----------------------------------------------------
if enemyMoveLeft = 1
then
Move to x = 100
Animation
otherwise
Move to x = 200
Animation
----------------------------------------------------
Rule
----------------------------------------------------
if position.x >= 200
then
change attr enemyMoveLeft = 1
----------------------------------------------------
Rule
----------------------------------------------------
if position.x <= 100
then
change attr enemyMoveLeft = 0
----------------------------------------------------
That might not be the best way but that's how I know should work.
Hope that helps.
// Red Dot Inc
or with a trigger ?!
if independently -
constrain self.positionX to sin(self.time * speed ) * "pixels to move" + initialX
"speed" - the higher the value the faster it moves .
"pixels to move" - if you put 30 it moves 30 pixels to left and 30 to right , so total of 60 pixels
"initialX" - the center of the movement ( dont use "self.position" here )