Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Mobile J2ME
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 12-Apr-11 5:30am
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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 Smile | :) . 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!
  Permalink  
Comments
rezaricky at 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
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 17 Mar 2013
Copyright © CodeProject, 1999-2014
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