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)