Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    76
    Thanks
    11
    Thanked 0 Times in 0 Posts

    AS 3.0 My Game! :) - First project

    http://megaswf.com/view/3e575063f24e...91918d82f.html

    Here's the link to my game guys. As you can see! The turning doesn't work, I'm just a beginer. I don't think the rotation works quite correctly? Not sure why.. But I need somehow to have the code moveForward relative to the car_mc. Instead of just x += +5 : being relative to the document!

    Code:
    stop();
    forward_mc.addEventListener(MouseEvent.CLICK, moveForward); 
     
    function moveForward(event:MouseEvent):void
    
    {
    car_mc.y -= 15;
    }
    
    backward_mc.addEventListener(MouseEvent.CLICK, moveBackward); 
     
    function moveBackward(event:MouseEvent):void
    
    {
    car_mc.y += 15;
    }
    
    left_mc.addEventListener(MouseEvent.CLICK, moveLeft); 
     
    function moveLeft(event:MouseEvent):void
    
    {
    car_mc.rotation -= 15;
    }
    
    right_mc.addEventListener(MouseEvent.CLICK, moveRight); 
     
    function moveRight(event:MouseEvent):void
    
    {
    car_mc.rotation += 15;
    }
    
    
    
    
    bigger_mc.addEventListener(MouseEvent.CLICK, makeBigger); 
     
    function makeBigger(event:MouseEvent):void
    
    {
    car_mc.scaleX += 2;
    car_mc.scaleY += 2;
    }
    
    smaller_mc.addEventListener(MouseEvent.CLICK, makeSmaller); 
     
    function makeSmaller(event:MouseEvent):void
    
    {
    car_mc.scaleX -= 2;
    car_mc.scaleY -= 2;
    }
    
    cloak_mc.addEventListener(MouseEvent.CLICK, makeCloak); 
     
    function makeCloak(event:MouseEvent):void
    
    {
    car_mc.alpha -= .50;
    ;
    }
    
    reset_mc.addEventListener(MouseEvent.CLICK, reset); 
     
    function reset(event:MouseEvent):void
    
    {
    
    car_mc.alpha = 1;
    car_mc.scaleX = 1;
    car_mc.scaleY = 1;
    car_mc.rotation = 0;
    car_mc.y = 512;
    car_mc.x = 518;
    
    }
    any help would be much appreciated! I am a newbie so bare with me

    Thankyou!

  • #2
    New Coder
    Join Date
    Jun 2008
    Posts
    76
    Thanks
    11
    Thanked 0 Times in 0 Posts
    I fixed the rotation error it was really simple, just a case of editting my positioning in the library!


  •  

    Posting Permissions

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