Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Python by Reasome ( 7 years ago )
# coding: utf-8
from scene import *
import sound
import random
import math
A = Action
class Circle (object):
d = 2
class MyScene (Scene):
def setup(self):
circle1 = Circle()
self.grav_log = open('grav.txt','w')
#for line in self.grav_log:
#print(line)
def did_change_size(self):
pass
def update(self):
g = gravity()
self.grav_log.write('x = '+str(round(g.x,3))+'; y = '+str(round(g.y,3))+'; z = '+str(round(g.z,3))+'; g = '+str(math.sqrt(g.x**2+g.y**2+g.z**2))+'\n')
# print('x = '+str(round(g.x,3))+'; y = '+str(round(g.y,3))+'; z = '+str(round(g.z,3))+'; g = '+str(math.sqrt(g.x**2+g.y**2+g.z**2))+'\n')
for node in self.children:
node.velocity1 = node.velocity1[0]*0.99 + g.x, node.velocity1[1]*0.99 + g.y
node.velocity = node.velocity[0] + node.velocity1[0], node.velocity[1] + node.velocity1[1]
node.position = node.position[0] + node.velocity1[0] ,node.position[1] + node.velocity1[1]
#print(node.position)
if abs(node.position[0])>10000 or abs(node.position[1])>10000:
#print('WACHACHA')
node.remove_from_parent()
def touch_began(self, touch):
n = SpriteNode('emj:Banana', position = touch.location, scale = 2)
n.velocity = (0,0)
n.velocity1 = (0,0)
self.add_child (n)
def touch_moved(self, touch):
pass
# n = SpriteNode('emj:Banana', position = touch.location, scale = 2)
# n.velocity = (0,0)
# self.add_child (n)
def touch_ended(self, touch):
pass
#for node in self.children:
#node.remove_from_parent()
if __name__ == '__main__':
run(MyScene(), PORTRAIT, show_fps=False)
Revise this Paste