Problems with Level Architect, Citrus Engine, Flash

Posted by Idan on Game Development See other posts from Game Development or by Idan
Published on 2012-09-26T17:03:17Z Indexed on 2012/09/26 21:50 UTC
Read the original article Hit count: 391

Filed under:

I am using the Citrus Engine to make a Flash game, and the Level Architect doesn't work well for me. Firstly, when I first launch it and open my project and my level, nothing is shown, no assets and not anything I have previously done with my level. To fix it, I open another project. The other project works fine, meaning I can see the assets and the level. Then I go back to the actual project I am working on, and the problem is fixed, only it does not fix the second problem: I can't add my own assests. I follow the manual and add tags like this: [Property(value="0")]

But it doesn't change a thing in the level architect window (even after I close and reopen it). Any ideas? Thanks!

Here's the code of the class I want to be shown in the Level Architect:

package {

import com.citrusengine.objects.PhysicsObject;
import com.citrusengine.objects.platformer.Sensor;

import flash.utils.clearTimeout;
import flash.utils.setTimeout;

/**
 * @author Aymeric
 */
public class Teleporter extends Sensor {

    [Property(value="0")]
    public var endX:Number=0;
    [Property(value="0")]
    public var endY:Number=0;
    public var object:PhysicsObject;

    [Property(value="0")]
    public var time:Number = 0;

    public var needToTeleport:Boolean = false;

    protected var _teleporting:Boolean = false;

    private var _teleportTimeoutID:uint;

    public function Teleporter(name:String, params:Object = null) {
        super(name, params);
    }

    override public function destroy():void {

        clearTimeout(_teleportTimeoutID);

        super.destroy();
    }

    override public function update(timeDelta:Number):void {

        super.update(timeDelta);

        if (needToTeleport) {

            _teleporting = true;

            _teleportTimeoutID = setTimeout(_teleport, time);

            needToTeleport = false;
        }

        _updateAnimation();
    }

    protected function _teleport():void {

        _teleporting = false;

        object.x = endX;
        object.y = endY;

        clearTimeout(_teleportTimeoutID);
    }

    protected function _updateAnimation():void {

        if (_teleporting) {
            _animation = "teleport";
        } else {
            _animation = "normal";
        }           
    }       
}
}

© Game Development or respective owner

Related posts about flash