vendredi 7 avril 2017


so i've been working on this game for a week now and i dont have any coding background at all so im trying to find tutorial here and there.. then i come up with this problem ...

so what i wanna do is move the object (CHARA) to the right when i hit frame 80 inside (CHARA,which is a nested movieClip with 99 frames btw ) then move it back to original position when i hit frame 99... the problem is anything i do doesn't make my object move at all (movieClip still played btw) what did i do wrong here? did i just put the code at the wrong position ?? (CHAR is moved only if i put the code x= directly inside frame 80 but i try using class here)

here is my code,sorry i know its messy its my first code i try my best here

public class Main extends MovieClip{


    public var CHARA : CHAR = new CHAR(); //my main char
    public var rasen : Rasen_button = new Rasen_button(); //the skill button
    public var NPCS : NPC = new NPC(); // the npc

    public function Main()

        var ally:Array = [265,296]; //where me and my ally should be
        var jutsu : Array = [330,180]; // where the buttons should be
        var enemy:Array = [450,294]; //where the enemies should be

        addChild (NPCS)
        NPCS.x = enemy [0]
        NPCS.y = enemy [1]
        NPCS.scaleX *= -1

        rasen.x = jutsu[1];
        rasen.y = jutsu[0];

        CHARA.x = ally[0]
        CHARA.y = ally[1]

    rasen.addEventListener(MouseEvent.CLICK, f2_MouseOverHandler);
    function f2_MouseOverHandler(event:MouseEvent):void{

CHARA.gotoAndPlay(46) //here is the problem
if (CHARA.frame==80){
    CHARA.x= ally[1]} //just random possition for now




any suggestions?

Aucun commentaire:

Enregistrer un commentaire