美文网首页
pythonista cartest2源码

pythonista cartest2源码

作者: 锡西 | 来源:发表于2018-12-14 16:07 被阅读0次

from scene import *

import sound

import random

import math

A = Action

class MyScene (Scene):

def setup(self):

self.carlist=[]

self.imglist=['img1.png','img2.png','img3.png','img4.png','img5.png','img6.png','img7.png','img8.png','img9.png','img10.png','img11.png']

x=100

y=300

self.a=self.spawn_car(x,y-199)

self.b=self.spawn_car(x+199,y-199)

self.spawn_car(x+398,y-199)

self.spawn_car(x,y)

self.spawn_car(x+199,y)

self.spawn_car(x+398,y)

self.spawn_car(x,y+199)

self.spawn_car(x+199,y+199)

self.spawn_car(x+398,y+199)

def spawn_car(self,x,y):

car=SpriteNode(random.choice(self.imglist))

#self.car.anchor_point=(0,0)

car.position=(x,y)

self.add_child(car)

self.carlist.append(car)

return car

def did_change_size(self):

pass

def update(self):

if self.a.bbox.intersects(self.b.bbox):

print(1)

print(self.a.bbox.intersection(self.b.bbox))

'''for car in self.carlist:

act=A.repeat(A.rotate_by(math.pi/2,1),-1)

car.run_action(act)'''

def touch_began(self, touch):

pass

def touch_moved(self, touch):

pass

def touch_ended(self, touch):

pass

if __name__ == '__main__':

run(MyScene(), show_fps=True)

'''display_width=800

display_height=600

black=(0,0,0)

white=(255,255,255)

red=(255,0,0)

green=(0,255,0)

purple=(238,130,238)

 

x=0

y=200

car(x,y-199,0)

car(x+199,y-199,0)

car(x+398,y-199,0)

#car(x+597,y-199)

car1=car(x,y,0)

car2=car(x+199,y,4)

car(x+398,y,0)

#car(x+597,y)

car5=car(x,y+199,0)

car(x+199,y+199,0)

car(x+398,y+199,0)

#car(x+597,y+199)

'''

相关文章

  • pythonista cartest2源码

    from scene import * import sound import random import mat...

  • Hello,pythonista的世界!

    pythonista学习记录 我使用了pythonista的.doctest文档来写这个学习笔记,这样我录入的所有...

  • python土豪至尊版解释器,iPhone手机移动编程Pytho

    今日新增Pythonista 3 感觉需求很大啊,爱折腾的朋友赶紧来玩吧。 描述 Pythonista是一个完整的...

  • Pythonista练习20190228

    从今天开始,pythonista的学习改用刷《笨办法学python》上的习题。

  • Pythonista20190301

  • Pythonista练习(变量)

    输出 python的变量 我们需要一些能够存储任何信息并且也能操纵它们的方式。这便是 变量(Variables) ...

  • Pythonista20190304

    Pythonista 自动补全引号不注意的话会引起错误。这些练习确实简单,如果循序渐进,就应该如此。print是让...

  • Pythonista20190306

    记得第一次学习python时,用的是记事本写代码,在powershell运行,错误百出,现在用pythonista...

  • pythonista20190303

    今天仍然在练习print,想来《笨办法学python》的作者一定是个高手,而且是个很有智慧的老师。在平常的教学中,...

  • Pythonista20190305

    继续print. 字符串的格式化输出非常重要。1994年的时候,为了辅助我组织的加涅理论学习小组学习,我用一款“动...

网友评论

      本文标题:pythonista cartest2源码

      本文链接:https://www.haomeiwen.com/subject/kypghqtx.html