一個卡牌游戲源代碼,幾年前寫的敌卓,圖片我另發(fā)一文慎式,pythonista可運行

from scene import *

import sound

import random

import math

import os

A = Action

class MyScene (Scene):

? ? def setup(self):

? ? ? ? self.background_color='white'

? ? ? ?

? ? ? ? self.carlist=[]

? ? ? ? self.numlablelist=[]

? ? ? ?

? ? ? ?

? ? ? ? x=200

? ? ? ? y=400

? ? ? ? #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.c=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)

? ? ? ?

? ? ? ?

? ? ? ? self.a=self.spawn_car(x,y-200,0)

? ? ? ? self.b=self.spawn_car(x+200,y-200,0)

? ? ? ? self.c=self.spawn_car(x+400,y-200,0)

? ? ? ? self.d=self.spawn_car(x,y,0)

? ? ? ? self.e=self.spawn_car(x+200,y,4)

? ? ? ? self.f=self.spawn_car(x+400,y,0)

? ? ? ? self.g=self.spawn_car(x,y+200,0)

? ? ? ? self.h=self.spawn_car(x+200,y+200,0)

? ? ? ? self.i=self.spawn_car(x+400,y+200,0)

? ? ? ?

? ? ? ? self.fmcarposition=(0,0)

? ? ? ?

? ? ? ?

? ? ? ?

? ? ? ? self.atcaryes=True

? ? ? ? self.phyes=False

? ? ? ? self.pyyes=False

? ? ? ? self.choosing=False

? ? ? ? self.pickone=False

? ? ? ?

? ? ? ? self.p=self.a.position

? ? ? ?

? ? ? ? self.p1=self.a.position

? ? ? ? self.p2=self.a.position

? ? ? ?

? ? ? ? #self.rot=0

? ? ? ? #self.radian=0

? ? ? ? self.movable=False

? ? ? ? self.overlap=False

? ? ? ?

? ? ? ? #self.eatnum=0

? ? ? ?

? ? ? ? self.rottotalnum=0

? ? ? ? self.fishtweight=0

? ? ? ?

? ? ? ?

? ? ? ? #card5Img='5.png'

? ? ? ? #card1Img='1.png'

? ? ? ? self.cardlistred=['card:DiamondsA','card:Diamonds2','card:Diamonds3','card:Diamonds4','card:Diamonds5','card:Diamonds6','card:Diamonds7','card:Diamonds8','card:Diamonds9','card:Diamonds10','card:DiamondsJ','card:DiamondsQ','card:HeartsK']

? ? ? ? #cardlistred.append(card5Img)

? ? ? ? #cardlistred.append(card1Img)

? ? ? ?

? ? ? ? #card103Img='103.png'

? ? ? ? #card107Img='107.png'

? ? ? ? self.cardlistblack=['card:ClubsA','card:Clubs2','card:Clubs3','card:Clubs4','card:Clubs5','card:Clubs6','card:Clubs7','card:Clubs8','card:Clubs9','card:Clubs10','card:ClubsJ','card:ClubsQ','card:ClubsK']

? ? ? ? #cardlistblack.append(card103Img)

? ? ? ?

? ? ? ? self.card=self.spawn_card(self.cardlistred,self.a)

? ? ? ? self.card2=self.spawn_card(self.cardlistblack,self.d)

? ? ? ?

? ? ? ? self.fishmeat=self.spawn_fishmeat(self.cardlistred,(400,800))

? ? ? ?

? ? ? ? #set car.plusnum

? ? ? ? for car in self.carlist:

? ? ? ? ? ? car.plusnum=random.randint(-1,+3)

? ? ? ?

? ? ? ? self.win_lable=LabelNode(text='playing')

? ? ? ? self.win_lable.anchor_point=(-20,0)

? ? ? ? self.win_lable.position=(0,718)

? ? ? ? self.win_lable.color='black'

? ? ? ? self.win_lable.font=('Arial',30)

? ? ? ? self.add_child(self.win_lable)

? ? ? ?

? ? ? ?

? ? ? ? strplusnum=str(self.a.plusnum)

? ? ? ? self.num_lable1=LabelNode(text=strplusnum)

? ? ? ? self.num_lable1.anchor_point=(0,0)

? ? ? ? self.num_lable1.position=self.a.position

? ? ? ? self.num_lable1.color='black'

? ? ? ? self.num_lable1.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable1)

? ? ? ? #self.numlablelist.append(self.num_lable)

? ? ? ? strplusnum=str(self.b.plusnum)

? ? ? ? self.num_lable2=LabelNode(text=strplusnum)

? ? ? ? self.num_lable2.anchor_point=(0,0)

? ? ? ? self.num_lable2.position=self.b.position

? ? ? ? self.num_lable2.color='black'

? ? ? ? self.num_lable2.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable2)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.c.plusnum)

? ? ? ? self.num_lable3=LabelNode(text=strplusnum)

? ? ? ? self.num_lable3.anchor_point=(0,0)

? ? ? ? self.num_lable3.position=self.c.position

? ? ? ? self.num_lable3.color='black'

? ? ? ? self.num_lable3.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable3)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.d.plusnum)

? ? ? ? self.num_lable4=LabelNode(text=strplusnum)

? ? ? ? self.num_lable4.anchor_point=(0,0)

? ? ? ? self.num_lable4.position=self.d.position

? ? ? ? self.num_lable4.color='black'

