Bounce of the wall while moving an actor with a finger
Yogamatta
Member Posts: 27
I am doing a small demo for iPad. I could install GS viewer and publishing works as well. Let me say that I am a new user and had a clean installation. I haven't bought Pro version either.
Well, to the problem then. I have an actor which I move with a finger. Now I want it to bounce of the walls so I can't just jump through the walls. I can't figure out how to do this.
Another problem is displaying text. Is it possible to choose another font besides the fonts in the list?
Thanks in advance
Well, to the problem then. I have an actor which I move with a finger. Now I want it to bounce of the walls so I can't just jump through the walls. I can't figure out how to do this.
Another problem is displaying text. Is it possible to choose another font besides the fonts in the list?
Thanks in advance
Comments
But... I figured out how not to move through the walls! It's not the best solutions but it works as long as it doesn't go too fast.
I define an attribute for the actor which I move with a touch, let it call okToMove and it's a bool. I set it to true as default.
Rule 1: how to move the actor
Actor receives event touch pressed AND okToMove is true -> constrain attribute x and y to touches' x and y.
Rule 2: the collision
Actor overlaps/collide with actor wall AND okToMove is true -> set okToMove to false.
Rule 3: reset so we can move the actor again
Actor receives touch OUTSIDE -> set okToMove to true.
Works ok. But if you move the actor to fast you can still pass the wall as collision with the wall never registers.
Happy hunting!
So what I did was make an out of bounds rule... if the player attemps to move the ball outside viewing area a you loss menu will appear with an out of bounds leyend... that way people will inbounds