Change attribute position X
csmyersa
Member, PRO Posts: 11
Hello hello!
I have an actor that moves from the right to the left. I am trying to create a way that and once it hits x=0 then it reappear at the right of the screen (x=500).
I created a rule which says
When self.position x=0
Change attribute behavior x=500 (far right of my screen)
But it doesnt work. Any ideas why?
I also tried with spawn behavior but it doesnt work either (see second image)
Thank you!
Christina
Comments
Hi Christina,
You will need to use the =< sign. (Equal or less than)
Reason being, the chances of your actor being at exactly 0 x position is very small when its moving. You can test this for your self by giving the actor a display text behaviour and select the actors X position.
By including the less than sign (or greater than if going opposite direction), it means the rule is going to activate as soon as it passes 0 x position.
Hope that helps.
GSLearn.com | Templates | Free Demos | Udemy Course
thank you very much!!!
Sounds like you are wrapping the actor, if you want every actor to wrap from one edge of the screen to the other you can turn on Wrap X (and Wrap Y) in the scene Attributes as well.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page