Click here to Skip to main content
13,096,157 members (52,163 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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?
Posted 12-Apr-11 4:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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!
rezaricky 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 17 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100