Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - riotmedic

Pages: 1
1
Ask a Question / Scene setting ID problem?
« on: July 07, 2011, 12:25:57 pm »
Maybe it's just me, but when I create a local Scene attribute and then try to set it with an (if > then) tree (I'm using a global variable to keep track of the last scene/level the player died on), the setter for the local scene variable experiences errors.

Code: [Select]
public var _retry:Actor;
public var _lastSceneIWasOn:Scene;
override public function init():void
{

    if (sameAs((getGameAttribute("lastLevelIWasOn") as String), "level1"))
    {
        _lastSceneIWasOn = 0;
    }

    else
        if (sameAs((getGameAttribute("lastLevelIWasOn") as String), "level2"))
        {
            _lastSceneIWasOn = 4;
        }

        else
            if (sameAs((getGameAttribute("lastLevelIWasOn") as String), "level3"))
            {
                _lastSceneIWasOn = 2;
            }
}

This is generate after using the Design section of StencylWorks. Should it not be setting an ID, instead of setting the scene to an INT? I figure so, because of the error message I get:

Code: [Select]
Behavior: Design_5_5_retryclick at line 40
Implicit coercion of a value of type int to an unrelated type stencyl.api.engine.scene:Scene.
            _lastSceneIWasOn = 0;



Behavior: Design_5_5_retryclick at line 45
Implicit coercion of a value of type int to an unrelated type stencyl.api.engine.scene:Scene.
            _lastSceneIWasOn = 4;



Behavior: Design_5_5_retryclick at line 50
Implicit coercion of a value of type int to an unrelated type stencyl.api.engine.scene:Scene.
            _lastSceneIWasOn = 2;

This is probably fixable using Code Mode, but I'm wondering if this is a bug or if I'm managing to mess it up in Design somehow. I'm using v 1.0.2 b402.

Aside from this, this is a great tool, thanks for making it!! Having a lot of fun playing with it.

Pages: 1