Game Jam Haunted: Hacking Something Together
07/12/15
All right, so I want to mutate the IGE keyboard control physics example into something with:
- Gravity
- Jumping
- Platforms
- Automatic left/right movement
The game will live here.
Deleting the Unnecessary
I do not need any server stuff, as I won't be running a node server for this game. It'll be completely client-sided.
Initing the gamejam_haunted Repo
Okay, so we'll start off as a straight-up copy of this example, and hopefully mutate it beyond recognition.
Let the Mutations Begin!
Gravity
Gravity is easy, I think. Right there in client.js is:
// Add physics and setup physics world
ige.addComponent(IgeBox2dComponent)
.box2d.sleep(true)
.box2d.gravity(0, 0)
.box2d.createWorld()
.box2d.start();
Let's see what changing those inputs to gravity does.
That's strange, it does nothing....
I suppose that might not be the right thing to adfix gravity to.
Ah, it's because the game automatically sets the characters linear velocity to some value, which ignores gravity.
So, I need to fix this:
default:
this._box2dBody.SetLinearVelocity(new IgePoint(0, 0, 0));
this.animation.stop();
break;
I'll just comment out the SetLinearVelocity command for now.
And it works! Sorta. It's stable and does some interesting stuff that hints at how certain things work (note to self: get good gif maker for chromebook).
A good incredibly tiny commit.
Jumping
Now it's time to look for more examples.
I can't find any.
And I'm super tired....
Screw it, switching to Crafty