WormGame

Uploaded a new version. This one has the game over animation idea I got from blah^3 and 3 new control schemes. Press spacebar to cycle through them.

mode 0: Same as the original only you need to press down to go back down (no gravity).

mode1: Same as mode 0 except your acceleration and velocity is set back to zero when you switch directions.

mode2: like mode1 only it has gravity similar to the original mode (you dont ever have to press down).

mode3: original mode.

I think I like mode 2 or 3 best.

0: sensitivity needs changing. Should change quicker at first, and not speed up so quickly if you hold down key (just too hard at the moment!)

1: boring :frowning:

3: feels most like being a worm :). But…needs sensitivity increasing a little so that you can turn faster/sharper

2: my favourite. Except it might be nicer if the trail were re-shaped to look more precisely like a series of arches, or bounces - at the moment, the “bounce point” at the bottom is not sharp when you do big bounces but an inverse of the shape you expect to see. Also, iof you hold down “up” then there’s a bug you’ll soon see (at least, it looks like a bug :)).

  1. …you don’t have this :slight_smile: but i think you should also try a 0 which compensates for the removed gravity so that holding down up behaves EXACTLY as in 3. and holding down down is vice versa.

New version uploaded.

mode 0, I don’t like it and I think it may have gotten worse while improving the others.

mode 1 is gone, it was crap.

Mode 2, I fixed the bug you said which in turn fixed the problem with the arc shape and it works pretty nicely now.

Mode 3, accelerates faster when first changing direction so you can get around them corners!

Mode 4, I couldn’t get it to work well the way you suggested, but I did add another mode just for fun. Control is pretty boring with this one too so I’m thinking its garbage.

Still looking for some kind of input about my DisplayManager class to see if its messing up fullscreen for people. Now that I think of it though, maybe I should post it somewhere else…

Sorry, i actually meant to upload the webstart log last time…but forgot.

Here it is:

Regards,

Ribot.

Due to my relative newbness I’m not sure what to do about that. I know whats causing it, and yet I don’t know what to do… There some way I can handle this event so it doesnt crash the program?

Edit: should have said the file it is writing/reading to is System.getProperty(“user.home”) + “/Cyntaks/WormGame/score.dat”

Could you maybe add some debug outputs (like the file path) to your program so I can tell you exactly what paths are being set and any other info.

Cheers,

ribot.

@weston:
please use the Java Preferences API (java.util.prefs) for storing the game’s configuration. Creating files in my homedir is very annoying.

the jnlp falls over with 1.5beta…errr… 2 i think.

I wouldn’t worry about it though, lots of (but not all) jnlps fail with 1.5 =/
Seems Sun have broken something.

I’m actualy very glad you said that Bohemian, I dont like doing it that way but I couldn’t find a way to use relative directories with jar and with webstart… my friend is always telling me to just put stuff in the home directory and I finally did this time, but I’ve been trying to tell him that its not a good way to do it.

jnlp failure of 1.5 is normaly, just try to load it again and it’ll succeed… unless it chokes in the middle of a jar, then it gets pretty persistant (clearing out the cache seems to fix it sometimes).

I ran the game, and it gave 56 fps on my computer (PIII 700 with all in wonder radeon 7500). In fullscreen mode as soon as I hit a direction I’m immediately into a wall. I’m a pretty hard core gamer so I’m pretty sure it’s not supposed to be as fast as it is. The background appears to be moving at a reasonable speed (challenging I’m sure but it’s game over as soon as I alter direction).

Yeah, sorry about that, was trying to work out a new control scheme and the default one is pretty crazy, you can cycle through them by pressing spacebar.
Made a big mistake while I was working on the new control schemes, I didnt back up the original… So I pressed undo alot to get to it and I noticed a mistake and changed it, which made me unable to do redo to get back to all the control schemes I added. So the only place they exist is in the jar on my webstart. Thats why I have been hesitant to restore the game to a more playable version. I guess I will just backup that jar and upload a playable one. does that

[quote]Due to my relative newbness I’m not sure what to do about that. I know whats causing it, and yet I don’t know what to do… There some way I can handle this event so it doesnt crash the program?

Edit: should have said the file it is writing/reading to is System.getProperty(“user.home”) + “/Cyntaks/WormGame/score.dat”
[/quote]
Yet another reason not to go around arbitrarily writing files to the hard disk ? :).

As for the Exception, just wrap the offending line(s) of code in a try…catch block - that’s precisley what they were invented for!

Also, your Exception looks (just a guess) like it’s probably a subclass of IOException, in which case you can just catch IOException (because "catch X"catches X and all subclasses of X) which would also save you from any other IO problems that occurred.

Yeah, I need to find a better place to store the files, so what was this about java.util.prefs, what should I look for in there that can help me?

Blah^3, I am catching the exception, thats sorta why I was confused that it crashed his program. I was just catching Exception, but I changed it to EOFException after I got ribots post to see if that would help (don’t know if it did).

Also, congradulations to Abies (I assume they are on this forum cause I don’t know who else would have my game…) you beat my high score :-[.

weston: I will check again when I get home tonight.

[quote]Yeah, I need to find a better place to store the files, so what was this about java.util.prefs, what should I look for in there that can help me?
[/quote]
It’s very simple, just read the API docs. Do a google search for “sun tutorial prefs java” if you need help.

Perhaps it’s not an Exception, despite the name? You could try catching Throwable…(although don’t quote me on that :wink: I have vague memories that things you can’t catch with Exception you simply can’t catch at all without using the ThreadGroup default Throwable handler, which isn’t going to help you here in this program)

It saves the scores online? Well, if I’d known that I’d have tried harder… :wink:

What are the top 5 high scores? Any way of looking at them from within the game?

I’m still getting the same error, but with the additional debug line.

edit: remove those smileys from the code

Just a general question, but do people generally prefer programs to use the prefs API or files in USER_HOME? I’ve always used USER_HOME since prefs on windows will write into the registry, and for regular java games I find that just rude behaviour.

IMHO its much easier to delete a folder in USER_HOME than go hunting though the registry for random values. :o

Am I wrong in thinking that using a relative directory would be the best way to go here? I can’t seem to find any information on how to find a directory relative to a jar file though, surely this isn’t a shortcoming of java (right?), am I just not seeing something?

Btw, I did say in my first post:

-Online high scores for the competitive types

Yes, you can view the high scores from within the game, just go to high scores from the main menu.
Current top five:

  1. Abies 18526
  2. Weston 18485
  3. Breadstick 18026
  4. westpn 17346
  5. weston 17196

I’ll add a temporary fix so you (and maybe anyone else who is having the problem) can try the game.

I would say: Don’t miss too much work trying to get the high score ;D, but chances are it still won’t work considering the dissapointing success rate so far…

Edit: typos

Ok, uploaded a new version. I was going to add a prompt asking if you wanted to track your personal high score as a temporary fix, but I think I might have found the problem. Turns out I was opening that file from within another Thread I created to load images and stuff, doh! why didn’t I see that before… Because of this it was already in another try-catch that I was using for some other file IO :-[, but its been moved and I have a feeling this will fix it.