Buttons

Photobucket Photobucket Photobucket Photobucket Photobucket

Tuesday, February 21, 2012

Finite State Machine

Programming language: C++
Software: Microsoft Visual Studio
Engine: Opengl

Player is a pirate, gun as a weapon.
When the player shoot the bullet, it must hit the ghost or out of the playable area, then the player able to shoot again.
Player had to pass through the protector and go into the door to get the treasures.

FSM # 1                                       States

Ghost spawning machine (enemy)

When ghost is less than 4 and player had not kill 20 ghosts, spawn more ghost to 4.
When player shoot ghost, the ghost get hit by the bullet, the bullet had same position as the ghost and ghost health point more than 0, follow and damage the player.
If the bullet is not same position as the ghost and the player in the healing area, Ghost move around.
Ghost health point is less than or equal to 0, ghost get destroyed.

Conditions

Ghost spawning machine (enemy)

When ghost is less than 4 and player had not kill 20 ghosts, spawn more ghost to 4.
When player shoot ghost, the ghost get hit by the bullet, the bullet had same position as the ghost and ghost health point more than 0, follow and damage the player.
If the bullet is not same position as the ghost AND the player in the healing area, ghost move around.
Ghost health point is less than or equal to 0, ghost get destroyed.

State Transition Diagram



FSM # 2                                     States

Protector

When player is in healing area and health point less than 50, start heals players’ health point till full, 100.
When player is not in healing area or health point reach 100 after healing or players’ health point more than 50, idle.
When player killed 20 ghosts, open the door to exit.

Conditions

Protector

When player is in healing area AND health point less than 50, start heals players’ health point till full, 100.
When player is not in healing area OR health point reach 100 after healing OR 
players’ health point more than 50, idle.
When player killed 20 ghosts, open the door to exit.

State Transition Diagram









Other Inputs

Keyboard Inputs
W - Move Forwards
A - Move Left
S - Move Right
D -Move Backwards
Enter - Shoot

Animation
- Collision Detection against ghost (player)
- Healing Health Point (player & protector)
- Player’s movement (left & right)
- Bullet’s movement & explosion
- Ghost’s movements


No comments:

Post a Comment