FAQ - micojs/micojs.github.io GitHub Wiki

Why are my sprites' colors wrong?

You probably forgot to reset the pen to zero:

setPen(0);
image(R.sprite, x, y);

How do I make sprites transparent?

Use PNG transparency and make sure you have transparency enabled:

setTransparent(true);
image(R.sprite, x, y);

How do I see my game's frame rate?

render() {
    // your code here

    setPen(200);
    text(1000 / FRAMETIME | 0, 10, getHeight() - 16);
}

How do I import a project?

Create a new project, then drag-and-drop the zip into the file list.

array.push() doesn't work! Is this a bug?

No, this is not a bug. Arrays only have array.length and array.indexOf() at the moment. Methods that modify the size of the array (push, pop, slice, etc) will not be implemented since changing an array's size would be extremely expensive. When you create an array, specify the maximum size you'll need: const arr = new Array(10);

Similarly, strings only have string.length and string.charCodeAt(index).

How do I get my game onto my device?

Flashing hardware directly is not supported on the Pokitto and PicoSystem, so it must be done manually.

For the ESPboy, 32Blit and Gamebuino Meta:

  • Make sure your browser supports webserial: caniuse
  • Plug the device into your PC's USB port, preferably without using a USB hub.
  • Turn the device on
  • Select the corresponding device in the left-hand pane of the IDE
  • Click "Build" and wait for it to finish building
  • You should see a pop-up with the options "Cancel", "Flash", and "Save"
  • Click Flash
  • You should see a pop-up asking which device you want to flash.
  • Select the device you want to flash:
    • For the ESPboy, select USB2-Serial.
    • For the 32Blit, select 32Blit CDC.
    • For the Gamebuino Meta, select Arduino Zero, then select Genuino Zero.
  • Wait for flashing to complete.

Why don't I see the flash pop-up after I click build?

This feature is currently only supported on the ESPboy, Gamebuino Meta, and 32Blit. If you're trying to flash one of these devices and you still don't see the pop-up, then your browser probably does not support webserial. See caniuse.

How do I detect what is causing a slowdown or check memory use?

The following pragma enables printing some statistics, though it is not supported on all platforms:

"push header-cpp #define ENABLE_PROFILER 1";

With it you can see the heap size, FPS and the name of a function sampled by the profiler. Functions that appear often are more likely to be your performance bottleneck.