flash game help

  • heywazup99
  • Newbie
  • Newbie
  • heywazup99
  • Posts: 6
  • Loc: Naperville, IL

Post 3+ Months Ago

hey can anyone help me with this, im just completely stuck on this, im trying to make a track game, basically the ball always stays in the center on its own movie clip on the root, and on another layer on the root is the track movie clip with a registration in the center, and inside that another movieclip with the actual track in it and the registration in the center and the code is on this movie clip. the link to what i have so far is at:
http://www.scratchdesk.com/track.html
Code: [ Select ]
onClipEvent(load) {
    ang = 0;
    ymov = 0;
    xmov = 0;
    mov = 0;
}
onClipEvent(enterFrame) {
    if (Key.isDown(Key.UP)) {
        mov += 5;
    }
    if (Key.isDown(Key.DOWN)) {
        mov -= 5;
    }
    if (Key.isDown(Key.LEFT)) {
        _parent._rotation += 3;
    }
    if (Key.isDown(Key.RIGHT)) {
        _parent._rotation -=3;
    }
    
    ang = _parent._rotation
    //trace (ang);
    xmov = Math.sin(ang*Math.PI/180)*mov;
    ymov = Math.asin(ang*Math.PI/180)*mov;
    _x = xmov;
    _y = ymov;
}
  1. onClipEvent(load) {
  2.     ang = 0;
  3.     ymov = 0;
  4.     xmov = 0;
  5.     mov = 0;
  6. }
  7. onClipEvent(enterFrame) {
  8.     if (Key.isDown(Key.UP)) {
  9.         mov += 5;
  10.     }
  11.     if (Key.isDown(Key.DOWN)) {
  12.         mov -= 5;
  13.     }
  14.     if (Key.isDown(Key.LEFT)) {
  15.         _parent._rotation += 3;
  16.     }
  17.     if (Key.isDown(Key.RIGHT)) {
  18.         _parent._rotation -=3;
  19.     }
  20.     
  21.     ang = _parent._rotation
  22.     //trace (ang);
  23.     xmov = Math.sin(ang*Math.PI/180)*mov;
  24.     ymov = Math.asin(ang*Math.PI/180)*mov;
  25.     _x = xmov;
  26.     _y = ymov;
  27. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

you need to always set the map center to match the _x and _y of your movieclip. Add these lines in enterFrame, after _y = ymov;
Code: [ Select ]
_parent._x = xmov;
_parent._y = ymov;
  1. _parent._x = xmov;
  2. _parent._y = ymov;

Not sure if those lines will always center the map, but that's the idea, to have the movieclip in the center of the map

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.