Try this:
EDIT: found a better way to do this so updated the code
SetWindowSize(800,480,0)
SetVirtualResolution(800,480)
player_spr = CreateSprite(0)
SetSpriteSize(player_spr,40,40)
player_xpos# = 400
player_ypos# = 240
player_speed# = 2.5
do
// flag
move_left = 0
move_right = 0
// get touch events
touch_a = GetRawFirstTouchEvent(1)
touch_b = GetRawNextTouchEvent()
// get information about touch
touch_a_x = GetRawTouchStartX(touch_a)
touch_b_x = GetRawTouchStartX(touch_b)
// for touch a
if touch_a > 0
if touch_a_x > 400
move_right = 1
else
move_left = 1
endif
endif
// for touch b
if touch_b > 0
if touch_b_x > 400
move_right = 1
else
move_left = 1
endif
endif
// move the sprite
player_xpos# = player_xpos# + (move_right-move_left)*player_speed#
SetSpritePositionByOffset(player_spr,player_xpos#,player_ypos#)
print("touch_a : " + str(touch_a))
print("touch_b : " + str(touch_b))
print("move_left : " + str(move_left))
print("move_right : " + str(move_right))
sync()
loop
The issue with the multi-touch controls is figuring out what kind of touch event has happened. In this case I don't think tap, swipe or hold really work so it just registers that the screen is being touched.
I've then used two variables move_right and move_left that cancel each other out when the sprite movement is being calculated.
Hopefully it makes sense.