? ? ? ? self.num_lable4.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable4)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.e.plusnum)

? ? ? ? self.num_lable5=LabelNode(text=strplusnum)

? ? ? ? self.num_lable5.anchor_point=(0,0)

? ? ? ? self.num_lable5.position=self.e.position

? ? ? ? self.num_lable5.color='black'

? ? ? ? self.num_lable5.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable5)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.f.plusnum)

? ? ? ? self.num_lable6=LabelNode(text=strplusnum)

? ? ? ? self.num_lable6.anchor_point=(0,0)

? ? ? ? self.num_lable6.position=self.f.position

? ? ? ? self.num_lable6.color='black'

? ? ? ? self.num_lable6.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable6)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.g.plusnum)

? ? ? ? self.num_lable7=LabelNode(text=strplusnum)

? ? ? ? self.num_lable7.anchor_point=(0,0)

? ? ? ? self.num_lable7.position=self.g.position

? ? ? ? self.num_lable7.color='black'

? ? ? ? self.num_lable7.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable7)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.h.plusnum)

? ? ? ? self.num_lable8=LabelNode(text=strplusnum)

? ? ? ? self.num_lable8.anchor_point=(0,0)

? ? ? ? self.num_lable8.position=self.h.position

? ? ? ? self.num_lable8.color='black'

? ? ? ? self.num_lable8.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable8)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ? strplusnum=str(self.i.plusnum)

? ? ? ? self.num_lable9=LabelNode(text=strplusnum)

? ? ? ? self.num_lable9.anchor_point=(0,0)

? ? ? ? self.num_lable9.position=self.i.position

? ? ? ? self.num_lable9.color='black'

? ? ? ? self.num_lable9.font=('Arial',30)

? ? ? ? self.add_child(self.num_lable9)

? ? ? ? #self.numlablelist.append(self.num_lable

? ? ? ?

? ? ? ? #self.fmlable=self.spawn_fmlable(self.e)

? ? ? ?

? ? ? ?

? ?

? ? ? ?

? ? ? ?

? ? ? ?

? ? ? ? #self.run_action(A.sequence(A.call(self.movecard),A.wait(1)))

? ? ? ? #self.run_action(A.sequence(A.call(self.movecard),A.wait(1)))

? ? ? ? #self.run_action(A.sequence(A.call(self.movecard),A.wait(1)))

? ? def newmap(self):

? ? ? ? for car in self.carlist:

? ? ? ? ? ? car.remove_from_parent()

? ? ? ? self.carlist=[]

? ? ? ? #print(self.carlist)

? ? ? ? self.card.remove_from_parent()

? ? ? ? self.card2.remove_from_parent()

? ? ? ?

? ? ? ?

? ? ? ? #x=100

? ? ? ? #y=300

? ? ? ? x=200

? ? ? ? y=400

? ? ? ? #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.c=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)

? ? ? ?

? ? ? ? self.a=self.spawn_car(x,y-200,0)

? ? ? ? self.b=self.spawn_car(x+200,y-200,0)

? ? ? ? self.c=self.spawn_car(x+400,y-200,0)

? ? ? ? self.d=self.spawn_car(x,y,0)

? ? ? ? self.e=self.spawn_car(x+200,y,4)

? ? ? ? self.f=self.spawn_car(x+400,y,0)

? ? ? ? self.g=self.spawn_car(x,y+200,0)

? ? ? ? self.h=self.spawn_car(x+200,y+200,0)

? ? ? ? self.i=self.spawn_car(x+400,y+200,0)

? ? ? ? #print('ok')

? ? ? ? #print(self.carlist)

? ? ? ?

? ? ? ?

? ? ? ?

? ? ? ? self.atcaryes=True

? ? ? ? self.phyes=False

? ? ? ? self.pyyes=False

? ? ? ?

? ? ? ? self.p=self.a.position

? ? ? ?

? ? ? ? self.p1=self.a.position

? ? ? ? self.p2=self.a.position

? ? ? ?

? ? ? ? #self.rot=0

? ? ? ? #self.radian=0

? ? ? ? self.movable=False

? ? ? ? self.overlap=False

? ? ? ?

? ? ? ? self.rottotalnum=0

? ? ? ?

? ? ? ? self.card=self.spawn_card(self.cardlistred,self.a)

? ? ? ? self.card2=self.spawn_card(self.cardlistblack,self.i)

? ? ? ? self.fishmeat.remove_from_parent()

? ? ? ? self.fishmeat=self.spawn_fishmeat(self.cardlistred,(400,800))

? ? ? ?

? ? ? ?

? ? ? ? #set car.plusnum

? ? ? ? for car in self.carlist:

? ? ? ? ? ? car.plusnum=random.randint(-1,+3)

? ? ? ?

? ? ? ? #self.win_lable.text=('playing')

? ? ? ?

? ? ? ?

? ? ? ? self.num_lable1.text=str(self.a.plusnum)

? ? ? ? self.num_lable2.text=str(self.b.plusnum)

? ? ? ? self.num_lable3.text=str(self.c.plusnum)

? ? ? ? self.num_lable4.text=str(self.d.plusnum)

? ? ? ? self.num_lable5.text=str(self.e.plusnum)

? ? ? ? self.num_lable6.text=str(self.f.plusnum)

? ? ? ? self.num_lable7.text=str(self.g.plusnum)

? ? ? ? self.num_lable8.text=str(self.h.plusnum)

