Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi
i am newbie to j2me
and want to write a snake game,
which objects can i use for snake body and food and board?
can i use images for them?
how can i write this game that in every mobile it be full screen?
thanks
Posted

Judging by your question(s) you need to spend some time researching the structure of games programs (and probably Java). Try a Google search for "j2me games", look at the J2ME[^] web site, and the CodeProject articles.
 
Share this answer
 
You can use images but because you are a newbie I wouldn't focus to much on that. Simply draw rectangles of different colors for now. The same goes for being able to show it in full screen, but here you should mind scaling. The easiest way is to define the play field as little blocks (which can be a peace of snake, food or obstacle). You can create a class for this. This class can also draw this to a graphic (so it can be called in the OnPaint event). This class makes sure that all the blocks are drawn in the correct scale accordingly to the given height and width of the screen. So the width and height of each block is screen_width / horizontal_number_of_blocks, screen_width / horizontal_number_of_blocks. You also use this scaled value to determine the position of each block by multiplying it with that value.

Hopefully the above text makes somewhat clear what I mean. If you have any questions, just ask :). The most important thing to do first is to build the basics of a working game and then go from there. Just keep the code as clean as possible so it is very clear to understand and consists only of code you actually understand.

Good luck!
 
Share this answer
 
Comments
Reza Oruji 12-Apr-11 11:09am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900