cat3.py

这段代码展示了如何使用Python的scene模块创建一个游戏场景。它涉及到图像加载、精灵的生成和移动、文件读写以及时间戳处理。场景中包含背景、鱼肉、道具和角色,还有触摸事件响应。
摘要由CSDN通过智能技术生成

from scene import *
import sound
import random
import math
import time
import os
A = Action

class MyScene (Scene):
    def setup(self):
        self.background_color=('white')
        self.cardlistred=('emj:Anchor','emj:American_Football')
        self.fishmeat=self.spawn_fishmeat(self.cardlistred,(400,800))
        img=('emj:Artist_Palette','emj:Astonished')
        
        self.ground=SpriteNode('test:Sailboat')
        self.ground.anchor_point=(0,0)
        self.ground.position=(0,0)
        self.ground.size=(800,400)
        self.add_child(self.ground)
        
        self.choosing=False
        self.pickone=False
        self.spawnone=False
        self.fmcpos=(-5,-5)
        
        #first run
        #open('fishmeatcopy.txt','w')
      #open('position.txt','w')
        #open('time.txt','w')
        #open('cropindex.txt','w')
        
        

        
        
        file=open('fishmeatcopy.txt','r')
        str1=file.readline()
        str1=str1.strip(',')
        size=os.path.getsize('fishmeatcopy.txt')
        if size==0:
            str1='typb:Unknown'
        file2=open('position.txt','r')
        str2=file2.readline()
        str2=str2.strip(',')
        size=os.path.getsize('position.txt')
        if size==0:
            self.fmcpos=(-5,-5)
        else:
            self.fmcpos=(float(str2.split(';')[0]),float(st

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值