use touch properties to depict left, right, up and down movements of a character?
asma.sikandar1@gmail.com
Member Posts: 3
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...??
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
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)
Need Help? Email Me | Templates | Full Game Source Code
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
http://www.jamie-cross.net/?portfolio=gamesalad-simple-touch-controls
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page