flip horizzontally by yourself
wollty
Member Posts: 102
I have an actor who moves random
every 2 seconds
interpolated self.position.X to random(100,700)
interpolated self.position.Y to random(100,700)
how can I do the flip horizzontally?
when it goes right?
and when he goes to the left?
all by yourself
without using the mouse
thanks for your attention
every 2 seconds
interpolated self.position.X to random(100,700)
interpolated self.position.Y to random(100,700)
how can I do the flip horizzontally?
when it goes right?
and when he goes to the left?
all by yourself
without using the mouse
thanks for your attention
Comments
If so try storing the last random position x and y in an attribute and if the next random x is higher than the last x it's going right (change image/animation accordingly), otherwise it's going left. And do a similar thing for y.
thanks (and sorry for my bad english, i used google translate)
Set up two 'real' attributes on the actor called
Move To X
Move To Y
Change Attribute Move To X = random(100, 700)
Change Attribute Move To Y = random(100, 700)
Then set up 4 Rules to change the images for 4 directions (vertical included), 2 if you only want to flip horizontal
If Attribute Move To X < Self.Position.X
Change Image/animation to Left
If Attribute Move To X > Self.Position.Y
Change Image/animation to Right
Do the same for Y if you want to change image/animation to one that's facing up or down.
Then
interpolate self.position.X to Move To X
interpolate self.position.Y to Move To Y
You don't need to worry about changing the image if Move To X is the same as Self.Position.X or Move To Y is the same as Self.Position.Y unless you want to use an image where the actor is standing still, tapping his feet etc.
game.lastX
constrain
game.lastX to self.positionX
When
self.positionX> game.lastX
change attribute
self.graphics.Flip orizontally to true
When
self.positionX <game.lastX
change attribute
self.graphics.Flip orizontally to false
I tried both ways and they both work well
I think it's better like you said with the real attribute directly into the actor and not in the game
thank you very much