my first java game ("rpg" kind of ..)

hi there, i’m new to java,
i’ve made my first game…it’s based on Kevin Glass cokeandcode tutorials.
it’s far from finished, but i wanted to share what i got so far.
the java web start version is here
and the “tutorial” and sources are here
sources need to be yet commented…
i did what i could considering my poor skills :wink: code maybe really weird at certain times …

there are few thing i would like to implement now, like:

  • pathfinding… the monter right now just move randomly… i would like em to chase the player as soon as he comes near monsters…
  • bigger level with scrolling (game area larger than displayed)
  • more stuffs likes doors and keys (you would need to find first proper key to unlock some doors)
    that kind of things …

i think this little project might be useful for other newbies like me who like to learn by examples…
any comment and help welcome :slight_smile:

(updated: webstart link with newer version)

Nice work. Congratulations on getting it Web-Started.

I notice that the character movement is a little jerky, but its a great demo.

Keith

thanks for the kind words…
about the jerky player movement,
at first i tryed to simplifiate Kevin Glass tutorials,
so i removed things that looked tricky to me, so i removed the timer and the use of floats for movements.
the use of float were so you could walk across cells…by using ints instead all you do is jumping from one cell to the other.
now that i understand things a bit better i might try to enable floats for movements again.

i’m also unsatisfied with my animations,
i wanted to use animated gifs, but couldn’t find any "simple and good tutorial. so i went by storing single static pics in an array and simulate the animation myself.

i would appreciate any help about how to access animated gif frames so i can put then in an array. that would prevent to have lots of separate pics…
… so far i have 2pics for each directions. (up1.gif, up2.gif / down1.gif,down2.gif…and so on…same for the other entities) it would really simplify to be able to put everything together like: 1pic for hero.gif, and 1another pic for monster…that would be all, or am wrong trying to do this?

but well…at least it’s working… so i’m now looking at scrolling functionalities :slight_smile:
some one would care to review quickly the code, telling me if there’s no really stupid things done in there ? :slight_smile:
or help me with animation?

thanks

this is cool, my first RPGish game was a find-the-chest game :slight_smile:

keep it up!

For starters, wrong forum.
Overall nice game set-up. I especially love the sound effect when you die. ;D

Now all you have to do is include weapons and a levelling system. :slight_smile:

Cool start.

doors and keys? This you can do with knowlage you have now. As you have an enemy you can add keys as well, it’s even much simpler (like you probably won’t have to create a class just for a key since it’s so simple). As you do collisions with walls, enemys and stuff you do the same for a key. You can load image of a key and when drawing occurs you draw it’s image if it hasn’t been picked up. So I think you’ll need 3 variables for a key: Point2D key_location, BufferedImage key_image, boolean key_is_acquired.
Similar for doors and other items. If you have more then one you’ll need to put it into arrays.
Another thing so I don’t get trashed again… it’s more OOP to create own class, but I personaly think it’s unneccessary to create classes just to put 2-3 variables in it, I maybe wrong, follow tutorial.

About pics you are using for each animated movement, you can put all pictures into one big picture (sprite sheet). When you load sheet then you can create pictures by subimaging from that sheet (creating picture that is a smaller part of bigger picture).

Keep up learning :wink:

Great stuff! And doubley thanks for making examples like this available to everyone.

Kev

wow man, very good first game, i really want to see your newest version :slight_smile:

There is a problem in your jnlp file, I can’t launch it :

<j2se version="1.5"/>

put :

<j2se version="1.5+"/>

Hey nice game. I noticed that when I try to run in the opposite direction he has a delay before he starts to move. The problem might be that you have these calculations inside the Key Listener class so moving them out of there should make it smoother.

I also have a game like this but I don’t know how to turn it into a JNLP executable like you did. Can anyone show me a tutorial that shows me how ?

Thanks.

Funky music you got there hehe.

I get a crash when leaving the top door.

[quote]java.lang.ArrayIndexOutOfBoundsException: -1
at Map.block(Map.java:141)
at Entity.validLocation(Entity.java:41)
at Entity.move(Entity.java:28)
at Game.logicHero(Game.java:178)
at Game.gameLoop(Game.java:146)
at Game.main(Game.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[/quote]
Hope you still working on the game :slight_smile:

Yes, please fix it, I would like to try your game, I use Sun’s JDK 1.6 update 7.

This post is from 2006…Just thought I would let you guys know if you didnt notice… :persecutioncomplex:

omg LMAO

A good start!

Have you gotten better in the past 2 years? :stuck_out_tongue:

hehe I doubt he is even goinng to ever read all of the replies lol. besides the website wiht the code is not there anymore :confused: and webstart is 1.5 so…