procryon
Nov 24, 2016 - 22:07
Hello all, I've been following the scene tutorial on Pythonista 3 and I've been trying to find a way to make the spaceship in the following code move constantly while i hold down on the button (which is the ellipse). I know it's a basic question but I've looked at examples and on the forum and have not found a solution.
Thanks in advance for dealing with my simple questions lol.
from scene import *
class MyScene(Scene):
def setup(self):
self.background_color = 'midnightblue'
self.ship = SpriteNode('spc:PlayerShip1Orange')
self.ship.position = self.size / 2
self.add_child(self.ship)
def update(self):
fill('green')
ellipse(200, 100, 100, 100)
def touch_began(self, touch):
x,y = touch.location
if x>200 and x<300 and y>100 and y<200:
move_action = Action.move_by(10, 10, 0.7, TIMING_SINODIAL)
self.ship.run_action(move_action)
if __name__ == '__main__':
run(MyScene(), LANDSCAPE, show_fps=True)