Jump to content
  • Advertisement

maximuz_2

Member
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

118 Neutral

About maximuz_2

  • Rank
    Member
  1. maximuz_2

    game programming community

    guys i saw an orkut community for mobile game programming. its in its starting stage and i thought u guys may be interested in joining...follow this link after ur orkut login http://www.orkut.com/Community.aspx?cmm=6690124
  2. so i just need to copy the jar and jad files in the same folder of my mobile?? wat abt the manifest file??
  3. Hi guys i ve written a small game in j2me. i got the jar , jad and manifest file. now plz tell me how i m to ship the game into the phone?? i have nokia 6600, datacable and memmroy card and reader if required. I tried copying the jar file thru memmory card but the game dint run at all..Plz tell me wat all files tp copy and where to copy or watever... So plz help me
  4. maximuz_2

    [java] Nullpointer exception j2me

    Hi i solved the problem!!! It was so simple!! In jbuilder, the image files r to be pasted inside src folder itself!!! unlike wireless toolkit where there is a separate folder 'res' for images....for the user who posted:: -------------------------------------------------------------------------------- Reply Quoting This MessageEdit Message Anonymous Poster Posted - 10/21/2005 5:04:08 AM Hi guys, Im having the same problem, but with the Toolkit, and Netbeans. Man this is frustrating... nullpointer ... such a simple thing. can it maybe have something to do with creating a package? ------------------------------------------------------------------------------- well ur package is screwed only if u get javaClassnotfound exception. As long as u get the nullpointer exception, u better check for misplaced res files and nullrefernces to objects in ur code....
  5. ok then i have to ship the jad file and the manifest file into the mobile.... but can u be more specific on how it is done?? i mean should i just take the mobile memory card out and store all these files in the same folder and try to run it from the mobile?
  6. hi guys, i wrote 1 level for a simple puzzle game with ur help as well(some of u might remember!) but unfortunately i get absolutely no response when i tried to run it in a nokia6600 of my friend!!! I can run the game easily in the emulator(Wireless toolkit) .In the phone when i run the game, nothing happens no change in display..nothing.Here is the link for my jar file if any of u r intereted in testing...http://www.geocities.com/maximuz_2/trial.jar So guys help me on this .Tell me if i should upload anythin else into mobile ..Or any settings to be changed..Thanx in advance. [Edited by - maximuz_2 on October 17, 2005 8:19:44 AM]
  7. Spot on whackjack... Now uprock , scan ur code for null references to ur objects as shown above and do tell us ur experience.....hope u get it fixed..
  8. well nothing can be said abt ur problem unless u tell us which program u r executing and and probably provide source code of main parts... Anyway i had the same problem and here r my inferences. NPE(nullpointer exception) happens when: 1. U r calling an object which isnt there!!( at runtime!!) but u ll get no error in compiling since u have declared the object. 2. U r calling a resource file like an image to be loaded as in createImage("/pic.png") the image might not be there as u may only have pasted the source in src folder..(i dont know abt Sony but in wirelesstoolkit, it is 'src' folder for source files and 'res' folder for images n all)..ie u need to paste the image files u r calling into the res folder. 3. The image might be there but u r calling for it in the middle of an exception catch... These r the problems i encountered...There r many other reasons for NPE hopefully other more expert members ll help u on them... for the moment... i hope this helps...
  9. maximuz_2

    [java] Out of memory j2me

    ya dat was right i was creating objects on every keypress. but i cant c of a better way to render graphics than using an offscreen buffer.. i havent heard of a clearImage funct(tell me if actually there is something like that) but when i called System.gc() my problem seemed to have gone......thanx anyway...
  10. maximuz_2

    [java] Out of memory j2me

    thankfully i solved the problem by calling System.gc()... thanx anyway and forgive me if u guys think i am jumping the gun by posting without tryin hard enough to solve errors...
  11. maximuz_2

    [java] Out of memory j2me

    thankfully i solved the problem by calling System.gc()... thanx anyway and forgive me if u guys think i am jumping the gun by posting without tryin hard enough to solve errors...
  12. maximuz_2

    [java] Help with my puzzle game

    ya thats the thing... i was dumb enough to call createimage for each keypress(if u noticed)... so u got it right.. i tried to push up createimage above the pgm (above constructor) and succeeded!!! I solved the pblm myself.. but ur reply helped me to understand wat the error was and how my modification fixed it..... thanx unknownprodigy thanx again...
  13. I seem to rectify all my problems when a new one sprangup..i ll post my experience abt other errors in respective threads.. My error now is"out of memeory" .It happens when i reach move number 200 to 300. I think i should run some 'free memory' function.. Also suggestion on how to avoid creating objects in my key press loop are welcome.here is the error: [SOURCE LANGUAGE="Java"] Warning: Out of memory: java.lang.OutOfMemoryError java.lang.OutOfMemoryError: at javax.microedition.lcdui.MutableImage.<init>(+20) at javax.microedition.lcdui.Image.createImage(+25) at Screen.initResources(+12) at Screen.keyPressed(+139) at javax.microedition.lcdui.Canvas.callKeyPressed(+19) at javax.microedition.lcdui.Display$DisplayAccessor.keyEvent(+202) at javax.microedition.lcdui.Display$DisplayManagerImpl.keyEvent(+11) at com.sun.midp.lcdui.DefaultEventHandler.keyEvent(+124) at com.sun.midp.lcdui.AutomatedEventHandler.keyEvent(+210) at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+178) [/SOURCE] Now i all ready posted links to source code(geocities.com/maximuz_2/Trialnew.zip) and here r the code that may be of interest: [SOURCE LANGUAGE="Java"] public class Screen extends Canvas { private Tile theMidlet; private Image offScreenBuffer,img; byte tileMap[][]; int x1=0;int y1=0; int posx=0; int posy=0; byte[][] level0 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; public Screen(Tile midlet) { theMidlet = midlet; initResources(); img = null; try { img = Image.createImage("/1.png"); } catch (IOException ex) { } } protected void paint(Graphics graphics) { renderWorld(x1,y1); graphics.drawImage(offScreenBuffer, 0,0,Graphics.LEFT | Graphics.TOP); } private void renderWorld(int px,int py) { Graphics osg = offScreenBuffer.getGraphics(); for(int i=0;i<10;i++) { for(int j=0;j<10;j++) { if(level0[j]==1){ osg.setColor(0x00209020); int x=(j)*18; int y=(i)*18; osg.fillRect(x,y,18,18); osg.drawImage(img,px,py,Graphics.LEFT | Graphics.TOP); } } } } private void initResources() { offScreenBuffer = Image.createImage(getWidth(), getHeight()); } protected void keyPressed(int keyCode) { switch (getGameAction(keyCode)) { case UP: x1=x1+0;y1=y1-18; break; case DOWN: x1=x1;y1=y1+18; break; case RIGHT: x1=x1+18;y1=y1+0; break; case LEFT: x1=x1-18;y1=y1+0; break; } initResources(); repaint(); } } [/SOURCE]
  14. maximuz_2

    [java] Nullpointer exception j2me

    my project structure is: tiletrial.jpx . .---<Project Source> . . . .---Screen.java . . . .---Tile.java . .--1.png i tried "./1.png" but dint work
  15. maximuz_2

    [java] Help with my puzzle game

    ya right i get it ..but when i posted a code piece last time somebody wanted the complete code thats y!!! as far as my compiling, there is no error while compiling... just that the pgm gives error randomly while executing. what i need to know is whether there is a function for cleaning an image buffer. in the earlier thread i was mentioning the NPE while compiling but here it is encountered while executing.. hope u get my point.. here is my main application class: [SOURCE LANGUAGE="Java" ] public class Tile extends MIDlet { private Screen screen; public Tile() { screen = new Screen(this); } protected void destroyApp(boolean _boolean) throws MIDletStateChangeException { } protected void pauseApp() { } protected void startApp() throws MIDletStateChangeException { activateGameScreen(); } public void activateGameScreen() { screen = new Screen(this); Display.getDisplay(this).setCurrent(screen); } } [/SOURCE] and here is my screen class: [SOURCE LANGUAGE="Java" ] public class Screen extends Canvas { private Tile theMidlet; private Image offScreenBuffer; byte tileMap[][]; int x1=0;int y1=0; byte[][] level0 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; public Screen(Tile midlet) { theMidlet = midlet; initResources(); } protected void paint(Graphics graphics) { renderWorld(x1,y1); graphics.drawImage(offScreenBuffer, 0,0,Graphics.LEFT | Graphics.TOP); //graphics.drawImage(img, 0,0,Graphics.LEFT | Graphics.TOP); } private void renderWorld(int px,int py) { Graphics osg = offScreenBuffer.getGraphics(); osg.setColor(0x00444444); osg.fillRect(0, 0, 180, 180); for(int i=0;i&lt;10;i++) { for(int j=0;j&lt;10;j++) { if(level0[j]==1){ osg.setColor(0x00209020); int x=(j)*18; int y=(i)*18; osg.fillRect(x,y,18,18); Image img = null; try { img = Image.createImage("C:\1.png"); } catch (IOException ex) { } osg.drawImage(img,px,py,Graphics.LEFT | Graphics.TOP); } } } } private void initResources() { offScreenBuffer = Image.createImage(getWidth(), getHeight()); } protected void keyPressed(int keyCode) { switch (getGameAction(keyCode)) { case UP: x1=x1+0;y1=y1-18; break; case DOWN: x1=x1;y1=y1+18; break; case RIGHT: x1=x1+18;y1=y1+0; break; case LEFT: x1=x1-18;y1=y1+0; break; } repaint(); } } [/SOURCE] also my error is a little diff this time:] [SOURCE LANGUAGE="Java" ] java.lang.NullPointerException at javax.microedition.lcdui.ImmutableImage.&lt;init&gt;(+11) at javax.microedition.lcdui.Image.createImage(+8) at Screen.renderWorld(+100) at Screen.paint(+12) at javax.microedition.lcdui.Canvas.callPaint(+80) at javax.microedition.lcdui.Display.repaint(+78) at javax.microedition.lcdui.Display$DisplayAccessor.repaint(+14) at javax.microedition.lcdui.Display$DisplayManagerImpl.repaint(+16) at com.sun.midp.lcdui.DefaultEventHandler.repaintScreenEvent(+25) at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+775) [/SOURCE] [Edited by - maximuz_2 on October 11, 2005 11:44:18 PM]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!