C++代写: CS4410 Games Technology Assignment

Introduction

第一代Galaxian游戏在1979年登场,之后在1981年推出了升级版Galara,以及1984年的加强版Gaplus。作为早期电子游戏,Galaxian在街机市场是十分火爆的。
相比同时代的Space Invaders,由于Galaxian采用了当时的最新技术,游戏体验有了质的飞跃,是当时最受欢迎的街机游戏之一。

Requirement

In this assignment you develop an arcade style name Galaxian. The game needs to be implemented in OpenGL engine. You should define your own game objectives, such as final goals and the level of player interaction. Lives and scoring should also be planned.
The difficulty lies in how to manage the objects on the screen, the enemy flight path, in particular, and how they can track the ship. The algorithm can avoid the enemy collisions between each other, and how to aim at the player’s position.
Your program provide the following functions:

  1. OOP design
  2. OpenGL graphics
  3. a simple intro menu
  4. texture animations
  5. sound

Analysis

Galaxian也就是FC小蜜蜂,需要实现的游戏元素有:

  1. 我方飞机的交互,上下左右键,以及发射子弹,暂停等按键
  2. 敌方飞机生成,需要自动生成敌方飞机,以及敌方飞机被消灭后新敌方飞机的生成
  3. 碰撞检测,包括我方飞机和敌方飞机、我方子弹和敌方飞机、敌方子弹和我方飞机
  4. 得分、生命、关卡的逻辑,包括难度
  5. 音效、图像、画质等多媒体元素
  6. AI,敌机需要有一定智能,包括躲避、跟踪、击落我方飞机

Tips

下面给出鼠标键盘交互的逻辑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
void Galaxian::HandleEvents(Event* event) {
kbarray = GetKeyState(NULL);
switch(event->type) {
case KEYDOWN:
OnKeyDown(event->key.keysym.sym, event->key.keysym.mod, event->key.keysym.unicode);
break;
case KEYUP:
OnKeyUp(event->key.keysym.sym, event->key.keysym.mod, event->key.keysym.unicode);
break;
case MOUSEBUTTONDOWN:
switch(event->button.button) {
case BUTTON_LEFT:
OnLButtonDown(event->button.x, Height-event->button.y);
break;
case BUTTON_RIGHT:
OnRButtonDown(event->button.x, Height-event->button.y);
break;
case BUTTON_MIDDLE:
OnMButtonDown(event->button.x, Height-event->button.y);
break;
}
break;
case MOUSEBUTTONUP:
switch(event->button.button) {
case BUTTON_LEFT:
OnLButtonUp(event->button.x, Height-event->button.y);
break;
case BUTTON_RIGHT:
OnRButtonUp(event->button.x,Height-event->button.y);
break;
case BUTTON_MIDDLE:
OnMButtonUp(event->button.x,Height-event->button.y);
break;
}
break;
}