Thursday, August 28, 2014

Line of sight

Working on some kind of 2D line of sight.

It's cool that I can get the area of the enemy/player which is visible, so let's say if enemy can see only a small part of the player it doesn't have to attack right away, but come closer or something... Just like for the destructible terrain I am using Clipper for this.

Thursday, August 21, 2014

Worms like destructible terrain using Box2D and Clipper

I made a little demonstration of Worms like destructible terrain made using Box2D chain loops and polygon clipping library called Clipper.

You can download it or read how it's done here:

Friday, August 8, 2014

Event listeners - player controls

I've made a new type of event listener which triggers an action when player presses a keyboard key or mouse button. Still need to make it block/unblock player controls, so the player sprite doesn't move if it controls something else, but whatever...

As an example I made a vehicle which can go left, right and break, all via event listeners and actions that control a Box2D joint motor. It's all done in the map editor.

Tuesday, August 5, 2014

Poly2tri and Box2D

Using poly2tri to triangulate complex polygons, then using the triangles to form Box2D bodies with multiple fixtures (triangle=>fixture). Box2D only supports convex polygons, this way I can make concave ones too. This way I could simulate almost pixel perfect collision, but that is overkill in most cases.