Case study: Mophun version of the eating snake for Sony Ericsson T610 (China called T618)
This CASE discards the Snake version included in Mophun, and the author performs the entire Case in a to z method.
Title: mymsnake
Version: 0.01
Words: c
Design summary:
In this release, only the logic of the game is reflected, emphasizing the playability, ignoring the menu design, the highest split file, the game progress storage read. The entire game is similar or imitating the ethliament version of the NOKIA8250. This article is only for learning reference and does not infringe copyright. The basic process of the game, a small Snake, especially delicious, looking for food on the top of the screen, find score and growth. After a while, the length of the small Snake will increase, she accidentally touched the wall with her body Game over.
detailed design:
(1) The basic data structure in the game:
Small SNAKE can be used to represent a linked list that can only grow, the storage structure of the linked list is as follows:
D (r) -> c (r) -> b (r) -> a (r)
In brackets, the motion direction of the small Snake body is -> means the chain table pointing, the header Snake HEADER = A, the tail: snaketail = D
Small Snake's Movement Law Analysis: l Left R Right U on D
At the time of t (i),
A (u) b (l)
E (r) d (r) c (u)
At the moment of t (i 1),
E (u)
A (u) b (l)
D (r) c (u)
This can be found, in fact, it can be used to transform the last small Snake node, and the small SNAKE moves in accordance with the description of the specific rules, so that the efficiency of the algorithm will be high.
What should I do if I do a small Snake to eat delicious?
This greedy Snake, after eating food, just in the tail of the linked list in Pamp. OK.
The entire map uses a two-digit BACKGROUND [20] [16], 20,16 to take the value according to the SE T618 screen size: 128 * 160 Pixels * PIEXELS and 8 * 8 small Snake body, you will find this pair There is a lot of help in programming work. We can simplify the logic of the entire game:
A Small Snake moves before removing the image on the map
B small snake moves back to the map on the map ourselves
C Small Snake Moves a point on the map with two own images, GameOver.
Write here today. Next, I will write source code according to this idea. This Case is also my new project. I have done a Russian square (J2SE J2ME), the J2ME Mophun, Tank Wars (J2ME J2SE), a small plane and its map editor (J2ME J2SE), Network 50 Supreme (J2SE), waiting for a series of games. Next, try the development of RPG and 3D. Of course, that is the case after this case OK, this case is purely for writing articles, but do it. , Rest assured that I will be very serious