A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Odd Function Problem, HELP!

Threaded View

  1. #5
    Senior Member
    Join Date
    Apr 2007
    Posts
    269
    "//Runs every frame " the add eventlisteners in in the other doc
    PHP Code:
    var t5:MovieClip = new trail5;
    addChild(t5);
    var 
    t4:MovieClip = new trail4;
    addChild(t4);
    var 
    t3:MovieClip = new trail3;
    addChild(t3);
    var 
    t2:MovieClip = new trail2;
    addChild(t2);
    var 
    t1:MovieClip = new trail1;
    addChild(t1);
    var 
    player:MovieClip = new player_art;
    addChild(player);
    var 
    cursor:MovieClip = new cursor_art;
    addChild(cursor);
    //Including the AS files
    include "AS/rockets_imp.as"

    var XS:Number 0;
    var 
    YS:Number 0;
    var 
    ACC:Number 4;
    var 
    DEC:Number .8;
    var 
    vBox:Number 8;
    var 
    trail_offset:Number 2;
    var 
    key:KeyObject = new KeyObject(stage);

    stage.addEventListener(Event.ENTER_FRAMEeachFrame);
    Mouse.hide();

    function 
    eachFrame(e:Event):void{
        
    //HERE!!!
        
    timedSpawn();
        
    moveBarriers();
        
    cursor.mouseX;
        
    cursor.mouseY;
        
    player.+= XS;
        
    player.+= YS;
        if(
    mouseX player.-vBox){
            
    XS += ACC;
        }
        if(
    mouseX player.+vBox){
            
    XS -= ACC;
        }
        if(
    mouseY player.-vBox){
            
    YS += ACC;
        }
        if(
    mouseY player.+vBox){
            
    YS -= ACC;
        }
        
    t1.-= (t1.x-player.x) / trail_offset;
        
    t1.-= (t1.y-player.y) / trail_offset;
        
    t2.-= (t2.x-t1.x) / trail_offset;
        
    t2.-= (t2.y-t1.y) / trail_offset;
        
    t3.-= (t3.x-t2.x) / trail_offset;
        
    t3.-= (t3.y-t2.y) / trail_offset;
        
    t4.-= (t4.x-t3.x) / trail_offset;
        
    t4.-= (t4.y-t3.y) / trail_offset;
        
    t5.-= (t5.x-t4.x) / trail_offset;
        
    t5.-= (t5.y-t4.y) / trail_offset;
        
    XS *= DEC;
        
    YS *= DEC;

    Could you explain how I can do the array instead?
    Last edited by unrealhacker12; 02-03-2009 at 06:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center