Presentation is loading. Please wait.

Presentation is loading. Please wait.

Opening Title Fire'nIce Team Member: Zhang Yujie Wang Huan Xiao Fei Cheng Peng Tutor: Alexandre Devert SSE USTC Team Leader: Wei Qiang.

Similar presentations


Presentation on theme: "Opening Title Fire'nIce Team Member: Zhang Yujie Wang Huan Xiao Fei Cheng Peng Tutor: Alexandre Devert SSE USTC Team Leader: Wei Qiang."— Presentation transcript:

1 Opening Title Fire'nIce Team Member: Zhang Yujie Wang Huan Xiao Fei Cheng Peng Tutor: Alexandre Devert SSE USTC Team Leader: Wei Qiang

2 Content Object Tools and means Design Tasks

3 Object In our project, we clone an action-puzzle game named 'Fire And Ice' which was first released in 1992. At last, we will try to make the final code high-efficiency in memory and CPU time. Leading role : Dana

4 Tools and Means Language: C++ Function Library: SDL(Simple DirectMedia Layer) SDM: Agile Development Development Tool: visual studio 2010 Gimp

5 Design The project uses agile development methods. In our weekly work, we complete a certain task and realize the gradual optimization of the code. So,our initial design for this project is not so perfect.It is just for an easy beginning.Look the picture in the next page:

6 Design

7

8 Task1: Play the game to the end,make a printscreen for each level.So we have more than 100 maps that printed from the game.Using the maps we make an HTML as a guide:

9 Task2 Task: Showing a picture in the window and move it with key pressing.

10 Task2 To Show: Using the function “SDL_BlitSurface”, “put” a png to the screen. Record the offset of the png: (x, y)

11 Task2 To Move: Two new parameters: (xVel, yVel) xVel: speed of the motion on horizontal←→ yVel: speed of the motion on vertical ↑↓ Get events from the keyboard: Case: UP: yVel -= some value Case: DOWN: yVel +=some value Case: ….

12 Task2 Then, change the offset(x, y) according to the speed on vertical and horizontal.following the formula : x += xVel; y += yVel; Put the image on the new position according to the new offset(x, y). But, before put a new image on the screen we should always flush the screen,otherwise we will see a lot of shadows like this:

13 Task2

14 Task3 Part1 Task: Make the mario move, using an image sheet. How to get a small clip of the sheet? We need three parameters: offset, height and width. Like this:

15 Task3 Part1

16 The animation needs a sequence of small clips of the Mario. We use an array to store the sequence of the clips.

17 Task3 Part1 We make a new parameter: status. If the keyboard state is UP: Set status = UP, then put the “up clips” sequence to the screen according to the position we get from the (x, y).

18 Task3 Part1 Transparency The result will be

19 Task3 Part2 Read a text file which looks like that ############## ## # # ### D# # ## # ############## Where '#' is a wall, 'D' is a little guy. The program load a picture containing pictures for the little guys and the walls.After this task we can load pictures and show them.

20 Task3 Part2 We built a new class named Tile, including its position, width, height. Then we built a new array named tiles. Read the map, case ‘#’, new a Tile, calculate its position, then put it in the tiles array.

21 Task3 Part2 Put the tile pictures according to the positions of the tiles.

22 Task3 Part2 But now, the tiles are only images, Mario can walk across them. How to solve this problem? We built a function: Collision Detection. First, we add a property in both Mario and Tiles: SDL_Rect. It’s like a box or a “shell”, like this:

23 Task3 Part2 When the two boxes get close to each other, one can not cross another’s boundary. Then , Apply the collision detection function to every tile.

24 Task4 In task3, there are only one kind of tile: block, and the block has only one status. But in the game, there are many kinds of things: blocks, fire, ice, jar, pipe…as:

25 Task4 The blocks and the ices also have 4 kinds of status: none-joined: left-joined: right-joined: Both-joined:

26 Task4 Because in the map file, every block is the same: We need to judge every block and ice what kind of status they are.

27 Task4 Before, we read the map file, store every character into an array like this: Eg: file: ’####’; in the array: ‘####’ But, in this task, we judge and change the type of every tile, like this: File:’####’; in the array they are turned into: ‘[##]’

28 Task4 Case ‘[’: put a onto the map; Case ‘]’: put a onto the map; Case ‘#’:put a onto the map; Case ‘^’: put a onto the map. So, in the map, file ‘####’ will be showed like this: Not like this:

29 Task5 Change one most important algorithm in our project: Collision Detection is replaced by Position Detection! Reason:Collision detection can not get Dana's next action after the 'collision';But position detection can do different actions after the collision,such as dropping,climing,stopping or dying.

30 Task5 With position detection, when Dana come to some place, we can know what’s around it. It makes many problems easy to solve. Such as:

31 Task5 In this situation, there is a block in front of Dana, and we can know from position that there is no block in the left-up position, or up position. According to the rules, after pressing “left” key, Dana will climb to the top of the block.

32 Task6 Each of us draw 10 maps for this project. Like:

33 Task…… Now we begin to making music and sound effect,but have not finished… Next term , We will try to make the code more efficient,reducing the amount of ‘if…else…’ that we use, optimizing the algorithm in detection, in level selecting, etc.

34 The End Thanks for Alexandre Devert very much! AND Merry Christmas! Happy New Year!


Download ppt "Opening Title Fire'nIce Team Member: Zhang Yujie Wang Huan Xiao Fei Cheng Peng Tutor: Alexandre Devert SSE USTC Team Leader: Wei Qiang."

Similar presentations


Ads by Google