So, what has happened lately? A lot!
We have expanded the editing capabilities further, you can now make objects that can be pushed around amongst other things.
I have been busy refactoring the whole thing into something manageable. I have also wrapped the whole thing in Flex, so we can create the editor GUI more easily.
The new structure for the game:
- MXML Container
Very simple for now, soon to be filled with editor controls
- Level (Will be put inside a game wrapper later)
Currently contains input detection and delegation.
Represents a parallax layer, contains a set of params that affect how it relates to the camera, movement, offset etc.
you can add layers until the cpu/gpu chokes. To make the layers repeating i have a function called CreateShadowCopy() that renders the object into a BitmapData object and positions it to the right of the layer.
You can also have one or more PhysicsLayers, which is a subclass of Layer that has a box2d physics solver. This is used for the actual game.
The GameObjects are anything put on layers. Can be PhysicsGameObjects for collision, decoration for the parallax layers or berries for consumption.
The player is a subclassed GameObject that handles moving and jumping.
Not ported yet.
The camera is pointed to a GameObject. When the target (usually the player) gets close to the screen edge, the camera
moves smoothly towards the target, keeping it in frame all the time. Feels a lot better than the always centered approach.
- Ugly Resource Manager Class
Just a container for the [Embed]-tags. Got to figure out something smarter here.
- Functions to Load and Save Levels
To be ported from the old project. Xml based. Recursive. Each Layer asks each game object to generate an xml
representation which is then passed down and combined.
The old structure was like, Put everthing in Level. Really hard to maintain and to add features.
Most my work has been superficial since the actual algorithms are already written. But it makes a big difference when it comes to expandability.
Should probably have waited with doing this until the prototype was done.
I expect to be done with the refactoring and some prototyping towards the end of the weekend.
Eager to try to implement some of the puzzles I have drawn on my whiteboard :)