? ? ? ? self.num_lable9.text=str(self.i.plusnum)

? ? ? ?

? ? ? ? self.fmlable.remove_from_parent()

? ? ? ? self.fmcarposition=(0,0)

? ? ? ?

? ? ? ?

? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ?

? ? def rotate(self):

? ? ? ? #self.collidewithcar()

? ? ? ? acar=self.atcar()

? ? ? ? if self.atcaryes and acar is not None:

? ? ? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ? ax=acar.position.x

? ? ? ? ? ? ay=acar.position.y

? ? ? ? ? ? #self.rot=(self.rot+90)%360

? ? ? ? ? ? #self.radian=self.rot*math.pi/180

? ? ? ? ? ? '''for carname in self.carlist:

? ? ? ? ? ? ? ? ? ? if not carname.rotatable:

? ? ? ? ? ? ? ? ? ? ? ? carname.remove_all_actions()? ? '''

? ? ? ? ? ?

? ? ? ? ? ? if acar.rotatable:

? ? ? ? ? ? ? ? acar.run_action(A.rotate_by((math.pi/2),0))

? ? ? ? ? ? ? ? acar.rotnum=acar.rotnum+1

? ? ? ? ? ? ? ? self.rottotalnum=(self.rottotalnum+1)%6

? ? ? ? ? ? ? ? acar.calnum=(acar.calnum+1)%4

? ? ? ? ? ? ? ? acar.carnum=(acar.calnum+acar.num)%4

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if acar.num==9:

? ? ? ? ? ? ? ? ? ? self.new_hitboxh=Rect(ax+acar.hitboxv.y-ay,ay+acar.hitboxv.x-ax,acar.hitboxv.h,acar.hitboxv.w)

? ? ? ? ? ? ? ? ? ? self.new_hitboxv=Rect(ax+acar.hitboxh.y-ay,ay+acar.hitboxh.x-ax,acar.hitboxh.h,acar.hitboxh.w)

? ? ? ? ? ? ? ? ? ? acar.hitboxh=self.new_hitboxh

? ? ? ? ? ? ? ? ? ? acar.hitboxv=self.new_hitboxv

? ? ? ? ? ? ? ? if acar.num==1 or acar.num==2 or acar.num==3 or acar.num==4:

? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,10,101)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,5,202)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)? ?

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,202)

? ? ? ? ? ? ? ? if acar.num==5 or acar.num==6 or acar.num==7 or acar.num==8:

? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? #rotate unrotated

? ? ? ? ? ? if self.rottotalnum==0:

? ? ? ? ? ? ? ? for acar in self.carlist:

? ? ? ? ? ? ? ? ? ? if acar.rotnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.run_action(A.rotate_by((math.pi/2),0))

? ? ? ? ? ? ? ? ? ? ? ? ax=acar.position.x

? ? ? ? ? ? ? ? ? ? ? ? ay=acar.position.y

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? acar.calnum=(acar.calnum+1)%4

? ? ? ? ? ? ? ? ? ? ? ? acar.carnum=(acar.calnum+acar.num)%4

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==9:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.new_hitboxh=Rect(ax+acar.hitboxv.y-ay,ay+acar.hitboxv.x-ax,acar.hitboxv.h,acar.hitboxv.w)

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.new_hitboxv=Rect(ax+acar.hitboxh.y-ay,ay+acar.hitboxh.x-ax,acar.hitboxh.h,acar.hitboxh.w)

? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=self.new_hitboxh

? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=self.new_hitboxv

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==1 or acar.num==2 or acar.num==3 or acar.num==4:

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,5,202)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,202)

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==5 or acar.num==6 or acar.num==7 or acar.num==8:

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ?

? ? def movecollidewithcar(self):

? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? acar=self.atcar()

? ? ? ? ? ? if self.atcaryes and acar is not None:

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? #print(acar.position)

? ? ? ? ? ? ? ? carmlist=[]

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? self.carlist.remove(acar)

? ? ? ? ? ? ? ? for car in self.carlist:

? ? ? ? ? ? ? ? ? ? if car is not None and acar is not None and car.hitboxh.intersects(acar.hitboxh):

? ? ? ? ? ? ? ? ? ? ? ? carmlist.append(car)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.phyes=True

? ? ? ? ? ? ? ? ? ? ? ? self.movable=True

? ? ? ? ? ? ? ? ? ? ? ? #print('hh')

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? elif car is not None and acar is not None and car.hitboxv.intersects(acar.hitboxv):

? ? ? ? ? ? ? ? ? ? ? ? carmlist.append(car)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.pyyes=True

? ? ? ? ? ? ? ? ? ? ? ? self.movable=True

? ? ? ? ? ? ? ? ? ? ? ? #print('vv')

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if self.movable:

? ? ? ? ? ? ? ? ? ? ? ? carm=random.choice(carmlist)

? ? ? ? ? ? ? ? ? ? ? ? self.p=(carm.position.x,carm.position.y)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.card.intfilename=self.card.intfilename+carm.plusnum

? ? ? ? ? ? ? ? ? ? ? ? #if self.card.intfilename>=13:

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card.intfilename=13

? ? ? ? ? ? ? ? ? ? ? ? #if self.card.intfilename<=1:

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card.intfilename=1

? ? ? ? ? ? ? ? ? ? ? ? #resultstrfilename=str(self.card.intfilename)

? ? ? ? ? ? ? ? ? ? ? ? #self.card.remove_from_parent()

