使用c++制作简单的横板射击小游戏,供大家参考,具体内容如下
#include
#include
#include
class Bullet;
class Tank;
class E_Bullet;
class Boss;
bool dead = false;
bool wined = false;
struct pos//坐标类
{
int a;
int b;
};
class E_Bullet//敌人打出的子弹
{
public:
clock_t d;
int x;
int
pygame城市之战横版射击游戏,按上下左右方向箭头操作飞机。这是一个横板射击小游戏,在黑夜的城市上空,你将要操作一架飞机去射击敌机,爆炸效果还不错。
在游戏中定义了滚动的背景类,定义了飞机类Plane,定义了子弹类,敌机类,爆炸类等,是学习Pygame和面向对象编程的好例子。
代码:
import math
import time
import pygame
from pygame.locals import *
from random import choice,randint
class