HaxeFlixel Study – FlxTeroids, Part 5: Code Study (cont’d)

Asteroid.hx

There isn’t as many interesting code to point out by now since we’ve covered most of them in the previous two posts. However, let’s take a look at something:

Note that FlxObject has variables such as elasticity that helps with the in-built physics. Do check the API for more info on what other variables or functions that you can use. 😀

Also note that while the asteroids bounce off each other quite convincingly, their rotation is not part of the physics. As such, there’s the piece of code above that handles the rotation whenever an asteroid collides with something.

This wraps up the FlxTeroids demo project study tutorial. I apologise if the contents of this series are not satisfactory — In upcoming tutorials I’ll cover parts of HaxeFlixel that isn’t already available elsewhere.

Leave a Reply

Your email address will not be published. Required fields are marked *