Showing posts with label gravity shifts. Show all posts
Showing posts with label gravity shifts. Show all posts

Thursday, July 30, 2009

Lazy camera


Arrow keys for movement, spacebar to jump. Use arrow keys while swinging to increase his spin. Hold down spacebar to make the jump last longer. Hit spacebar again when holding on to a wall to wall jump. Click on the game to start interacting with it


Just a quick post

I was thinking that the gravity shifts maybe don't have enough of an impact, and that they would be cooler if the camera doesn't correct itself so quickly. Here's the same game as last time but with a slower camera. What do you think? Should I keep it like that?

Personally, I think it's awesome.

straddling is fun


Arrow keys for movement, spacebar to jump. Use arrow keys while swinging to increase his spin. Hold down spacebar to make the jump last longer. Hit spacebar again when holding on to a wall to wall jump. Click on the game to start interacting with it


Yeah, so gravity shifts are obviously out of this world and wonderful and I can be incredibly proud of myself. That said, in the previous post, one crappy bit was the nonsense that would happen around gravity rifts - I went a little crazy with crossing over collision lines and other such nonsense to keep Dreg from losing his cool and shifting into an alternative reality.

As I mentioned in the previous post, I wanted to create special collision lines that straddle multiple gravity fields, including floors which Dreg could run along without the collision detection giving up and stomping off in a huff as soon as he hit a gravity rift. This meant making funky collision lines that would return different values depending on which gravity zone Dreg was in. I also had to integrate it all into the chaos that is my "level-editor".

Hopefully the rather non-fun demo at the top of this post should demonstrate that it works!

The exercise also allowed me to do lots of tweaking on the collision detection itself, and Dreg is now even less likely to casually walk through walls, though I wouldn't like to claim it's impossible. I've tried to minimise the need to limit the actual level design possiblities, but there are a couple of things I have to keep in mind- if I try to make a floor behave as a wall it gets upset with me.

That aside, I now feel I have a system which is flexible enough for me to make the kind of levels I want to make, so look out for the next post - it's going to be fantastic.

I'm sure you, my avid fans, were a bit upset about how long it took me to get this update up and running. The reason? Well, this project was my topmost priority for a week, and I was seriously riding a wave of enthusiasm. The enthusiasm has dissipated a little, so now it's a case of trying to maintain a certain level of discipline and making sure that I keep on working. My having finally started playing GTA4 hasn't helped either.

Oh and I've finally caved in and made Dreg move with the arrow keys!

Friday, July 24, 2009

Yup. Now it's getting serious.


A and D for movement (ok, ok, I'll change it to arrow keys soon), spacebar to jump. Use A and D while swinging to increase his spin. Hold down spacebar to make the jump last longer. Hit spacebar again when holding on to a wall to wall jump. Click on the game to start interacting with it



The game now has gravity shifts, and it is awesome.

I've actually done quite a lot of work behind the scenes. The gravity shifts are clearly the very incarnation of amazing, but the seriously cool thing I did was a simple way to quickly create, and more importantly, tweak the collision lines (hence their rather scrappy appearance). There's still a couple of issues with dodgy collision detection as Dreg passes through a gravity rift, but I think I've found the solution, which I'll talk about here, but if you don't care about geeky nonsense, ignore the following section:

< geekfest >
Each gravity Zone is actually a separate Sprite within Flash, and all the gravity calculations are done within the sprite's local space. Passing through a gravity rift, which is just a modified collision line, will the removeDreg from his current gravity zone, then add him to the next. Some calculations are required to put him in the right position, rotation, and velocity, but it's all pretty simple stuff.

All the collision detection is done within the local space of the sprite Dreg is currently occupying. But I think certain objects, namely walls around a gravity rift, should be detected globally, regardless of which gravity zone Dreg is in. This'll be a bit more expensive, but I've got lots of nice ideas to keep it fast.
</ geekfest >

Another problem is that at the moment I can't have Dreg experience a gravity shift while running on the ground - the solution is the same as for the previous problem.

In any case, give it a go. If you start by running to the right, it's easier than if you start by going up (the latter option requires a lot of wall jumping).

On another note, it's been very interesting to see how non-gamers interact with this - I've tried to make the swinging and wall jumping a bit more instinctive, but retaining some challenge. If anyone's having trouble wall jumping, remember you have to hit the spacebar again to jump off the wall...

See if you can complete the circuit in both directions.