资源简介
Pygame游戏源代码:坦克大战
包含代码、图片、声音等所有资源,可直接运行

代码片段和文件信息
“““ asteroids.py
basic variation of the classic
using gameEngine
“““
import pygame gameEngine random
pygame.mixer.init
class Car_1(gameEngine.SuperSprite):
def __init__(self scene):
gameEngine.SuperSprite.__init__(self scene)
self.setImage(“tank_1.gif“)
self.setPosition((100 500))
self.setAngle(90)
self.setBoundAction(self.STOP)
def checkEvents(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_a]:
self.turnBy(5)
if keys[pygame.K_d]:
self.turnBy(-5)
if keys[pygame.K_w]:
self.speedUp(0.4)
if keys[pygame.K_s]:
self.speedUp(-0.4)
if self.speed != 0 :
if self.speed > 0 :
self.speed -= .2
if self.speed < 0 :
self.speed += .2
if keys[pygame.K_j]:
if self.scene.bullet_car1.x < 0 and self.scene.bullet_car1.y < 0:
self.scene.bullet_car1.fire()
self.scene.sound_attack_begin.play()
def reset(self):
x_rand = random.randrange(40 760)
y_rand = random.randrange(40 560)
self.setPosition((x_rand y_rand))
angle_rand = random.randrange(0 360)
self.setAngle(angle_rand)
self.setSpeed(0)
class Car_2(gameEngine.SuperSprite):
def __init__(self scene):
gameEngine.SuperSprite.__init__(self scene)
self.setImage(“tank_2.gif“)
self.setBoundAction(self.STOP)
self.setPosition((700 500))
self.setAngle(90)
def checkEvents(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
self.turnBy(5)
if keys[pygame.K_RIGHT]:
self.turnBy(-5)
if keys[pygame.K_UP]:
self.speedUp(.4)
if keys[pygame.K_DOWN]:
self.speedUp(-.4)
if self.speed != 0 :
if self.speed > 0 :
self.speed -= .2
if self.speed < 0 :
self.speed += .2
if keys[pygame.K_KP1]:
if self.scene.bullet_car2.x < 0 and self.scene.bullet_car2.y < 0:
self.scene.bullet_car2.fire()
self.scene.sound_attack_begin.play()
def reset(self):
x_rand = random.randrange(40 760)
y_rand = random.randrange(40 560)
self.setPosition((x_rand y_rand))
angle_rand = random.randrange(0 360)
self.setAngle(angle_rand)
self.setSpeed(0)
class Car_choose(gameEngine.SuperSprite):
def __init__(self scene):
gameEngine.SuperSprite.__init__(self scene)
self.setImage(“tank_1.gif“)
self.setBoundAction(self.STOP)
self.setPosition((300340))
self.setAngle(0)
def checkEvents(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_j]:
if self.scene.bullet_car1.x < 0 and se
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27692 2012-07-07 17:42 attack_begin.wav
文件 142892 2012-07-07 17:41 be_attacked.wav
文件 838700 2012-07-07 17:40 beginning.wav
文件 6752 2012-07-04 23:13 bo.wav
文件 328 2006-09-08 11:25 bullet.gif
文件 15743 2012-07-16 10:02 Final project.py
文件 7276 2012-07-06 18:12 final project.pyc
文件 2102 2000-02-13 13:16 flag.bmp
文件 178 2012-07-07 02:30 flag.gif
文件 108859 2012-07-08 04:20 Game diagram.jpg
文件 290348 2012-07-12 17:05 gameEnd.wav
文件 22301 2012-07-06 23:20 gameEngine.py
文件 25803 2012-07-25 15:46 gameEngine.pyc
文件 64760 2005-01-08 19:06 goodfoot.ttf
文件 55340 2012-07-07 17:42 hitFlag.wav
文件 45210 2012-07-10 11:53 Intro_bg.png
文件 248 2012-07-06 23:16 tank_1.gif
文件 350 2012-07-10 16:49 tank_1_big.png
文件 248 2012-07-06 23:17 tank_2.gif
文件 347 2012-07-10 16:50 tank_2_big.png
文件 250 2012-07-06 23:50 wall.gif
文件 8246 2000-02-07 13:51 walls.bmp
文件 11203 2006-06-09 11:24 wooHoo.ogg
----------- --------- ---------- ----- ----
1675176 23
相关资源
- linux应用层的华容道游戏源代码
- 拼图游戏源代码 powerbuilder 9.0实例
- Scratch游戏制作-坦克大战(课件+素材
- Scratch Tank 小游戏源码.sb2
- 易语言坦克大战2源码易语言坦克大战
- unity案例入门坦克大战源码
- 祖玛游戏源代码快下吧快快
- fc小霸王坦克大战所有音效
- Canvas 坦克大战
- TankGame.rar
- C坦克大战电脑版小游戏.rar
- 经典90坦克大战素材
- pygame猴子接水果小游戏
- 坦克大战素材包
- Cocos2dx游戏源代码《萝莉快跑》
- 经典坦克大战图片音乐资源
- flash祖玛游戏源代码244940
- pygame实现的弹珠游戏源码
- cocos2dx 3.3 跑酷游戏源代码和资源
- win ce 5.0下推箱子游戏源代码
- 3D OPENGL 飞行游戏源代码
- flash打地鼠游戏源代码
- Pygame游戏源代码:超级玛丽
- 抢车位游戏源代码
- 趣味桌球小游戏源代码
- 游戏源代码RPG 游戏
- 各种游戏源代码
- Pygame游戏源代码:超级玛丽.rar
- pygame中文手册
- Flash祖玛游戏源代码
评论
共有 条评论