Hi, i'm just starting to try game development using javaI already know the basic stuff like the collections, arrays, objects, classes, simple gui formsI started gathering all the information i can get my hands on and started trying out easy coding examples. What i'm trying to create is a tilemap with predefined pictures, turn based, keybord input, 2 players.

I transferred the classes to the java dir and added them into the program.But it gives an error at g.setColor(0xffffff);g is null hence the java.lang.nullpointer exeption... how can a example be wrong, or is this only made for cellphones?If i'm realy wrong what classes should i use then to create a tile map, letting 2d pictures move around it and turn based?

getGraphics() is not the way! Change render to the paint method of the Canvas and instead call repaint(). This will cause a call to Canvas.update(g), clearing the canvas with the background colour, which then calls Canvas.paint(g). If you're wondering where it gets g from, well that would be the Graphics g associated with the current draw of the frame.

I don't understand what you just said, the example given on the website iswrong?I'm having a hard time finding out what the methods do. But i'll tell you what i did.

First i removed the line Graphics g = getGraphics(); because i shouldn't use it for some reason.Then the name of the function render should be changed to paintand i should call repaint, paint in it but there i lost you

When i enter the function paint( it needs Graphics) and won't compile I'm alsoo unsure if i'm ment to use the game classes in javax.microedition or mayby i need different ones, not for cellphones ?? I just want to run it on a pc and if i keep using them can it be run on a compputer aswell then?Mayby somebody know a site for starters in java game programming?Note i use IntelJIdea 4.5so many questions...

I highly doubt that the MIDP library will work just on PC's. Looking at the GameCanvas documentation, I noticed one thing that makes me believe this: It had static variables to represent various keys, and these keys were for ones that wouldn't be used on a PC for a game, they seemed tailored for cell phones.

Perhaps you chose to use an external library for your 2D game stuff to make it easier, and there probably is one out there, but it's not that hard to do what you need, especially because Swing and AWT do most of it. If you do do it yourself, you will learn so much more about basic Java programming that wouldn't have learned by using someone else's work (not to say that reusing is bad, but for beginning things, it's a good learning experience to do it yourself).

One question; what programming experience do you have? What are you aiming to achieve? And what do you know about how you need to go about getting started with games development?

I am asking so that we all know where you are coming from, that way you can be better directed on an appropriate route. There is nothing wrong with asking such a question, especially if there is no FAQ in an obvious place telling you this answer.

Keldon i have no problem awnsering to your questions:what programming experience do you have? I'm a student First grade Informatics, and I got an introduction into java and c.An introduction means the difference between classes and objects, inheritance, public/private, collections, arrays, simple gui forms.I didn't had: Drawing, buffering, shading, big projects(never more then 5 classes), animation.

What are you aiming to achieve?I'm trying to learn the language better by using it, i've been thinking a long time to make a game, we actualy got a project for the c languagewhere i made a 4 on a row game text based. But i couldn't draw on the screen too complicated. Then Java was about objects and it looked much easier and clear.Then i saw a simple game on nintendo ds and i tought This is not so hard, let's try that. It's called Advanced wars.

And what do you know about how you need to go about getting started with games development?I've been reading alot about it on the internet, I tried code moving triangles over myown canvas, saw tile based maps wich realy looked easy, stumbled over a game api with all kind of special stuff but that didn't workthen I came here. Later i found out it was for mobile phones...

lhkbob, i'll start with using awt and swing and maybyi'll post myfinished program here in some umm months?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org