Friday, March 23, 2012

Terrain Collisions

So I already tried two posts explaining my methods while creating my game - one for why I'm writing in Java, another for how I'm doing terrain collisions, but it just didn't really hold my attention. I figure because I half feel like I'm preaching to an empty room. haha.

In that case I feel like I'll just keep my posts short and say something about what I'm making (like terrain collision systems!) and put a screenshot or two. If you're interested in learning my techniques let me know and I'll make a tutorial or something.

Without further ado!


So what you're seeing here is a basic "random level generator" (just a bunch of connected points) that gives me a whole lot of walls. Basically this means I shouldn't be able to enter the center of that mass, but I haven't really worked out all the quirks yet. I'm detecting collisions against the walls and sliding the player (that red box) along the wall when he hits it according to how his velocity was before collision.

Right now there's a bug where he can squeeze into space he shouldn't be in by pushing against corners.

Anyway, that's how my progress is so far! I also wrote a backbone engine to render everything and sort objects, but I suppose that's less obvious.

I know there's probably math or game libraries I could use to make this but part of the point of this game is to practice creating an engine. I decided on 2D because I wanted to actually complete the game without spending years on it. More updates later!

No comments:

Post a Comment