Rabbit Adventures is now on github:
https://github.com/Hudell/rabbit-adventuresI tried to keep everything in english, but if I missed anything, just let me know.
And there's also this:
https://github.com/Hudell/euphoriaEuphoria is like a framework I created while developing this simple game.
It's basically a bunch of classes to keep the game better organized.
It works by separating the game in "flows" ( In retrospect, this might not have been the best name to give to it).
Each flow class is responsible for managing one part of the game. In rabbit adventures,
there's 3: Launch, MapEngine and GameOver.
Then, in the main script file of the game, all you need to do is this:
RequireScript("euphoria/loader.js");
RequireScript("content/flow/Launch.js");
function game()
{
mainGame.startGame(new LaunchFlow());
}
the "Launch" flow draws the start menu and background. When the user selects the "Start" option, it moves to a new flow class:
RequireScript("content/flow/Map.js");
mainGame.moveToNewFlow(new MapFlow());
and this one is responsible for everything that happens while the MapEngine is running.
All game files are organized in five folders:
The AI folder holds different Artificial Intelligence classes, used for the enemies and objects. The "Swirl" AI is used to keep objects changing direction. I use it to animate crystals and hearts.
I won't be talking about items for now because I didn't really use it on rabbit adventures and it may not be working anymore. I had just started an inventory and item class before starting the sample game.
Maps are classes responsible for handling the different maps on the game. You create one different class for each map and use it to configure the objects and events of the map.
RequireScript("euphoria/classes/Map.js");
function Map2Class() {
var me = this;
me.superClass = MapClass;
me.superClass("map2.rmp");
me.twoDimensional = true;
me.doInitialize = function()
{
me.createObject("crystal2", "Crystal").flagName = 'stage2';
me.createBatchOfObjects("redball", "Ball", 90);
me.createBatchOfObjects("heart", "Heart", 2);
me.createObject("carrot2", "Carrot");
};
me.doFirstFrame = function()
{
var playerObject = mainGame.globalDb.getObject("playerObject");
mainGame.player.setPerson(playerObject);
};
}
mainGame.globalDb.registerMapClass("Map2", Map2Class);
Objects are responsible for controlling the sphere entities.
RequireScript("euphoria/classes/Person.js");
function GrootClass(name) {
var me = this;
me.superClass = PersonClass;
me.superClass(name);
me.onTalk = function()
{
me.speak("I AM GROOT", null, me);
};
}
mainGame.globalDb.registerObjectClass("Groot", GrootClass);
RequireScript("euphoria/classes/MovableObject.js");
function HeartClass(name) {
var me = this;
me.superClass = MovableObjectClass;
me.superClass(name);
me.obeyGravityLaws = false;
me.setAi("Swirl");
me.onTouch = function(){
mainGame.player.addLives(1);
me.destroyEntity();
};
}
mainGame.globalDb.registerObjectClass("Heart", HeartClass);
The Object class has some events to be inherited:
onTalk = sphere's onTalk script
onTouch = fired by Euphoria when it detects the player touched the object
onUntouch = fired when the player is no longer touching the object
And there's more. I'll write more about it some other time.