? ? ? ? ? ? ? ? ? ? ? ? #self.card=self.change_card(self.card,(resultstrfilename+'.png'))

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? self.card.index=self.card.index+carm.plusnum

? ? ? ? ? ? ? ? ? ? ? ? if self.card.index>=12:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.card.index=12

? ? ? ? ? ? ? ? ? ? ? ? if self.card.index<=0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.card.index=0

? ? ? ? ? ? ? ? ? ? ? ? #resultstrfilename=str(self.card2.intfilename)

? ? ? ? ? ? ? ? ? ? ? ? self.card.remove_from_parent()

? ? ? ? ? ? ? ? ? ? ? ? list=self.c

? ? ? ? ? ? ? ? ? ? ? ? self.card=self.change_card(self.card,self.cardlistred[self.card.index])

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? #self.phyes=False

? ? ? ? ? ? ? ? #self.pyyes=False

? ? ? ? ? ? ? ? self.carlist.append(acar)

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if self.movable:

? ? ? ? ? ? ? ? ? ? self.card.position=self.p

? ? ? ? ? ? ? ? ? ? #print(self.card.position)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? acar.rotatable=False

? ? ? ? ? ? ? ? ? ? self.movable=False

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ?

? ? def atcar(self):

? ? ? ? for car in self.carlist:

? ? ? ? ? ? if car is not None and car.bbox.intersects(self.card.bbox):

? ? ? ? ? ? ? ? self.atcaryes=True

? ? ? ? ? ? ? ? car.rotatable=True

? ? ? ? ? ? ? ? #print('at')

? ? ? ? ? ? ? ? #print(car.position)

? ? ? ? ? ? ? ? return car

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?

? ? #card2operation

? ? def rotate2(self):

? ? ? ? #self.collidewithcar()

? ? ? ? acar=self.atcar2()

? ? ? ? if self.atcaryes and acar is not None:

? ? ? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ? ax=acar.position.x

? ? ? ? ? ? ay=acar.position.y

? ? ? ? ? ? #self.rot=(self.rot+90)%360

? ? ? ? ? ? #self.radian=self.rot*math.pi/180

? ? ? ? ? ? '''for carname in self.carlist:

? ? ? ? ? ? ? ? ? ? if not carname.rotatable:

? ? ? ? ? ? ? ? ? ? ? ? carname.remove_all_actions()? ? '''

? ? ? ? ? ?

? ? ? ? ? ? if acar.rotatable:

? ? ? ? ? ? ? ? acar.run_action(A.rotate_by((math.pi/2),0))

? ? ? ? ? ? ? ? acar.rotnum=acar.rotnum+1

? ? ? ? ? ? ? ? self.rottotalnum=(self.rottotalnum+1)%6

? ? ? ? ? ? ? ? acar.calnum=(acar.calnum+1)%4

? ? ? ? ? ? ? ? acar.carnum=(acar.calnum+acar.num)%4

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if acar.num==9:

? ? ? ? ? ? ? ? ? ? self.new_hitboxh=Rect(ax+acar.hitboxv.y-ay,ay+acar.hitboxv.x-ax,acar.hitboxv.h,acar.hitboxv.w)

? ? ? ? ? ? ? ? ? ? self.new_hitboxv=Rect(ax+acar.hitboxh.y-ay,ay+acar.hitboxh.x-ax,acar.hitboxh.h,acar.hitboxh.w)

? ? ? ? ? ? ? ? ? ? acar.hitboxh=self.new_hitboxh

? ? ? ? ? ? ? ? ? ? acar.hitboxv=self.new_hitboxv

? ? ? ? ? ? ? ? if acar.num==1 or acar.num==2 or acar.num==3 or acar.num==4:

? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,10,101)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,5,202)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)? ?

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,202)

? ? ? ? ? ? ? ? if acar.num==5 or acar.num==6 or acar.num==7 or acar.num==8:

? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? #rotate unrotated

? ? ? ? ? ? if self.rottotalnum==0:

? ? ? ? ? ? ? ? for acar in self.carlist:

? ? ? ? ? ? ? ? ? ? if acar.rotnum==0:

? ? ? ? ? ? ? ? ? ? ? ? acar.run_action(A.rotate_by((math.pi/2),0))

? ? ? ? ? ? ? ? ? ? ? ? ax=acar.position.x

? ? ? ? ? ? ? ? ? ? ? ? ay=acar.position.y

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? acar.calnum=(acar.calnum+1)%4

? ? ? ? ? ? ? ? ? ? ? ? acar.carnum=(acar.calnum+acar.num)%4

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==9:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.new_hitboxh=Rect(ax+acar.hitboxv.y-ay,ay+acar.hitboxv.x-ax,acar.hitboxv.h,acar.hitboxv.w)

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.new_hitboxv=Rect(ax+acar.hitboxh.y-ay,ay+acar.hitboxh.x-ax,acar.hitboxh.h,acar.hitboxh.w)

? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=self.new_hitboxh

? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=self.new_hitboxv

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==1 or acar.num==2 or acar.num==3 or acar.num==4:

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,5,202)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,202,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,202)

? ? ? ? ? ? ? ? ? ? ? ? if acar.num==5 or acar.num==6 or acar.num==7 or acar.num==8:

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==1:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==2:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x-101,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==3:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y-101,10,101)

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? if acar.carnum==0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxh=Rect(acar.position.x,acar.position.y-5,101,10)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? acar.hitboxv=Rect(acar.position.x-5,acar.position.y,5,101)

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ?

