use touch properties to depict left, right, up and down movements of a character?

In touch properties, there only exists four behaviours of release... n others...how do we program left, right , up and down??

it is very easy to do it if a key is pressed but how to use since iPad and other devices will only have touch and no keys...??

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    You want to create 4 Actors and 4 Boolean Attributes. Name Each Left, Right, Up and Down.

    Inside the actor do
    -------------------------------------------------
    Left & Right

    When touch is pressed Change Attribute (Game.Left) to true
    When touch is released Change Attribute (Game.Left) to false

    Inside your character do when (Game.Left) is true, constrain attribute (Self.Motion.LinearVelocity.x to Self.Motion.LinearVelocity.x-200 (Or Pick a Number)


    When touch is pressed Change Attribute (Game.Right) to true
    When touch is released Change Attribute (Game.Right) to false

    Inside your character do when (Game.Right) is true, constrain attribute (Self.Motion.LinearVelocity.x to Self.Motion.LinearVelocity.x+200 (Or Pick a Number)

    ---------------------------------------------------
    Up & Down

    When touch is pressed Change Attribute (Game.Up) to true
    When touch is released Change Attribute (Game.Up) to false

    Inside your character do when (Game.Up) is true, constrain attribute (Self.Motion.LinearVelocity.y to Self.Motion.LinearVelocity.y+200 (Or Pick a Number)


    When touch is pressed Change Attribute (Game.Down) to true
    When touch is released Change Attribute (Game.Down) to false

    Inside your character do when (Game.Down) is true, constrain attribute (Self.Motion.LinearVelocity.y to Self.Motion.LinearVelocity.y-200 (Or Pick a Number)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Download the GS controller template it has a series of on screen controllers should be in the opening window.
  • thanks a lot everyone..!! will give these modes a try :)
Sign In or Register to comment.