Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Android] Floor Runner  (Read 5278 times)
0 Members and 1 Guest are viewing this topic.
Offline Ging3rtoby
« Posted 2015-10-29 12:23:11 »


I am currently working on a little android game called floor runner. The idea is your a stick man and you just have to keep away from objects trying to kill you. Very simple. Currently I have some base code in place and very bad graphics. I am looking for someone to create some minimlistic but good looking art, if they want. I will start to post screen shots when im making good progress. This is just the start of the post.

I have a question on how to add double jumping into the game, below is the code I use for jumping.

public void update(float delta) {
      if(jumping) {
         velocity.y = -100;
         jumping = false;
      if(position.y > originalY){
         position.y = originalY;
         canJump = true;
         canJump = false;

      collisionBox.x = position.x + 3;
      collisionBox.y = position.y + 1;

   public void onClick(){
         if(!jumping && canJump == true){
            jumping = true;
            canJump = false;
Offline Kami

Senior Devvie

Medals: 16
Projects: 1

I am not a vampire

« Reply #1 - Posted 2015-10-29 15:37:32 »

Add another boolean to your code
boolean doubleJumped

and with that determine if the player can jump again even after jumping once. I guess you get the idea right?

"If I can't be the best I sure as hell can be the worst"
Offline Ging3rtoby
« Reply #2 - Posted 2015-10-29 15:43:16 »

I did have that idea but the part I struggled with is where do I add that boolean and how do I modify the loops
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Longarmx
« Reply #3 - Posted 2015-10-29 21:48:31 »

Instead of using a conditional statement in your update loop, perhaps it would be better to call a method to set the player's velocity.

private void jump() {
     velocity.y = -100;

Then, when the screen is tapped and the player is still on the ground (the first jump), this method is called instead of setting
jumping = true
. If the screen is tapped again before the player hits the ground, and
doubleJumped == false
, then you can set
doubleJumped = true
and call
. Just remember to reset
back to
when the player hits the ground.

Offline Springrbua
« Reply #4 - Posted 2015-10-30 07:30:00 »

You could also keep an int
and increase it, whenever jump is pressed. Reset it when the player comes down to the floor again.
You can keep a constant
and if
jumpCount > MAX_JUMPS
just don't jump.
This way you could also have a tripple jump one time, which would be "something new" Cheesy

EDIT: How do i add In-Line code?!?
Offline ShadedVertex
« Reply #5 - Posted 2015-10-30 07:34:14 »

It all comes down to the usage of booleans to determine if it's the second time the player is jumping. And it's up to the boolean to prevent the player from triple-jumping.
Offline Ging3rtoby
« Reply #6 - Posted 2015-11-01 16:59:06 »

So looking at the post I now have double jumping in the game which will allow me to start adding some game features. The screen shot below shows the current state of the game. I have added some rectangles for collision detection which I will be adding next.

Offline Longarmx
« Reply #7 - Posted 2015-11-01 19:21:51 »

Hopefully those collision bounds get reduced because there are not many things more infuriating than a misrepresented visual  Pointing

Offline Ging3rtoby
« Reply #8 - Posted 2015-11-13 17:35:21 »


So here is a little post showing what I have added into the game.

- A player (needs new graphic and now has double jump)
- A floor and roof which scroll
- Blocks to jump over that are randomly generated and inifinite
- Simple collision detection with the block and player
- Projectiles that fire off at random directions and random angles
- A bat entity that needs some very basic AI

Here is a little screenshot off the progress.

Offline micecd

Junior Devvie

Medals: 8

« Reply #9 - Posted 2015-11-13 18:14:33 »

Use points for the tips of the spikes as collision, not boxes.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ging3rtoby
« Reply #10 - Posted 2015-11-24 15:23:17 »

Another new update to bring:

- A bat now has a simple AI that fires projectiles to the player
- The player now has a new texture
- Some AI for generating the terrain was tweaked

Offline Ecumene

JGO Kernel

Medals: 200
Projects: 4
Exp: 8 years

I did not hit her! I did not!

« Reply #11 - Posted 2015-11-25 12:45:43 »

EDIT: How do i add In-Line code?!?

Rich [icode]Purnell[/icode]


Pages: [1]
  ignore  |  Print  

Riven (581 views)
2019-09-04 15:33:17

hadezbladez (5509 views)
2018-11-16 13:46:03

hadezbladez (2402 views)
2018-11-16 13:41:33

hadezbladez (5771 views)
2018-11-16 13:35:35

hadezbladez (1223 views)
2018-11-16 13:32:03

EgonOlsen (4661 views)
2018-06-10 19:43:48

EgonOlsen (5682 views)
2018-06-10 19:43:44

EgonOlsen (3197 views)
2018-06-10 19:43:20

DesertCoockie (4095 views)
2018-05-13 18:23:11

nelsongames (5115 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!