? ? def movecollidewithcar2(self):

? ? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? acar=self.atcar2()

? ? ? ? ? ? if self.atcaryes and acar is not None:

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? #print(acar.position)

? ? ? ? ? ? ? ? carmlist=[]

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? self.carlist.remove(acar)

? ? ? ? ? ? ? ? for car in self.carlist:

? ? ? ? ? ? ? ? ? ? if car is not None and acar is not None and car.hitboxh.intersects(acar.hitboxh):

? ? ? ? ? ? ? ? ? ? ? ? carmlist.append(car)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.phyes=True

? ? ? ? ? ? ? ? ? ? ? ? self.movable=True

? ? ? ? ? ? ? ? ? ? ? ? self.overlap=False

? ? ? ? ? ? ? ? ? ? ? ? #print('hh')

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? elif car is not None and acar is not None and car.hitboxv.intersects(acar.hitboxv):

? ? ? ? ? ? ? ? ? ? ? ? carmlist.append(car)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.pyyes=True

? ? ? ? ? ? ? ? ? ? ? ? self.movable=True

? ? ? ? ? ? ? ? ? ? ? ? self.overlap=False

? ? ? ? ? ? ? ? ? ? ? ? #print('vv')

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if self.movable:

? ? ? ? ? ? ? ? ? ? ? ? carm=random.choice(carmlist)

? ? ? ? ? ? ? ? ? ? ? ? self.p=(carm.position.x,carm.position.y)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #self.card2.intfilename=self.card2.intfilename+carm.plusnum

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? #if self.card2.intfilename>=113:

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card2.intfilename=113

? ? ? ? ? ? ? ? ? ? ? ? #if self.card2.intfilename<=101:

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card2.intfilename=101

? ? ? ? ? ? ? ? ? ? ? ? #resultstrfilename=str(self.card2.intfilename)

? ? ? ? ? ? ? ? ? ? ? ? #self.card2.remove_from_parent()

? ? ? ? ? ? ? ? ? ? ? ? #self.card2=self.change_card(self.card2,(resultstrfilename+'.png'))

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? self.card2.index=self.card2.index+carm.plusnum

? ? ? ? ? ? ? ? ? ? ? ? if self.card2.index>=12:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.card2.index=12

? ? ? ? ? ? ? ? ? ? ? ? if self.card2.index<=0:

? ? ? ? ? ? ? ? ? ? ? ? ? ? self.card2.index=0

? ? ? ? ? ? ? ? ? ? ? ? #resultstrfilename=str(self.card2.intfilename)

? ? ? ? ? ? ? ? ? ? ? ? self.card2.remove_from_parent()

? ? ? ? ? ? ? ? ? ? ? ? self.card2=self.change_card(self.card2,(self.cardlistblack[self.card2.index]))

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? #self.phyes=False

? ? ? ? ? ? ? ? #self.pyyes=False

? ? ? ? ? ? ? ? self.carlist.append(acar)

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? if self.movable:

? ? ? ? ? ? ? ? ? ? self.card2.position=self.p

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? #######################################################

? ? ? ? ? ? ? ? ? ? #twocardoverlapped

? ? ? ? ? ? ? ? ? ? #if self.card2.position==self.card.position:

? ? ? ? ? ? ? ? ? ? ? ? ? ? #print('overlapp')

? ? ? ? ? ? ? ? ? ? ? ? ? ? #print(self.card2.position)

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card2.position=(self.card2.position.x+10,self.card2.position.y)

? ? ? ? ? ? ? ? ? ? ? ? ? ? #print(self.card2.position)

? ? ? ? ? ? ? ? ? ? ? ? ? ? #self.card.position=(self.card.position.x-40,self.card.position.y)

? ? ? ? ? ? ? ? ? ? #if not(self.card2.position==self.card.position):

? ? ? ? ? ? ? ? ? ? ? ? ? ? #???##############################################################

? ? ? ? ? ? ? ? ? ? #overlap new

? ? ? ? ? ? ? ? ? ? if self.atcar().position==self.atcar2().position:

? ? ? ? ? ? ? ? ? ? ? ? self.overlap=True

? ? ? ? ? ? ? ? ? ? ? ? self.card2.position=(self.card2.position.x+40,self.card2.position.y)

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? acar.rotatable=False

? ? ? ? ? ? ? ? ? ? self.movable=False

? ? ? ? ? ? ? ? ? ? ? ? #overlap code

? ? ? ? ? ? if self.overlap==True:

? ? ? ? ? ? ? ? if not self.atcar()==self.atcar2():

? ? ? ? ? ? ? ? ? ? self.card2.position=(self.card2.position.x-40,self.card2.position.y)

? ? ? ? ? ? ? ? ? ? self.overlap=False

? ? ? ? #overlap code ends

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ?

? ? def atcar2(self):

? ? ? ?

? ? ? ? ? ? ? ? ? ?

? ? ? ? for car in self.carlist:

? ? ? ? ? ?

? ? ? ? ? ? if car is not None and car.bbox.intersects(self.card2.bbox):

? ? ? ? ? ? ? ? self.atcaryes=True

? ? ? ? ? ? ? ? car.rotatable=True

? ? ? ? ? ? ? ? #print('at')

? ? ? ? ? ? ? ? #print(car.position)

? ? ? ? ? ? ? ? return car

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? else:self.atcaryes=False

? ?

