Here's a Cellscript that will compile most Sphere 1.x games and allow use of ES6 syntax. Save the code below as
Cellscript.mjs in the root of the game directory and enter
cell from the command line. That's it!
/**
* Cellscript for Sphere v1 Migration
* (c) 2017 Fat Cerberus
*
* save this as `Cellscript.mjs` in the root of your Sphere project, and you're
* ready to start taking advantage of everything the Sphere v2 toolchain has to
* offer!
*
**/
import { transpile } from 'cell-runtime';
// any metadata defined here is written to game.json and is available to game
// code through `Sphere.Game`.
Object.assign(Sphere.Game,
{
name: "Game Title",
version: 1, // Sphere v1 compatibility
author: "Some Guy",
summary: "This game probably sucks.",
resolution: '320x240',
main: 'scripts/main.js',
});
// Duktape doesn't support ES2015 syntax yet so we need to transpile if we want
// access to those features.
transpile('@/scripts', files('scripts/*.js', true));
// this should cover everything needed to run the majority of Sphere v1 games.
install('@/animations', files('animations/*.mng', true));
install('@/fonts', files('fonts/*.rfn', true));
install('@/images', files('images/*.bmp', true));
install('@/images', files('images/*.jpg', true));
install('@/images', files('images/*.png', true));
install('@/maps', files('maps/*.rmp', true));
install('@/maps', files('maps/*.rts', true));
install('@/sounds', files('sounds/*.wav', true));
install('@/sounds', files('sounds/*.ogg', true));
install('@/sounds', files('sounds/*.mp3', true));
install('@/sounds', files('sounds/*.flac', true));
install('@/sounds', files('sounds/*.it', true));
install('@/sounds', files('sounds/*.xm', true));
install('@/sounds', files('sounds/*.s3m', true));
install('@/spritesets', files('spritesets/*.rss', true));
install('@/windowstyles', files('windowstyles/*.rws', true));
install('@/', files('icon.png'));