Basic Game

No you are exactly right. You should use that directly it gives more flexibility and it’s easier. I should have put the comment rewrite this method to suit your need.

Gudradain, any thoughts on why those mouse click events aren’t firing off?

Those methods start with lower case ‘m’ :stuck_out_tongue: ;D

???

:-\

:cranky:

:frowning:

if you add the @Override annotation, the compiler will warn you in this case.

@Override
public void MousePressed(MouseEvent e){}

lol it’s always funny to find a stupid error :slight_smile:

@Gingerious

Great sketch!
I laughed so hard at your post I started crying.

It really hit close to home. Thank you!

Yeah, I found that sketch online and it fits in so many situations.

After changing the Ms to ms, everything worked just fine and I could access the booleans I created using an instance of the class that I’ve added to the canvas. Thanks guys!

@philfrei
That sketch is actually quite a popular meme online :wink:

@Gingerious
ROLFMAO at your post, glad to help :slight_smile:

EDIT: Adding another option to Riven’s post, you could just implement MouseListener instead of extending MouseAdapter and it would have told you about missing methods :smiley:

yeah, I am iwht ra4king, I’ve always used listener. Another good thing about it, is if you need to extend something else, cuase if you’re extending MouseAdapter ur stuck iwth just htat. Although in the code u ahve there it looks like it won’t matter, but some other time it might :).

I think that all programmers should have that meme with them at all times, cause I cant count the number of times I’ve spent hours looking for a bug, and like found that I mispelled something, or like I accidentally put a semicolon where is shouldn’t be.

Great tutorial. Can you share Geometry Wars Remake’s soource code?

I’m sorry to be an ass here, but this most certainly is not an article or a tutorial. There’s no explaining going on what so ever. If anything, then this is just a codesnippet for someone to use and you can’t use it without knowing how every part of the code works, or else you wont be able to make a game out of it. So it’s not even a “basic game”. And just copy/pasting wont teach you how to do anything.

Besides this:

 
if(deltaLoop > desiredDeltaLoop){
    //Do nothing. We are already late.
}else{
    try{
        Thread.sleep((desiredDeltaLoop - deltaLoop)/(1000*1000));
    }catch(InterruptedException e){
        //Do nothing
    }
}

really ought to be this:


 if(deltaLoop <= desiredDeltaLoop){
    try{
        Thread.sleep((desiredDeltaLoop - deltaLoop)/(1000*1000));
    }catch(InterruptedException e){
        //Do nothing
    }
}

because having an empty if clause is just weird. Especially when it seems like it was only ever supposed to do nothing.

@Regenuluz Indeed…

Personally I learn faster with code snipset that I can execute than long text. Still if you want to contribute you can write a description of what every part is doing and I will add it to the first post.