? ? ? ? ? ?

? ? def spawn_fmlable(self,positioncar):

? ? ? ? fmlable=LabelNode(text=str(self.fishmeat.index+1))

? ? ? ? fmlable.anchor_point=(20,0)

? ? ? ? fmlable.position=positioncar.position

? ? ? ? fmlable.color='green'

? ? ? ? fmlable.font=('Arial',40)

? ? ? ? self.add_child(fmlable)

? ? ? ? return fmlable

? ? ? ?

? ? ? ? ? ?

? ? def spawn_fishmeat(self,listname,position):

? ? ? ? file=random.choice(listname)

? ? ? ? #file=listname[0]

? ? ? ?

? ? ? ? card1=SpriteNode(file)

? ? ? ? card1.blend_mode=BLEND_MULTIPLY

? ? ? ? card1.position=position

? ? ? ? #filename=os.path.splitext(file)[0]

? ? ? ? #card1.intfilename=int(filename)

? ? ? ? card1.index=listname.index(file)

? ? ? ? self.add_child(card1)

? ? ? ? return card1

? ? ? ?

? ? def spawn_card(self,listname,positioncar):

? ? ? ? #file=random.choice(listname)

? ? ? ? file=listname[0]

? ? ? ?

? ? ? ? card1=SpriteNode(file)

? ? ? ? card1.blend_mode=BLEND_MULTIPLY

? ? ? ? card1.position=positioncar.position

? ? ? ? #filename=os.path.splitext(file)[0]

? ? ? ? #card1.intfilename=int(filename)

? ? ? ? card1.index=listname.index(file)

? ? ? ? self.add_child(card1)

? ? ? ? return card1

? ? ? ?

? ? def change_card(self,lastcardname,file):

? ? ? ? card1=SpriteNode(file)

? ? ? ? card1.blend_mode=BLEND_MULTIPLY

? ? ? ? card1.position=lastcardname.position

? ? ? ? #card1.intfilename=lastcardname.intfilename

? ? ? ? card1.index=lastcardname.index

? ? ? ? self.add_child(card1)

? ? ? ? return card1

? ? ? ?

? ? def spawn_car(self,x,y,pnum):

? ? ? ? randomcarlist=[]

? ? ? ? car1=SpriteNode('img1.png')

? ? ? ? car1.blend_mode=BLEND_MULTIPLY

? ? ? ? car1.position=(x,y)

? ? ? ? car1.rotnum=0

? ? ? ? car1.num=1

? ? ? ? car1.calnum=0

? ? ? ? car1.carnum=0

? ? ? ? car1.hitboxh=Rect(car1.position.x-101,car1.position.y-5,202,10)

? ? ? ? car1.hitboxv=Rect(car1.position.x-5,car1.position.y,10,101)

? ? ? ? randomcarlist.append(car1)

? ? ? ?

? ? ? ? car2=SpriteNode('img2.png')

? ? ? ? car2.blend_mode=BLEND_MULTIPLY

? ? ? ? car2.position=(x,y)

? ? ? ? car2.rotnum=0

? ? ? ? car2.num=2

? ? ? ? car2.calnum=0

? ? ? ? car2.carnum=0

? ? ? ? car2.hitboxh=Rect(car2.position.x-101,car2.position.y-5,101,10)

? ? ? ? car2.hitboxv=Rect(car2.position.x-5,car2.position.y-101,5,202)

? ? ? ? randomcarlist.append(car2)

? ? ? ?

? ? ? ? car3=SpriteNode('img3.png')

? ? ? ? car3.blend_mode=BLEND_MULTIPLY

? ? ? ? car3.position=(x,y)

? ? ? ? car3.rotnum=0

? ? ? ? car3.num=3

? ? ? ? car3.calnum=0

? ? ? ? car3.carnum=0

? ? ? ? car3.hitboxh=Rect(car3.position.x-101,car3.position.y-5,202,10)

? ? ? ? car3.hitboxv=Rect(car3.position.x-5,car3.position.y-101,10,101)

? ? ? ? randomcarlist.append(car3)

? ? ? ?

? ? ? ? car4=SpriteNode('img4.png')

? ? ? ? car4.blend_mode=BLEND_MULTIPLY

? ? ? ? car4.position=(x,y)

? ? ? ? car4.rotnum=0

? ? ? ? car4.num=4

? ? ? ? car4.calnum=0

? ? ? ? car4.carnum=0

? ? ? ? car4.hitboxh=Rect(car4.position.x,car4.position.y-5,101,10)

? ? ? ? car4.hitboxv=Rect(car4.position.x-5,car4.position.y-101,10,202)

? ? ? ? randomcarlist.append(car4)

? ? ? ?

? ? ? ? car5=SpriteNode('img5.png')

? ? ? ? car5.blend_mode=BLEND_MULTIPLY

? ? ? ? car5.position=(x,y)

? ? ? ? car5.rotnum=0

? ? ? ? car5.num=5

? ? ? ? car5.calnum=0

? ? ? ? car5.carnum=0

? ? ? ? car5.hitboxh=Rect(car5.position.x-101,car5.position.y-5,101,10)

? ? ? ? car5.hitboxv=Rect(car5.position.x-5,car5.position.y,5,101)

? ? ? ? randomcarlist.append(car5)

? ? ? ?

? ? ? ? car6=SpriteNode('img6.png')

? ? ? ? car6.blend_mode=BLEND_MULTIPLY

