Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  Jumping Jack 4K  (Read 4370 times)
0 Members and 1 Guest are viewing this topic.
Offline malberts

Junior Devvie

« Posted 2007-02-28 08:09:08 »

This is my first entry into Java 4K. I only heard of the competition about a week before the closing date, so I had rather little time to plan something.

The game is pretty basic and crude: you jump until Jack dies (or your fingers die, whichever comes first, heh).

I've uploaded 2 versions.
The Webstart one cannot keep high scores, whereas the JAR one can.

The keys:
Left/Right to move
Up to jump
Escape to exit
P to pause
S to stop game and record high score if you got one (Only works in JAR version).

Everything is procedural.
Currently the things are drawn in hardcoded drawXXX statements. Is it possible (or feasible) to have, say, a String array where each String is of the form "(type) x x x x x x x x" where (type) is a letter (or number) for Oval/Rectangle/Whatever and the x's are coordinates. Then you'd have a single for-loop in the draw stage with a switch based on the first part of the String and then have the various drawXXX statements use the rest of the String as coordinates?

The Webstart file is 2,902 bytes, the JAR one 3,480 bytes. Now that's quite a difference seeing that the JAR only has an extra Scores array and a small part for reading/writing the high score info. Do you think it's worth it then to let the game keep high scores?

Both files are way under 4096 bytes but that's because I didn't really have much time to plan a good game. The source is plagued with a lot of duplicate if's and stuff. So I should be able to decrease the size even more.

This is the way I get my files as small as possible:
  • Compress with 7zip.
  • Obfuscate with Progaurd. (Are there better ones? Can 2 obfuscators be run on 1 file make it even smaller?)
  • Extract the obfuscated JAR and compress again using 7zip.

This basically changes my JAR size like this:
Compressed: 4,807 bytes
Obfuscated: 3,591 bytes
Re-Compressed: 3,480 bytes
Am I missing something by having to compress again, or is this the way ProGaurd works?
I realized now: after obfuscation the field names contain similar strings like java_whatever_whatever_ and that's why re-compressing decreases file size more.

Known Bugs:
When the player moves off screen, the wrapping isn't really correct. The part of the player going off the screen must appear on the other side but instead the entire player goes to the other side when it's completely off the screen. This sometimes cause a glitch when you run over a hole that is also partly off the screen.

Sometimes when the player jumps in a strange way the level numbers gets messed up and that makes the game unplayable.

Things I'd like to add:
  • More than 1 hole at later levels
  • Monsters at later levels that make you fall
  • Pick-ups that temporarily decrease hole speed

My logic tells me it's unnecessary to have lives?

The game's link:

In space no-one can hear you System.out.println()
Offline CaptainJester

JGO Knight

Medals: 12
Projects: 2
Exp: 14 years

Make it work; make it better.

« Reply #1 - Posted 2007-02-28 12:17:38 »

Is the game supposed to appear on the list immediately after submission because mine hasn't?  Huh
No.  It has to be manually approved before it will be shown.  Don't worry though, as long as it is in before the deadline it will be accepted.

Offline Morre

JGO Knight

Medals: 2
Projects: 10

I'm Dragonene on IRC.

« Reply #2 - Posted 2007-02-28 21:54:52 »

Please, link to the game from this post (not directly, but via javaunlimited). Smiley
Now, I've tried it, and found a bug. If you jump up through the first hole and hold down the up arrow, you go up all the way and then gain one level per jump. Reached level 15 in about as many seconds. Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline malberts

Junior Devvie

« Reply #3 - Posted 2007-03-01 12:06:45 »

The bug I got was later on when the holes move faster and the character goes over the side and falls. The fall animation is then drawn on the line above the one where the player was. The player then falls back down to the level he was at. The level counter then goes crazy and the player can jump through the lines.

However I think your bug is a timer related thing. My processKEyEvent sets the key to be false whenever the key is released. Though even a quick press sometimes generates more than one such method call. So I placed an extra check in the UP button so that you can only jump after 850ms have passes since the last jump. I removed that just now and saw that if the holes are generated above each other then the players goes through them all. The hole generation part uses Math.random() and not a seeded Random. Should that make a difference to the X placement of the holes? They usually appear in some sort of pattern with the Math one.

Also, I didn't use FPS checking so if the computer gets slowed for some reason the whole game gets messed up.

Did you get that bug the whole time?

I've uploaded the source at if you'd like to determine how much of a masochist you are. Smiley My editor uses 2 spaces per tab so the layout might look strange.

In space no-one can hear you System.out.println()
Pages: [1]
  ignore  |  Print  

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

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

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

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

nelsongames (154 views)
2018-04-24 18:15:36

nelsongames (154 views)
2018-04-24 18:14:32

ivj94 (895 views)
2018-03-24 14:47:39

ivj94 (156 views)
2018-03-24 14:46:31

ivj94 (808 views)
2018-03-24 14:43:53

Solater (172 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!