I'm trying to use the example program that discusses the gravity() function in Pythonista to learn the "scene" library.
What I want to do is have a square and a circle move around on the screen when I tilt the phone, at the same time. However, right now, there is only one shape.
How do I get both shapes to move on the screen?
Heres the code
from scene import *
class dumb (Scene):
def setup(self):
self.x = self.size.w * 0.5
self.y = self.size.h * 0.5
def draw(self):
background(0.00, 0.00, 0.00)
fill(1.00,1.00,1.00)
g = gravity()
self.x += g.x * 10
self.y += g.y * 10
self.x = min(self.size.w - 100, max(0, self.x))
self.y = min(self.size.h - 100, max(0, self.y))
ellipse(self.x,self.y,100,100)
class real (Scene):
def setup(self):
self.x = self.size.w * 0.4
self.y = self.size.h * 0.4
def draw(self):
background(0.00, 0.00, 0.00)
fill(1.00,1.00,1.00)
g = gravity()
self.x += g.x * 10
self.y += g.y * 10
self.x = min(self.size.w - 100, max(0, self.x))
self.y = min(self.size.h - 100, max(0, self.y))
rect(self.x,self.y,100,100)
run(dumb())
run(real())
Thank you!