1 / 14

Game Development basic

Nguyễn Trung Hải. Game Development basic. Outline. Game Structure Animation using Sprite Demo. Reference. [1]: http://en.wikipedia.org/wiki/Game_programming [2]: Mummy Game Project. Game Structure. Game Structure. Game loop: While (1) { check for user input run AI

palmer
Download Presentation

Game Development basic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Nguyễn Trung Hải Game Development basic

  2. Outline • Game Structure • Animation using Sprite • Demo

  3. Reference • [1]: http://en.wikipedia.org/wiki/Game_programming • [2]: Mummy Game Project

  4. Game Structure

  5. Game Structure • Game loop: While (1) { check for user input run AI move enemies resolve collisions draw graphics play sounds }

  6. Game Structure • Game States: • Splash • Main Menu • Loading • In Game • In Game Menu • Win Over

  7. Game Structure • Implement: Run() { switchState(beginningState); while(!exitState) { updateState(State,Mode); repaint(); } }

  8. Game Structure • Implement: • switchState(): is a function that will change Game State from this state to another one. switchState() { Call Old-State’s destructor(); Call New-State’s constructor(); }

  9. Game Structure • Implement: • updateState(): every Game State has its update() function such as: updateSplash(), updateMainMenu(),... • General upadateState() function has 4 modes: • Constructor • Destructor • Paint • Update (update information cause gamer interaction)

  10. Game Structure • Implement: • Repaint(): will call paint() function of every game state. Paint() { updateState(currentState, mode=Paint); }

  11. Game Structure • Frame Per Second (FPS): Const FPS = 25; Const Timer = 1000/FPS; ... while(!exitState) { updateState(State,Mode); repaint(); compute sleeptime; if (sleeptime>0) wait sleeptime; }

  12. Animation using Sprite • Code Implement: • Create new Sprite Object: • Image Path • Sprite Width & Heigh • Transparency process • Set Frame Sequence. • Draw Sprite object.

  13. Demo • Mummy Game

  14. Thank You!!!

More Related