Tuesday, January 18, 2011

Scriptable events and variables

SpriteActor will be the foundation of 2D platformer style games.  Along with  the Level Editor, it will be used to construct a game from a configuration object and your game's framework.  To accommodate this, I've started adding scriptable events and variables.  Using the Level Editor, you'll be able to put a SpriteActor into your game level and then script things on "onInit" and "onCollide" which will allow you to tweak your game logic from the Level Editor.



These events will be compiled into functions which are called in the SpriteActor's scope.  Thus, you'll be able to script (outside of your actual game's code) how the actor behaves.  When something like the "onCollide" event is triggered, if you've assigned an event handler it will be passed the CollisionData object so your scripted event handler can decide what to do.  Instead of building all the logic into your game, you'll be able to test it out in the Level Editor.  You can leave it as part of the game level's configuration, or you can extract the event code and embed it right into your game.

This should make prototyping and testing your games go quicker since you'll be able to script your actors on the fly.  From the events, you'll have access to the entire game and all of The Render Engine's API as well.  I'll be wiring up an editor panel soon so I can begin testing this feature.  I hope to have a "testing loop" in place soon where I can script the level and then play, test, fix, and replay a level right from the Level Editor.

Thoughts?

No comments:

Post a Comment