GD2D: dev log #10

A brief summary of last two weeks progress:

  • Debug panel to configure weapon;
  • Show weapon in the HUD and ability to select weapon;
  • Weapon selector screen;
  • Many under-the-hood improvements.

Debug panel to configure weapon

As I said in one of previous posts, luxe has built-in debug console. It turned out, that you can add your own debug panels, so I decide to add weapon configurator to the debug console in the game, instead of making separate application. You can see the result on the screenshot above.

Show weapon in the HUD and ability to select weapon

An easy task (you can see current weapon in the top-left corner). Also you can switch weapon by pressing 1, 2, 30 keys.

Weapon selector screen

While selecting weapon using keyboard is good solution on the desktop, it is not suitable for mobile devices.

This screen is done using additional scene (like in luxe/tests/features/scene) instead of adding everything to the main scene.

Many under-the-hood improvements

A bit of kotlin

class Tools {
    public static function also<T>(object : T, block : T -> Void) : T {
        return object;

So now you can do something like that:

using Tools;


new Visual({
    color : new Color().rgb(0x000000).also(function (v) { v.a = 0.9; }),

If there were arrow functions in Haxe the code will look nices, but still pretty nice for me.

Ability to pause the world

When weapon selector opened, the game should be paused. But it is not so straightforward, because everything is updated in components on the global ph_fixed_update physics engine event.

I add my own event emitter in simulation class, which doesn’t emit events when simulation is paused. I still have problems with Actuate (because it doesn’t depends on physics), and there is no straightforward way to pause all tweens related to game, but leave other tweens. I’ll think about this later.

Collision layers

It happend that I need collision layers (like in Unity), because projectiles should not collide with windows, but player and enemies should, so I add them to the simulation class (but I named them “collision map” instead of layers).

See you later!

Leave a Reply

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