Phaser Coding Tips 1&2 Revisited: Pixel based Physics

Of all my posts here, my post here generated the most response - I guess I am not the only one interested in this esoteric field of manipulating the canvas at pixel level…
image

I have been playing around with the canvas texture class some more and have come up with this simple demo of balls bouncing on destructible (i.e. non-flat, non-axis aligned) terrain. To get the ball bouncing off angled terrains, I have adopted a very simple algorithm to calculate the surface/collision normal, which is described in my blog here.

The example code can be accessed below. Click mouse to generate new bombs.
Phaser Coding Tips 1-2 Revisited: Pixel Based Physics (codepen.io)

As an aside, I have also created this little Lemmings like demo - in terms of the logic, this not much different from my Donkey Kong demo, but I would be grateful for any feedback or comment if anyone is interested in this sort of stuff (and add more features, as I ran out of energy).

Phaser Coding Tips 1-2: Lemmings (codepen.io)

2 Likes

The bombs demo is lovely :slight_smile:

1 Like

I added digging (click) and exploding (shift-click).

Wow! Thank you adding the feature! It’s almost hypnotic watching those lemmings dig!