Scripts examples


<examples>
    <scen name="Moving to point">
        <commands>
            <sp n="x" v="400" />
        </commands>
    </scen>
    <scen name="Moving with speed (use timer)">
        <commands>
            <sp n="x">
              <v><madd p1="4">
                    <p2><gp n="x" /></p2>
                    </madd>
              </v>
            </sp>
        </commands>
    </scen>
    <scen name="Change image (set property)">
        <commands>
            <sp n="source" v="assets/personUp.gif" />
        </commands>
    </scen>
    <scen name="Change image (use function)">
        <commands>
            <run1 n="load" p1="assets/personLeft.gif" />
        </commands>
    </scen>
    <scen name="Change world size">
        <commands>
            <sp id="world" n="width" v="500" />
            <sp id="world" n="height" v="350" />
        </commands>
    </scen>
    <scen name="Moving from one to another (part 1 - run once)">
        <commands>
            <makeObject envId="temp" />
            <sp id="temp" n="speed" v="4" />
            <sp n="x" v="200" />
            <sp n="source" v="assets/personRight.gif" />
        </commands>
    </scen>
    <scen name="Moving from one to another (part 2 - run timer)">
        <commands>
            <spadd n="x"><v><gp id="temp" n="speed" /></v></spadd>
            <if>
                <cond><gt p2="300"><p1><gp n="x" /></p1></gt></cond>
                <then>
                    <sp id="temp" n="speed" v="-4" />
                    <sp n="source" v="assets/personLeft.gif" />
                </then>
                <else />
            </if>
            <if>
                <cond><lt p2="100"><p1><gp n="x" /></p1></lt></cond>
                <then>
                    <sp id="temp" n="speed" v="4" />
                    <sp n="source" v="assets/personRight.gif" />
                </then>
                <else />
            </if>
        </commands>
    </scen>
</examples>