• entries
    743
  • comments
    1924
  • views
    580415

Update

Sign in to follow this  

85 views

Haven't updated my journal for quite a long time for me - life is busy but not a lot of game dev to report and I don't really like to just post non-gd drivel in here.

Finally got round to getting some programming done tonight and implemented jumping for Squishy. This has been on the back burner for a while since it is a bit tricky.

Now, if you have neither arm locked and you press up, if you are standing on a solid object Squishy hops in the air. It feels nice and makes him a bit more manoeuvrable.

The tricky part was detecting whether or not Squishy was standing on top of a solid object. I set up a temporary system where I could change Squishy's colour (might be useful anyway) so I could ensure this detection was working properly before I worked on the actual jumping.

As Squishy is made up of lots of Box2D bodies (the ongoing joy of soft body physics), and as I have Box2D communicate contacts with entities by deriving them from PhysicsBodyOwner and assigning them to the user data pointer of the body, it was necessary to create an EdgeProxy class that could be instantiated once for each edge body (the knobbly circles round his edge).

Edge PhysicsBodyOwner is notified when a contact is created and destroyed, so each EdgeProxy keeps track of all the current contacts along with their normals.

In Squishy's update method, he can now query all the edge bodies and see if any have a contact whose normal has a Y value of >0.2f.

By using the colour system, I could confirm that this was working under the correct circumstances. From there, implementing jumping was just a case of adding an impulse to the central body if the CanJump flag was set.

Nice to have got this working. I was worried this was going to prove more difficult that it turned out.


Sign in to follow this  


2 Comments


Recommended Comments

Nice :) What else do you have in store for Squishy?

BTW you should rename tab2space to... tab4space :) Makes sense actually.

Share this comment


Link to comment
Quote:
Original post by Jotaf
BTW you should rename tab2space to... tab4space :) Makes sense actually.


True. [smile]

Quote:
Original post by Jotaf
Nice :) What else do you have in store for Squishy?


Don't really know. Hopefully I'm back into it now.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now