![]() |
SOFTWARE DESIGN Finite state machines are heavily used in the implementation of Last Line. Each component has its own finite state machine. For the following, it is a detail explanation of how to the finite state machines and data structures used to keep track of the state of each component. Finite State Machine: Enemy: Normal:patrolling wait for some period and go to Fire Get Hit: go to Die routine Die: explosion and disappears go to Wait Wait: wait for a certain time come back to life go to Normal Fire: get player coordinates and fire the bullet go to Normal Boss: Normal: patrolling wait for some period and go to Fire Get Hit: reduce some energy if energy = 0 then go to Die else go to Normal Die: explosion and disappears go to Wait Wait: wait for a certain time come back to life go to Normal Fire: get player coordinates and fire the bullet go to Normal Bullet:
Normal:
Different Data Structure: Enemy Bullet: We use an array to implement the FSM for the enemy bullets:
Enemy and Boss: We use an array to implement the FSM for the boss and enemy:
|