? ? ? ? car6.position=(x,y)

? ? ? ? car6.rotnum=0

? ? ? ? car6.num=6

? ? ? ? car6.calnum=0

? ? ? ? car6.carnum=0

? ? ? ? car6.hitboxh=Rect(car6.position.x-101,car6.position.y-5,101,10)

? ? ? ? car6.hitboxv=Rect(car6.position.x-5,car6.position.y-101,10,101)

? ? ? ? randomcarlist.append(car6)

? ? ? ?

? ? ? ? car7=SpriteNode('img7.png')

? ? ? ? car7.blend_mode=BLEND_MULTIPLY

? ? ? ? car7.position=(x,y)

? ? ? ? car7.rotnum=0

? ? ? ? car7.num=7

? ? ? ? car7.calnum=0

? ? ? ? car7.carnum=0

? ? ? ? car7.hitboxh=Rect(car7.position.x,car7.position.y-5,101,10)

? ? ? ? car7.hitboxv=Rect(car7.position.x-5,car7.position.y-101,10,101)

? ? ? ? randomcarlist.append(car7)

? ? ? ?

? ? ? ? car8=SpriteNode('img8.png')

? ? ? ? car8.blend_mode=BLEND_MULTIPLY

? ? ? ? car8.position=(x,y)

? ? ? ? car8.rotnum=0

? ? ? ? car8.num=8

? ? ? ? car8.calnum=0

? ? ? ? car8.carnum=0

? ? ? ? car8.hitboxh=Rect(car8.position.x,car8.position.y-5,101,10)

? ? ? ? car8.hitboxv=Rect(car8.position.x-5,car8.position.y,5,101)

? ? ? ? randomcarlist.append(car8)

? ? ? ?

? ? ? ? car9=SpriteNode('img9.png')

? ? ? ? car9.blend_mode=BLEND_MULTIPLY

? ? ? ? car9.position=(x,y)

? ? ? ? car9.rotnum=0

? ? ? ? car9.num=9

? ? ? ? car9.calnum=0

? ? ? ? car9.carnum=0

? ? ? ? car9.hitboxh=Rect(car9.position.x-101,car9.position.y-5,202,10)

? ? ? ? car9.hitboxv=Rect(car9.position.x-0.5,car9.position.y-0.5,1,1)

? ? ? ? randomcarlist.append(car9)

? ? ? ?

? ? ? ? car10=SpriteNode('img10.png')

? ? ? ? car10.blend_mode=BLEND_MULTIPLY

? ? ? ? car10.position=(x,y)

? ? ? ? car10.rotnum=0

? ? ? ? car10.num=9

? ? ? ? car10.calnum=0

? ? ? ? car10.carnum=0

? ? ? ? car10.hitboxh=Rect(car10.position.x-0.5,car10.position.y-0.5,1,1)

? ? ? ? car10.hitboxv=Rect(car10.position.x-5,car10.position.y-101,10,202)

? ? ? ? randomcarlist.append(car10)

? ? ? ?

? ? ? ? car11=SpriteNode('img11.png')

? ? ? ? car11.blend_mode=BLEND_MULTIPLY

? ? ? ? car11.position=(x,y)

? ? ? ? car11.rotnum=0

? ? ? ? car11.num=9

? ? ? ? car11.calnum=0

? ? ? ? car11.carnum=0

? ? ? ? car11.hitboxh=Rect(car11.position.x-101,car11.position.y-5,202,10)

? ? ? ? car11.hitboxv=Rect(car11.position.x-5,car11.position.y-101,10,202)

? ? ? ? randomcarlist.append(car11)

? ? ? ?

? ? ? ?

? ? ? ? car=random.choice(randomcarlist)

? ? ? ? self.add_child(car)

? ? ? ? car.rotatable=False

? ? ? ? car.plusnum=pnum

? ? ? ? self.carlist.append(car)

? ? ? ?

? ? ? ? return car

? ? ? ?

? ? ? ?

? ? ? ? ? ?

? ? ? ?

? ? ? ?

? ?

? ?

? ? def did_change_size(self):

? ? ? ? pass

? ?

? ? def update(self):

? ? ? ? for touch in self.touches.values():

? ? ? ? ? ? if touch.location in self.fishmeat.bbox:

? ? ? ? ? ? ? ? self.choosing=True

? ? ? ? if self.choosing==True:

? ? ? ? ? ? for touch in self.touches.values():

? ? ? ? ? ? ? ? for car in self.carlist:

? ? ? ? ? ? ? ? ? ? if touch.location in car.bbox:

? ? ? ? ? ? ? ? ? ? ? ? self.fmlable=self.spawn_fmlable(car)

? ? ? ? ? ? ? ? ? ? ? ? self.fmcarposition=car.position

? ? ? ? ? ? ? ? ? ? ? ? #print(self.fmcarposition)

? ? ? ? ? ? ? ? ? ? ? ? #print((self.fmcarposition[0]-5,self.fmcarposition[1]))

? ? ? ? ? ? ? ? ? ? ? ? self.pickone=True

? ? ? ? ? ? ? ? ? ? ? ? self.choosing=False

? ? ? ? if self.pickone==True:

? ? ? ? ? ? for touch in self.touches.values():

? ? ? ? ? ? ? ? for car in self.carlist:

? ? ? ? ? ? ? ? ? ? if touch.location in car.bbox:

? ? ? ? ? ? ? ? ? ? ? ? self.fmlable.remove_from_parent()

