In this post we covered how to make explosion effects in the HTML5 canvas. But that was just the graphics part. In a game you might want to create an explosion that interacts with the environment and the entities in the game. Continue reading Explosions in Box2D
Explosions are an integral part of games. Not that all games need explosions, but they play an important role in the game dynamics. Everyone has their own idea of what explosions should look like, but if you need something to get you on your way then look no further. In this post you will learn the foundations of creating explosions directly in HTML5. Continue reading Explosion FX in HTML5
An earlier post covered the basics of using the buoyancy controller in Box2D. In that example there was one buoyancy controller and all bodies were added to it by default. But you may want control when a body is added to a buoyancy controller, for example if your player is jumping into or out of a body of water. You may even have different water obstacle at different vertical positions in your game. This post shows you how to manage multiple buoyancy controllers and how to determine when to add or remove bodies to them. Continue reading Buoyancy in Box2D – Multiple Pools
Who doesn’t like playing with water? There’s something childishly enjoyable about watching objects bobbing around on the surface or horror of something quickly sinking in to the the dark abyss. Box2D makes simulating buoyancy simple with help of the b2BuoyancyController. But keep in mind, this Box2D only simulates buoyancy not all the a liquid, so don’t expect it to make waves. That is some magic you will need to work out yourself. Continue reading Buoyancy in Box2D – The Basics
When you create a game or app that requires input from the user via the mouse then knowing the coordinates of the mouse is pretty damn important. And when trying to find the relative coordinates of the mouse on the canvas on a page where there are several elements with their own alignments and borders and margins it can seem like a pain. Continue reading Where’s my mouse at?
For every problem there is – usually – more than one solution. There are solutions that solve one particular problem and there are general solutions that can be applied more generally. And you will probably choose the one that suits your current needs. The purpose of this site is not to tell you which solution is right or wrong. Isn’t that what requirement specifications are for?
What you will find here are solutions to:
- Problems for which I have not found good or complete solutions.
- Problems for which I have found a solution, but the solution was provided in a different programming language and needed to be ported to the one I was using.
- Needle in haystack solutions. Gems (e.g. code snippets) hidden in the rough that are good to bring into the light.
Hopefully you will find something that will help you or inspire you tackle new problems. Feel free to use, modify or extend code you find here.
When things don’t work