I moved to a new URL! Check it out!

posts tagged with: as3

Colliding with Slopes?!

Colliding with Slopes?!
In my last blog post I talked a little bit about how I've implemented slopes in my latest project, but I only talked about how I was actually importing them from Ogmo Editor into Flashpunk and not about how I'm actually using them for platforming. In this post I'll attempt to explain how I actually use slopes in my movement system, which means my platformer characters can walk up and down them without any problems.

The first thing to keep in mind is that all of my slope code only really works with slopes that increase or decrease by 1 pixel. I could rework some of it to make it work with a step of any size that the programmer could define, but for now 1 step is all I really need.

Pixel Sweepin'

The first thing to know is how I actually go about moving my platformer characters, and other moving objects around my game world. I use a method that I refer to as pixel sweeping. Basically whenever an object moves in my games, I move it one pixel at a time and check for collisions at each step! This might sound a little crazy to some folk, but this is the most reliable way I've been able to do stuff like platforming and other moving objects and still collide with even the tiniest pixel of a floor or wall. I've been using this technique since the very beginning of Bonesaw: The Game.

Game Making Tools

Game Making Tools
Since I posted the time lapse video of me making a game for Global Game Jam 2013, I got a couple of questions regarding the exact tools I'm using for my game making needs. This is a pretty long post, so I'm going to put it all behind the jump tag. If you want to know my secrets, then click read more!

GGJ Game: Screenshot Saturday

GGJ Game: Screenshot Saturday
Still poking away at this Global Game Jam game I started last weekend. If you missed the timelapse, just scroll down a little bit and you'll find it, or just click here. Here's what it's looking like at the moment:


I'm super excited about that minimap in the upper left hand corner. You have no idea how excited I am. I've been wanting to have a real time minimap in a game for so long but I've always been limited by my programming knowledge or the software that I was using to develop the games, but now I'm finally at the point where putting together that minimap on the HUD only took a few hours of work!

Another thing going on is the crazy blue splashes on the screen, which is actually just me testing my particle system. I don't seem to do particles like most people, and I prefer all my particles to be individual instances or objects in the engine... but this does mean some performance issues unless I have some sort of pooling system set up for at least the bitmapdata being used for each particle. I recently added a new parameter to my particles which is delay, so I can specify how long a particle should wait before it starts doing its thing.

I'm pretty happy with how particle and effects creation works in my latest iteration of my framework that sits on top of Flashpunk. Right now the code for creating those blue particles looks like this:

 //make dem blue rings
KParticle.spawn(level.mouseX, level.mouseY, C.EFFECT_RING, {
frames: [0, 1, 2, 3, 4],
lifeSpan: [20, 40],
delay: [30, 120],
center: true,
color: C.COLOR_BLUE,
scale: [0.5, 1],
layer: -5

Just to clarify a few things, the C.EFFECT_RING is just a reference to a string that I've used to pool the particles ahead of time, so the function here ends up looking for the next particle in the C.EFFECT_RING pool. "C" is just my big static class for all sorts of constants that I want to be able to easily remember.

As far as the yellow and red pixels in the middle of the screen -- those are some helpful markers to show me how my camera system is working. I just got some neat camera blocking stuff working (similar to Jottobots) but it's been so long since I've coded any sort of "advanced" camera stuff that I'm feeling totally rusty and it took me probably two days of thinking to get it working the way I want. I still have some other problems to solve with that, like how to get the camera to properly block around corners, but I'll get to that soon enough. A lot of the inspiration for this comes from games like Super Metroid where the game will hide areas from the player until the player crosses into them, and then the camera will adjust to reveal the new area.

That's it for now! Trying to just post more to my blogosphere in general, so I'm going to just try and post as much as possible for the next few weeks and see how it turns out.