games


.
Here are some simple games created with a small amount of Lua script in Umajin. These are built on top of the gamekit component which manages all the sprites for you. It can render quite a few million sprites at 60fps so there is plenty of opportunity to go wild graphically.

These examples are just graphical tests for my nephews – the graphics are all the ownership of the original artists. We will be releasing worked examples with public domain images for anyone to download and experiment with.

Once you assign a sprite sheet to the Gamekit component you can start adding the custom actions. (I recommend using texturepacker or a tool which makes an atlas in the LibGDX format)

These two functions are where the fun starts;

sprite_id = gamekit_sprite_create(gamekit, sprite_index, sprite_name, x, y, scale, angle, alpha)
gamekit_sprite_update(gamekit, sprite_id, sprite_index, sprite_name, x, y, scale, angle, alpha)

Now we can write a simple function which you can attach to the on_tick event of your GameKit component.

--variables
g_smoke_x = {}
g_smoke_y = {}
g_smoke_a = {}
g_smoke_s = {}

--main smoke heartbeat
register("smoke_tick","smoke tick","")
function smoke_tick()
  for i=1,10 do
    g_smoke_y[i] = g_smoke_y[i] + 10 --gravity
    g_smoke_a[i] = g_smoke_a[i] + 1 --angle
    g_smoke_s[i] = g_smoke_s[i] + 0.01 --scale
    gamekit_sprite_update(gamekit, i, -1, 'shield', g_smoke_x[i], g_smoke_y[i], g_smoke_s[i], 0, 180)
  end
end

We will have these games and many more up on the Umajin SDK community site in May!

Cheers
David