Hello game developers!

This is brilliant thanks (:

I have a question about the coding he uses. Are those codes the same what everyone kind of uses? like:

long delta = System.currentTimeMillis() - lastLoopTime;
lastLoopTime = System.currentTimeMillis();

and

g.dispose();
strategy.show();

and

try { Thread.sleep(10); } catch (Exception e) {}

and

JPanel panel = (JPanel) container.getContentPane();
panel.setPreferredSize(new Dimension(800,600));
panel.setLayout(null);

The names he uses that make the game work, are they the same with any coding? Like for your loops, do you use “lastLoopTime” exactly for that specific behavior?
Is it like a lot of memorization to know all these exact codings to know what to do with it, or is he making those codings the way they are?

It’s a variable.

You can define them, assign values to them, and read them back.

Learn Java (or how to program in almost any language) first… buy a book. You’ll be much better off.

I understand, and I am learning about variables and inputs and stuff. I understand that variables can be assigned, thats what you do with the equal sign, just like in math class x=8 ect.

Using this as my question/ explanation:

long delta = System.currentTimeMillis() - lastLoopTime;
lastLoopTime = System.currentTimeMillis();

Ok so I think I kind of get it. In the post I replied to last, “System.currentTimeMillis()” is really something that java can recognize? And he sets (what HE made up) “lastLoopTime” as the variable so he understands what that behavior is be naming it that?

Is it something like that? And if “long delta = System.currentTimeMillis() - lastLoopTime” but “lastLoopTime = System.currentTimeMillis()” don’t they cancel out (is that even a minus sign or is it just indicating that the System.currentTimeMillis is the lastLoopTime??"

Or am I thinking to much lol sorry

Check out the java docs: http://download.oracle.com/javase/6/docs/api/

Then look for the System class, then look for currentTimeMillis() within it. If he’s calling any method that he didn’t create himself, that means he’s calling a Java method (or a method from a library he uses in the case of the OpenGL version stay away from that version for a long while).

System.currentTimeMillis() gives you the current time in milliseconds since Jan 1, 1970. That means when he calls it twice, he is measuring the time between when he first called it and when he called it the second time. You can use that value to decide how much to update your game (the delta).

So was I totally wrong then?

And thanks I appreciate your post!
May I ask why OpenGL I should stay far away from? I wiki’d it before but of course I don’t understand it completely yet.

Let’s image you haven’t asked any question, and start over:

What would you do if you’d move to another country, let’s say France. How would you learn the language? Chatting with the local baker, with hands and feet, maybe looking a few words up on a dictionary, and hope the best of it, or would you learn the language properly.

You’re attempting to write poetry in French. Lets’ face it, it’s not going to happen, without a major investment in the language first.

I realize where you are going at, but I am trying to learn the best ways possible with tutorials and following things and learning about basics, and read codings to see how and why things work, ect

Your ‘tactics’ will waste a lot of time. Surely, if you have that time, you can get better and better, and maybe eventually gain some skills, but you could have spent the same time mastering it.

So what you want me to do exactly??

Buy a book, study it, don’t turn the page until you grasp what’s on that page. Write your ‘Hello World’ program, slowly write more complex programs, preferably not with a GUI. Master the language first, after that, try to make a window with buttons, etc. Don’t skip any parts, it might take a few months and you can maybe even show us a command-line game! Once the logic works, try to turn it into a GUI, where you paint things, and catch key-events. Yay! After that the possibilities are endless.

There is no shame in text RPGs. I would totally play it. :slight_smile:

Thanks Ravin!(:
Good advice indeed, is that what you did?

I can see it taking awhile before I have anything up… I was trying to make that space invaders game that guy posted earlier and I copied the coding and set the class right and stuff but it didn’t work of course. I get errors on the “String argv[]” line all the time =[ can someone tell me why??

And then I’ll go back to the basic tutorial that I was doing before that was making me windows and inputs and buttons (:

But this error is annoying me, same with some other ones sometimes, why?! >.<
lol

No, I wasted a lot of time on a bad book (yes, I advise you to buy a good book) when that thing called the internet wasn’t anything like it is today and wasn’t much of a resource for n00bs. I also spent a lot of time programming without any guidelines whatsoever. That was almost 15 years ago.

Anyway, few people learn from other peoples mistakes, they have to experience it on their own. Please prove me wrong.


public static void main(String[] args) {}

It should look like that. I can’t help you diagnose the problem if you don’t give detail.