Platformer base...

Working on a platformer, just got scrolling, jumping, and collision detection going.

You can find the Applet here…http://www.paraduck.net/misterbob/platformer/classes/

Not too much gameplay yet, but I wouldn’t mind if people would see if it worked on their systems.

Known Issues:
If you time spacebar right, it is possible to inc jump height or 2x jump.
Sometimes the character can slide into a block slightly (This I can fix pretty quick using modulus).
You can scroll the screen past the level boundary, and if you go out there you can get an array out of bounds…

Thanks in advance for your input!

Nothing earth shattering, but you’ve certainly got the basics of movement down.

I noticed that the blocks on the far-right of the screen aren’t being rendered soon enough. Just look at the far right of the screen as the applet scrolls to the right and you’ll see what I mean.

BTW, how long did it take you to do it?

Nice, but shouldn’t the little man trigger a game over or something when he falls down?

Come on guys he said it was just an early test!

You’ve got a nice start on a sidescroller here. Collision detection and jumping are VERY hard to get right especially the first time you do it. If you want to see some example code of how I did it just let me know.

Keep up the good work!

Thanks for the replies…I’ve been fixing it up a bit. Collision and jumping are working much better, and that bug where it isnt drawing all the way to the right was fixed. I haven’t uploaded the fixed one yet, as I would like to add more stuff before that.

Also, when you fall the game goes back to the start :stuck_out_tongue:

Awesome!
I noticed “Mario” has a black box around him, what kind of images are you using for sprites?
Plus I got this stacktrace when I got to the far right of the level:

java.lang.NullPointerException
at Level.testForCollisionRight(Level.java:216)
at Level.testForPlayerCollision(Level.java:130)
at Main.run(Main.java:171)
at java.lang.Thread.run(Thread.java:554)

I guess I hit the end? :slight_smile:

The jump physics seem a little funky, he jumps up in a straight line rather then an expected arc. It seems as if gravity doesn’t effect him until he gets to the apex of his jump. Still I like how well you did the relationship between how long you hold down the space and how high he jumps.

It worked very well on OS X although I noticed a simular scrolling/flickering problem that I had with HappyFunBall; it’s a Java2D implementation issue.

Very cool! Keep it up!

Yep that stack trace is caused by the end of the level. Currently mario is simply on a black background, as I haven’t made him transparent yet.

I did some uploads to the game. The jumping seems much better, and the collision is fixed up a bit. I added basic goomba AI, so they walk around, but dont do much else. I’m having a rough time testing if they were jumped on…using Rectangles, and saying if the player collides with the rectangle, and is above the goomba’s head y coord, he hit it. It doesnt always seem to work though, anyone know why?

Thanks for the comments guys. Glad to hear it works on OSX, thanks for testing it :slight_smile:

EDIT: Added sounds, and lives/score display. Some sound/music are in too. You can now die and kill the goombas. I THINK i got the collision down, tell me how it feels. Also, you can run using alt. This is still a bit glitchy.

:slight_smile:

You should really add a stopMusic() when the applet ends because now I have Mario music playing on my comp and the applet window is long gone, hmmm how to stop this annoying music… shotgun to computer monitor, no good can still hear music, going quiet insane ahh, the harddrive… peace at last!

Seriously, I’m using mozilla and jre 1.4.2 and the music won’t stop.

Huh, good job on the gfx though.

It’s come quite a way in the last fews days. Good job.

Thanks :slight_smile:

I told it to stop the music on close, sorry bout that :stuck_out_tongue:

For the Goomba collision you could test to see if Mario’s Y velocity is in the downward direction (positive y velocity), and then kill off the Goomba if that’s the case (but not Mario!). That’s what I do for the SpaceSlug in HappyFunBall.

It’s looking better and better!

Yes I think that will do the trick.

It’s getting quite nice but I think gameplay could use a speed boost. It all feels a bit slow motion-ish.

Erik

I added some more features, such as coins and improved hit detection algorithms…also at the end of level 1, you can try the start of level 2 :stuck_out_tongue: Tell me whatcha think…

Good stuff dude - I think its cool… a good first start :slight_smile:

yes good!

I’ve noticed it runs kind of slow on some machines…do you guys know of anything that would cause this? I’ve tried disabling music, but that isn’t what does it…

Source is here: http://www.paraduck.net/misterbob/src.rar if anyone is interested. I’m not that great yet, and some stuff probably isn’t done correctly or the best way…I’ll learn eventually, but right now I want to solve these performance issues

This is exactly the kind of game I’m trying to write. I’m going to check out your source and hope it helps me out. I’ve written the first level of my game and it works but I’m having some issues with mediatracker and music and such. Great work. Runs great on OS X on G5 1.8 ghz. However often calls me dead when I jump on top of goombas. Can’t wait to check out how you implemented levels. Keep up the good work.(you may be infringing on some Nintendo copyrights though)

The source on the page is pretty outdated.

The goomba thing is a known issue, i have it fixed but i have to upload it when I get a chance. The levels on the new source are just an array of strings, and the Level.class reads them in and interprets them into 2 arrays, a collision array and an array of the class “Element”.