Forum Archive

How To move player only on x axis

lance1994

So I got the basic , touch_began code I tried different variations but nothing seems to work, here is the code .

x,y = touch.location
move_action = Action.move_to(x,y, 0.7, TIMING_SINODIAL)
self.player.run_action(move_action)

this is the code in the tutorial , this is not my example but how would I be able to switch this around to get the player to only move along the X , like I've said I've tried many variations but I'm quite new so a little help would go along way . Thanks 😘

ccc

Something like:

x, _ = touch.location
_, y = self.player.location
move_action = Action.move_to(x, y, 0.7, TIMING_SINODIAL)
self.player.run_action(move_action)