Touch and walls

efishefish Member Posts: 40
edited November -1 in Working with GS (Mac)
I hace an actor i control with touch back and forth along the x-axis. When I used the keyboard I had walls the actor could collide with so it didn't go off screen. When I use touch the walls doesn't work any more. How can I say that the actor is no allowed to go outside the screen? Thanks a lot

Comments

  • ChaserChaser Member Posts: 1,453
    Make sure actor has collide and walls non moveable
  • efishefish Member Posts: 40
    Yes, they all are. And it was fine as long as I used left/right on keyboard. But when I changed it over for iphone controls the walls did not work anymore..
  • DarklunaDarkluna Member Posts: 2
    I have the same problem when I control my actor with the mouse or touch. The walls doesn't work,and the actor goes off the screen... ( movable = false and restitution = 0) T

    It only works when I change movable to true, but when the actor collides with the wall, the wall runs away.

    :‘( sniff
  • efishefish Member Posts: 40
    Hey:)
    I actually managed to solve the problem an other way. No need for walls.
    I have a rule on the actor I want move when touch is pressed. Then I have a constrain attribute which states that self.Position.X To: max(min( game.Touches.Touch 1.X ,300),20)
    This makes the actor movable along the X-axis (horizontal) and it is limited to move only in between 20-300 of the screen.
    Hope this helps!
  • DarklunaDarkluna Member Posts: 2
    It works perfect!!! tks a lot efish!

    Kisses :*
Sign In or Register to comment.