Show Posts
|
|
Pages: [1] 2
|
|
1
|
Java Game APIs & Engines / J2ME / Re: RMS problem
|
on: 2005-04-25 17:54:48
|
I tried to close the record store. But it also saves the record during the game is running, and the record will lost after I close the application.  Thanks for your reply
|
|
|
|
|
3
|
Java Game APIs & Engines / J2ME / Re: RMS problem
|
on: 2005-04-25 11:04:20
|
|
I called closeRecordStore() already: public class GameScreen extends Canvas { .............. rs = RMSUtil.openRSAnyway(dbname); ......... public void paint() { ................ rs = RMSUtil.openRSExisted(dbname); if (rs==null) { g.setColor(255, 255, 255); g.drawString("Your Score "+String.valueOf(spriteScore), 0, 20, Graphics.TOP|Graphics.LEFT); } else { try { if (spriteScore>=RMSUtil.readInt4RS(rs, r1)) { r1 = spriteScore; r1 = RMSUtil.writeInt2RS(rs, spriteScore); g.setColor(255, 255, 255); g.drawString("Highest Score" +String.valueOf(RMSUtil.readInt4RS(rs, r1)), 0, 40, Graphics.TOP|Graphics.LEFT); rs.closeRecordStore(); } else { g.setColor(255, 255, 255); g.drawString("Highest Score " +String.valueOf(RMSUtil.readInt4RS(rs, r1)), 0, 40, Graphics.TOP|Graphics.LEFT); rs.closeRecordStore(); } } catch (Exception e) {} } ............. } ............. .......... }
But it doesnt work, did I have another thing go wrong? Thanks for your reply
|
|
|
|
|
4
|
Java Game APIs & Engines / J2ME / RMS problem
|
on: 2005-04-24 18:37:21
|
After I installed an application to my phone, and the application contains a RMS. When I run this application, it can save my highest score. However, after I closed my application, all data (record) will be lost. Does it is possible to make a permanent database in the application? Thanks a lot! My RMS to open a database is: public static RecordStore openRSAnyway (String rsname) { RecordStore rs = null; if(rsname.length()>32) return null; try { rs = RecordStore.openRecordStore(rsname, true); return rs; } catch (Exception e) { return null; } } public static RecordStore openRSExisted(String rsname) { RecordStore rs = null; if (rsname.length()>32) return null; try { rs = RecordStore.openRecordStore(rsname, false); return rs; } catch (Exception e) { return null; } } public static int writeInt2RS(RecordStore rs, int data) { byte []tmp = new byte[4]; tmp[0] = (byte)(0xff&(data>>24)); tmp[1] = (byte)(0xff&(data>>16)); tmp[2] = (byte)(0xff&(data>>  ); tmp[3] = (byte)(0xff&(data>>0)); try { return rs.addRecord(tmp, 0, tmp.length); } catch(Exception e) { } return -1; }
|
|
|
|
|
5
|
Java Game APIs & Engines / J2ME / Re: Simulator and real phone
|
on: 2005-04-24 14:55:30
|
|
I discover that when I changed the Splash image to a text (i.e: g.drawString("GameABC", 0, 0, Graphics.TOP|Graphics.LEFT); ) then the problem will not occur. But when I use an image to replace the text in the title Page, the problem will occur again. P.S: The splash image only 1.2KB. Can anyone help me? Thank you very much!
|
|
|
|
|
7
|
Java Game APIs & Engines / J2ME / Re: Simulator and real phone
|
on: 2005-04-23 12:36:16
|
|
Oh, sorry. 1) The error message is " ! Unable to run application" The message is displayed after I choose "start" in the Splash image. 2) I use Nokia PC Suite to install my application 3) JAD file contains 3 classes, they are: a) GameMIDlet b) GameScreen (i.e. Canvas) c) RMSUtil (i.e recordstorage) For the RMS, I create a database called "gamedb" which places in the constructor of GameScreen. And then it will compares the scores with the scores in the database every time. If the score is higher than the database, it will replace database's record. d) 11KB of png in res 4) I use Sun's KToolbar and Nokia S40 SDK to develop my application.
Thanks a lot~~
|
|
|
|
|
8
|
Java Game APIs & Engines / J2ME / Simulator and real phone
|
on: 2005-04-22 20:47:01
|
Hello everybody, I use simulator to develop my game, but after install the program to my phone (Nokia 3120 and the file size of the game is 24KB), and the real phone tell me cannot be excuted. So, could you tell me which factors can lead to this problem?  Thank you very much~
|
|
|
|
|
9
|
Java Game APIs & Engines / J2ME / Random play animation
|
on: 2005-03-25 08:23:57
|
Hello everybody, If I want to produce the game that the enemy will attack the player randomly by calling the random integer (randInt) and when the enemy attack the player it will play an animation, that means: eg) if (randInt == 0) { // enemy plays defense animation } if (randInt == 1) { //enemy plays attack animation } And in the paint method, I use clipping for the animation. In the while loop (i.e game loop), when the Thread sleep 100ms, the clipping will change one frame (i.e:repaint), the animation will be fully played until the 6th frame is displayed. However, the problem is after 100 ms, the random and animation will begin at the same time, that means when the attack animation is playing, it will suddenly change to defense animation in the middle of the attack animation and vice versa. So, can anyone can teach me where the random method should be placed so that it can fix this problem?  Thanks for your reply~~
|
|
|
|
|
19
|
Java Game APIs & Engines / J2ME / Re: Time Skipping
|
on: 2005-03-07 01:21:12
|
|
Thanks for Mr ribot. I tried to apply: int n = ufoMissiles.length; for(int i=0;i<n;i++) { ufoMissilies.doDraw(g); Thread.sleep(1000); } but it leads to the screen (all elements) hold a second and then run again. Sorry, I may not provide very detailed information. In my program, there is a paint method: public void paint (Graphics g) { // doing any drawing .......................... for(int i=0; i < ufoMissiles.length; i++) { ufoMissiles.doDraw(g); } } And then my class implements Runnable method, public void run() { ............. .............
if(ufoMissileCount < ufoMissiles.length &&ufos.isDropBomb()) { for(int j=0; j < ufoMissiles.length; j++) { if(! ufoMissiles[j].isAlive()) { ufoMissiles[j].setX(0); ufoMissiles[j].setY(ufos.getY() + ufos.getHeight()); ufoMissiles[j].setAlive(true); ufoMissileCount++; break; } } }
........} So, when the condition is achieved, it will draw the ufoMissile, but the ufoMissiles are too closed when they are displayed, so I want to separate them so that they can be displayed one by one. Thank you.
|
|
|
|
|
20
|
Java Game APIs & Engines / J2ME / Time Skipping
|
on: 2005-03-06 15:46:47
|
for(int i=0; i < ufoMissiles.length; i++) { ufoMissiles .doDraw(g); }
For above code, if I want to draw ufoMissiles[1] after 1 second of drawing ufoMissiles[0], which things that I should do?  Thanks for your reply!
|
|
|
|
|
26
|
Java Game APIs & Engines / J2ME / J2ME button control problems
|
on: 2005-02-01 14:01:31
|
|
Hello everybody, I have a problem about the button (e.g KEY_NUM1, KEY_NUM2 .... etc), Why the buttons are disable (i.e. no action after pressing it) except KEY_STAR and KEY_POUND? All are disable such as KEY_NUM1, KEY_NUM2 ..... KEY_NUM9. My program like below:
switch(keycode){ case KEY_STAR: System.out.println("CDE"); break; } switch(keycode) { case KEY_POUND: System.out.println("ABC"); break; }
Thank you very much~
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|