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)
car1=car(x,y,0)
car2=car(x+199,y,4)
car(x+398,y,0)
car5=car(x,y+199,0)
car(x+199,y+199,0)
car(x+398,y+199,0)
"""
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/42811.html
摘要:字典是內(nèi)置的數(shù)據(jù)結(jié)構(gòu),在寫(xiě)程序時(shí)會(huì)經(jīng)常用到。這里介紹一下它的方法和方法。在獲取中的數(shù)據(jù)時(shí),我們一般使用的方式,但是如果不存在的時(shí)候會(huì)拋出。 Python 之禪 The Zen of Python, by Tim Peters Beautiful is better than ugly. 優(yōu)美勝于丑陋(Python以編寫(xiě)優(yōu)美的代碼為目標(biāo)) Explicit is be...
摘要:引言學(xué)這么久了,一直想做個(gè)界面出來(lái),最近發(fā)現(xiàn)有個(gè)內(nèi)置庫(kù),利用它可以很輕松做出一些簡(jiǎn)易的界面,首先來(lái)看官方對(duì)的說(shuō)明從上面描述中我們不難看出,不管你是系統(tǒng),還是系統(tǒng),它都可以生成相對(duì)應(yīng)的操作界面,這就是所謂的跨平臺(tái)。 showImg(https://segmentfault.com/img/remote/1460000018532942?w=1078&h=1076); 0.引言 學(xué)Pyth...
摘要:工程師也用過(guò)快速開(kāi)發(fā)面向消費(fèi)者的網(wǎng)站以響應(yīng)一日三變的用戶需求。硬件工程師在樹(shù)莓派上用來(lái)調(diào)試一個(gè)人臉檢測(cè)的功能,以較低的成本完成核心功能的調(diào)試。另一方面,通過(guò)在任何一個(gè)瀏覽器中就可以直接前往服務(wù)器現(xiàn)場(chǎng),不論是一臺(tái)甚至是樹(shù)莓派。 概述 資深Python工程師可以選擇的編輯器有很多,比如 Rodeo,Spider,Eclipse,Vim,Visual Studio,Atom,Sublime ...
摘要: from scene import *import soundimport randomimport mathimport osA = Action class MyScene (Scene): def setup(self): self.background_color=white self.carlist=[] x=100 y=...
閱讀 1452·2021-09-23 11:21
閱讀 3140·2019-08-30 14:14
閱讀 3221·2019-08-30 13:56
閱讀 4181·2019-08-30 11:20
閱讀 1981·2019-08-29 17:23
閱讀 2801·2019-08-29 16:14
閱讀 1730·2019-08-28 18:18
閱讀 1512·2019-08-26 12:14