This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KingofGamesYami's profile picture

[BETA] Jumping Game

Started by KingofGamesYami, 03 August 2015 - 02:29 AM
KingofGamesYami #1
Posted 03 August 2015 - 04:29 AM
Pastebin Download: tDe6g6gw

Controls:

Space to Jump (Press Space in midair to double-jump!)
Hit any key to continue when "GAME OVER"

Description: Don't hit the incoming walls / objects. Inspired by Google Chrome's "Offline Game", where it's a dinosaur jumping cacti. Obviously, these aren't cacti.

I intend to improve the game, make it more complex. If you have any suggestions, please leave a comment below!

Edit: Since nobody has commented ideas, I suppose I need to be more direct. Post ideas for the game below because I don't have any yet.

Version 1.1
  • Changed some colors
  • Optimized drawing
    • Stopped drawing the field multiple times
    • Stopped clearing the entire screen; started using term.clearLine for affected lines
  • Changed "gravity" to 0.7, from 0.75
    • Makes more 'natural' jumping curve
  • Fixed detection issue mentioned by nitrogenfingers
  • Added increasing FPS / difficulty
    • Starts at 10 FPS (default), slowly increments to 20 FPS (at a score of 1000). It'll "try" to go beyond 20 FPS, but CC can't handle it so if anyone makes it past 1000 and experiences issues, please tell me.
  • Changed the way new obstacles are generated
    • Obstacles are generated closer together if they are below a certain height
  • If I missed anything please feel free to tell me so!
Edited on 16 August 2015 - 02:35 AM
Waitdev_ #2
Posted 05 August 2015 - 11:22 AM
maybe a chance of having a top bar spawn?
like in flappy bird?
LeDark Lua #3
Posted 05 August 2015 - 01:44 PM
Very good game, i like it. :D/>

Suggestions:
  • Main menu - It could be with GUI or selection box
  • Death menu - When you die, you can restart the game or quit it.
  • Charachters? Well like you can buy charachters with your points :)/> Then this would be addicting.
  • After certain points, the colors change and the game gets harder.
  • Skill points, like jump up better, slow time etc :)/>
nitrogenfingers #4
Posted 11 August 2015 - 06:30 AM
I think this is a cool game that has potential, but it still needs some work. A few comments:

Doing a single jump over a 3-high wall gives me a game over every time, even if the jump over it appears successful.
Gravity feels very strange. It doesn't feel like it maps to a parabola, particularly when falling.
I'm not a big fan of the colours. Generally I think the game could do with a bit of polish to make it more presentable.

Gameplay wise, once the jump mechanics are down the game doesn't feel like it evolves much. Typically in these infinite games there are a few paths taken to challenge the player:
- Start at an extremely high difficulty level (Flappy Bird)
- Slowly increment game speed (Monster Dash)
- Introduce obstacles that makes the game more difficult as it goes on (Vector)
- A combination of the last two (Temple Run)

Good luck with it :)/>
Edited on 11 August 2015 - 04:31 AM
KingofGamesYami #5
Posted 11 August 2015 - 05:35 PM
I've tried to fix the jump over a 3-high wall thing, it just doesn't want to work… I'm not sure what's causing it. If I change a value, that problem is fixed but… 1 high walls are completely ignored.

Gravity isn't really gravity, the jump mechanic is pretty strange. Basically I increment the player's y value by the jump value, which starts at 2.5 and is multiplied by 0.75 each frame. I also decrement the player's y value by 1, so if the jump value is higher than 1, the player moves up. If it's lower than 1, the player moves down. The lack of a parabola feeling may come from the lack of any way to display anything but whole numbers - 2.5 and 2.9 and 2.1 will all be rendered as '2'.

The colors are probably terrible, to be honest. I just picked randomly :P/>

I'd like to introduce obstacles that are more difficult, but I'm not sure how to handle them. For now, I have been working on a bit that decreases the distance between the obstacles if the obstacles are short - making the single-jump worth using. I'll also consider speeding it up in the future - though I'll have to work on the rate at which in increases.
nitrogenfingers #6
Posted 12 August 2015 - 04:38 AM
I have some suggestions (if the advice is unwanted please ignore)

SpoilerThe hitting the top of 3-highs appears to be because of this line: if math.floor( playery - 1 ) <= objects[ k ][ 2 ] then
It's tricky because your playery is 2 (where it's drawn on screen) but that isn't true relative to your obstacle heights, so what you want to do is only subtract 1 when the value is whole, and floor otherwise. Instead, I changed the playery to 1 and used if math.ceil(playery) <= objects[k][2], and that solved it.

The old-fashioned way to do gravity is to use a kinematic equation, which gives that nice jump parabola:
vf = vi + a*t
vf is your final 'step', the value you add to the player's y to move them in the jump, vi is your starting step, a is your gravitational constant and t is the length of time between updates. So you end up just mucking with how much initial speed to give your player when he space is struck, and how strong you want gravity. The downside is unless you have fairly regular updates this doesn't look great, and it also removes the half a second motionless in the air, which may be a gameplay feature.

Hope this helps!
KingofGamesYami #7
Posted 12 August 2015 - 04:16 PM
Thanks! I'll probably keep the jumping the way it is for now, may change it in the future though.

I appreciate the help with the incorrect collision a lot, never thought it'd be that :)/>
TheNeoGamer #8
Posted 14 August 2015 - 09:03 PM
Could you get a paste bin code because its really hard to copy code from the paste bin link
KingofGamesYami #9
Posted 15 August 2015 - 12:27 AM
The text that is hyperlinked to the page is the pastebin code.
KingofGamesYami #10
Posted 16 August 2015 - 04:19 AM
New Update: 1.1! See OP for details.
LeDark Lua #11
Posted 16 August 2015 - 09:42 AM
I dont like when there are walls too close to another and I fail there.
KingofGamesYami #12
Posted 17 August 2015 - 02:26 AM
Can you screenshot an example? AFAIK, all obstacles are jump-able. Only obstacles you can clear without double-jumping are allowed to spawn close together, to add variety and difficulty to the game.
ExplosiveFerrets #13
Posted 04 November 2015 - 01:53 PM
Yeah, actually fun game!
I don't know if anybody already have suggested this, but add a leaderboard or something. It could be an online leaderboard!