christoph2005/RiverRun — pull request #15 by christoph2005 (2013-06-26 05:53:34+00:00)
Title: Chris: Character movement (touch & accelerometer) has been generalized!!!

This was tough and took many hours but there is no longer a need to define the movement listeners in every level. It's all encapsulated in the following commands!

require("Scripts.characters")
player=beaverChar()

Thats it!
But you still have to add (AND REMOVE!) the Runtime Events, as usual; Here's an example just in case.

Runtime:addEventListener("touch", player)
Runtime:addEventListener("accelerometer", player)
Runtime:removeEventListener("touch", player)
Runtime:removeEventListener("accelerometer", player)

And even cooler...
player=beaverChar() could (EASILY!!!!) become
player=backOpsTurboChar() // The name is an example
The point is it is easier than ever to generate a new character.
We just have to define what it looks like, and it's shape
and just a few other tiny details like xScale and yScale and density, etc.

Oh, and P.S. It's allready implemented in all levels

More code saved and easier to read!