? ? ? ? ? ? ? ? ? ? ? ? self.fmlable=self.spawn_fmlable(car)

? ? ? ? ? ? ? ? ? ? ? ? self.fmcarposition=car.position

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? if self.t>=1:

? ? ? ? ? ? #if not self.card.index==12 and not self.card2.index==12:

? ? ? ? ? ? ? ? self.rotate()

? ? ? ? ? ? ? ? self.movecollidewithcar()

? ? ? ? ? ? ? ? self.rotate2()

? ? ? ? ? ? ? ? self.movecollidewithcar2()

? ? ? ? ? ? ? ? self.t=0

? ? ? ? #if self.card.position==(self.fmcarposition[0]-5,self.fmcarposition[1]):

? ? ? ? if self.atcar().position==self.fmcarposition:

? ? ? ? ? ? #print('ok')

? ? ? ? ? ? if self.card.index>=self.fishmeat.index:

? ? ? ? ? ? ? ? self.fishtweight=self.fishtweight+self.card.index+1

? ? ? ? ? ? ? ? self.win_lable.text='playing,you got one fish,fish total weight'+str(self.fishtweight)

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? self.newmap()

? ? ? ? ? ? ? ?

? ? ? ? if self.atcar2().position==self.fmcarposition:

? ? ? ? ? ? #print('ok')

? ? ? ? ? ? if self.card2.index<=self.fishmeat.index:

? ? ? ? ? ? ? ? self.win_lable.text='playing,fishmeat got eaten,fish total weight'+str(self.fishtweight)

? ? ? ? ? ? ? ? self.newmap()

? ? ? ? ? ? ? ?

? ? ? ?

? ? ? ? ? ?

? ? ? ? '''if self.card.index==12 and not self.card2.index==12:

? ? ? ? ? ? self.win_lable.text='you win,touch to start a new game'

? ? ? ? if self.card2.index==12 and not self.card.index==12:

? ? ? ? ? ? self.win_lable.text='you lose,touch to start a new game'

? ? ? ? if self.card.index==12 and self.card2.index==12:

? ? ? ? ? ? self.win_lable.text='It is a draw,touch to start a new game'

? ? '''

? ? def touch_began(self, touch):

? ? ? ? #self.newgame()

? ? ? ? pass

? ?

? ? def touch_moved(self, touch):

? ? ? ? pass

? ?

? ? def touch_ended(self, touch):

? ? ? ? pass

if __name__ == '__main__':

? ? run(MyScene(), show_fps=True)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市趟径,隨后出現(xiàn)的幾起案子瘪吏,更是在濱河造成了極大的恐慌,老刑警劉巖蜗巧,帶你破解...
    沈念sama閱讀 216,372評論 6 498
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件掌眠,死亡現(xiàn)場離奇詭異,居然都是意外死亡幕屹,警方通過查閱死者的電腦和手機蓝丙,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,368評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來望拖,“玉大人渺尘,你說我怎么就攤上這事∷得簦” “怎么了鸥跟?”我有些...
    開封第一講書人閱讀 162,415評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經(jīng)常有香客問我医咨,道長枫匾,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,157評論 1 292
  • 正文 為了忘掉前任拟淮,我火速辦了婚禮干茉,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘惩歉。我一直安慰自己等脂,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,171評論 6 388
  • 文/花漫 我一把揭開白布撑蚌。 她就那樣靜靜地躺著上遥,像睡著了一般。 火紅的嫁衣襯著肌膚如雪争涌。 梳的紋絲不亂的頭發(fā)上粉楚,一...
    開封第一講書人閱讀 51,125評論 1 297
  • 那天,我揣著相機與錄音亮垫,去河邊找鬼模软。 笑死,一個胖子當(dāng)著我的面吹牛饮潦,可吹牛的內(nèi)容都是我干的燃异。 我是一名探鬼主播,決...
    沈念sama閱讀 40,028評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼继蜡,長吁一口氣:“原來是場噩夢啊……” “哼回俐!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起稀并,我...
    開封第一講書人閱讀 38,887評論 0 274
  • 序言:老撾萬榮一對情侶失蹤仅颇,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后碘举,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體忘瓦,經(jīng)...
    沈念sama閱讀 45,310評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,533評論 2 332
  • 正文 我和宋清朗相戀三年引颈,在試婚紗的時候發(fā)現(xiàn)自己被綠了耕皮。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,690評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡蝙场,死狀恐怖明场,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情李丰,我是刑警寧澤,帶...
    沈念sama閱讀 35,411評論 5 343
  • 正文 年R本政府宣布逼泣,位于F島的核電站趴泌,受9級特大地震影響舟舒,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜嗜憔,卻給世界環(huán)境...
    茶點故事閱讀 41,004評論 3 325
  • 文/蒙蒙 一秃励、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧吉捶,春花似錦夺鲜、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至珊拼,卻和暖如春食呻,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背澎现。 一陣腳步聲響...
    開封第一講書人閱讀 32,812評論 1 268
  • 我被黑心中介騙來泰國打工仅胞, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人剑辫。 一個月前我還...
    沈念sama閱讀 47,693評論 2 368
  • 正文 我出身青樓干旧,卻偏偏與公主長得像,于是被迫代替她去往敵國和親妹蔽。 傳聞我的和親對象是個殘疾皇子椎眯,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,577評論 2 353

推薦閱讀更多精彩內(nèi)容