Pico-8 debut  

  Haxe  Pico-8   Apr 23, 2016  No Comments

Quick post to help you start with pico-8 and haxe.

What is Pico-8 ?

If you never heard of it:

PICO-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. When you turn it on, the machine greets you with a shell for typing in Lua commands and provides simple built-in tools for creating your own cartridges.

For more info, please check the official website.

How to use haxe for pico-8 ?

The easiest way to use haxe, is to use YellowAfterlife’s library in order to build lua code. Here is the Github repository.

I’ve created an empty project (as a gist) which you can find below :

Coloring - post mortem  

  Haxe   Mar 29, 2015  No Comments

It took me a while but I finally did it.

I released a new version of my LD31 entry, coloring.

I had to rewrite it completely, because I used my HTML5 framework (AGE) and I wanted to deploy it on mobile. So thanks to haxe and OpenFl I did it without trashing all my old code.

So what’s new ?

  • Animations
  • Better score handling with combos
  • A preview of the colors order and which one can pop
  • A tutorial, to help the beginners understand the game mechanism
  • Google play integration for the Android version (leaderboard and trophies)
  • Lots of bug fixes :)

For the first time, I did integrate unit tests in order to test all (or at least the most) game possibilities. For that I used munit which is really great.

For the leaderboard integration, I’ve used linden-google-play library which is a native extension for OpenFl.

So here you can play the old version, and the new one on itch.io or directly on Google Play:

Get it on Google Play

Enjoy, and let me know what you think.

Coloring - tutorial preview  

  Haxe  Ludum Dare  wip   Feb 19, 2015  No Comments

I have integrated a tutorial which is playable as a little party of Coloring.

##How is it working?

Each turn you play, you have to complete a small challenge, receiving explanations on how to:

  • place a card on the board
  • merge cards
  • understand the UI
  • unblock a color
  • reach a score

What does it look like?

Now I’ve this system working, I’m thinking: why not add achievements or in game challenges ? Stay tuned :)

Coloring - post LD update  

  Haxe  Ludum Dare  wip   Feb 8, 2015  No Comments

It took me a while, but here is the new version of my last LD entry.

So what’s new so far:

  • Complete rewrite: I use openfl to be able to deploy it to mobile (only tested on Android so far)
  • Animations
  • New score system with combos (based on the Fibonacci sequence)
  • Better merge system
  • User Interface (based on Kenney’s assets)

For a better understanding, here are some screenshots :

Stay tuned for the more information :)

How to change colors with a smoothly effect  

  Haxe  tutorial   Dec 13, 2014  No Comments

For the last Ludum Dare, I wanted to have a nice effect on the background of my puzzle game in order to change the color based on the action on the board.

My game is in JavaScript, but except the background property, it should work on other platform too.

So, what do we need ?

First we have to get the initial color (color1) and the new one (color2). In order to change the color smoothly, we will do it with a Timer object.

// définition de la classe	
function changeColor(pElem: js.html.Element, pInitialColor: RGB, pEndColor: RGB){}

Here is the RGB typedef:

typedef RGB = {
	var r : Int;
	var g : Int;
	var b : Int;

The first step is the calculate the distance between those two colors (all methods are based on the RGB type):

var distance = {
	r: Math.round(Math.abs(color1.r - color2.r)),
	g: Math.round(Math.abs(color1.g - color2.g)),
	b: Math.round(Math.abs(color1.b - color2.b))

Now that we have the difference, we have to calculate the value that will determine how the color will change between each step:

var incR = Std.int( Math.abs( Math.floor(distance.r / INCREMENT_VALUE) ) );
var incG = Std.int( Math.abs( Math.floor(distance.g / INCREMENT_VALUE) ) );
var incB = Std.int( Math.abs( Math.floor(distance.b / INCREMENT_VALUE) ) );

var increment = {
	r: incR == 0 ? 1 : incR,
	g: incG == 0 ? 1 : incG,
	b: incB == 0 ? 1 : incB

The INCREMENT_VALUE value allows use to determine how we want the effect to change. The higher the value is, the quicker the effect will be.

I've set it to 100.

Now we have to calculate the new color :

if (color1.r > color2.r) 
	color1.r -= increment.r;
	if (color1.r <= color2.r) // if we've reach the right color
		increment.r = 0;		
	color1.r += increment.r;
	if (color1.r >= color2.r) // if we've reach the right color
		increment.r = 0;

And same thing for each tone.

I'll now add this step to the Timer object.

I'm using the Timer class in order to have a cross platform method. But you can use any kind of listener or Signal.

var timer = new haxe.Timer(Math.round(1000 / (INCREMENT_VALUE/2)))
timer.run = function()
	// [...] 

In this loop, you'll have to change the property of your object.

For example in JavaScript you'll have :

pElem.style.background = rgb2hex(currentColor);

Where rgb2hex transform the RGB object in hexa :

private static function rgb2hex(color: RGB): String
	return "#" + StringTools.hex(color.r, 2) + StringTools.hex(color.g, 2) + StringTools.hex(color.b, 2);

Here is an example :

See older posts