This site requires JavaScript, please enable it in your browser!
Greenfoot back
epicm512
epicm512 wrote ...

2012/12/2

Help With New Game Please!

epicm512 epicm512

2012/12/2

#
Hi, I'm a newcomer thats wants to make something awesome! I am planing to make the original arcade Mario Bros. game in greenfoot. I am going to make it almost exactly like the game but i will need your help. Please assist me in this project with the questions i post in this discoussion.
epicm512 epicm512

2012/12/2

#
First off, if anyone comes, can you tell me exactly how to add gravity to my game and jump time?
Game/maniac Game/maniac

2012/12/2

#
you can use the player class in this scenario
epicm512 epicm512

2012/12/2

#
thanks its helping quite a lot
Game/maniac Game/maniac

2012/12/2

#
your welcome
epicm512 epicm512

2012/12/2

#
this will be done by next week. Maybe...
Game/maniac Game/maniac

2012/12/2

#
cool
epicm512 epicm512

2012/12/6

#
how do i make Mario kick enemies?
danpost danpost

2012/12/6

#
Just change the image when a certain key is pressed. Change it back when the key is released. Note: you will need an instance boolean variable to track the state of the key used (I will use one called 'keyDown' for the variable and 'key' for the String we are checking for). The two check will be as follows:
if (!keyDown && Greenfoot.isKeyDown(key)) 
{
    setImage(...
    keyDown = true;
}
if (keyDown && !Greenfoot.isKeyDown(key))
{
    setImage(...
    keyDown = false;
}
epicm512 epicm512

2012/12/8

#
thats good but i need not the movement but the action so mario kills eneimies that way
danpost danpost

2012/12/8

#
Do you want
if (keyDown && !getIntersectingObject(Enemy.class).isEmpty())
{
    // code to do damage or kill enemy
epicm512 epicm512

2012/12/9

#
thank you all! I'm almost done!
epicm512 epicm512

2012/12/9

#
by the way does that last bit of code work so that if you press a button you kick and not constatly?
danpost danpost

2012/12/10

#
You probably want to set an instance boolean to true in the 'if' block. Then, do a check that if it is true and the key is NOT down, reset it to false. That will cause one damage per kick; but the kick image will persist until the key is released.
epicm512 epicm512

2012/12/18

#
ok thks
You need to login to post a reply.