A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Any one know the script i need?

  1. #1
    Join Date
    Jul 2010

    Arrow Any one know the script i need?

    Hey everyone,

    This is the script to the control a character in a game I made. Now when I hit the object with the instance name wall the script makes it reset to a set position (this can be seen in the last section of the script). Now I wish for it to instead go to a different scene which says something like game over. Also if you have extensive knowledge about this could you maybe tell me how I could have my character ( a ship) explode first. Thank you.

    Oh and 1 other thing, if you could think of better character movement settings (the gravity and upconstant etc) that are similar to the game metro siberia that wouls also be a great help.

    (i may not reply immediatly as I am away for 2 days, thx)

    onClipEvent (load) {
    yspeed = 0;
    xspeed = 0;
    wind = 0.00;
    power = 5;
    gravity = 0.45;
    upconstant = 0.2;
    friction = 0.99;
    onClipEvent (enterFrame) {
    if (Key.isDown(Key.SPACE)) {
    yspeed = yspeed-power*upconstant;

    xspeed = (xspeed+wind)*friction;
    yspeed = yspeed+gravity;
    _y = _y+yspeed;
    _x = _x+xspeed;
    _rotation = _rotation+xspeed;
    if (_root.wall.hitTest(_x, _y, true)) {
    xspeed = 0;
    yspeed = 0;
    _x = 120;
    _y = 120;


    Thank you.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    instead of

    Actionscript Code:
    _x = 120;
    _y = 120;


    Actionscript Code:

    Inside the ship movieclip add a keyframe with a stop(). Give it the label explosion.
    On that labelled keyframe place a movieclip that will contain the explosion animation. At the end of that animation - ie, on that animation movieclip's last keyframe - write this:

    Actionscript Code:

    "gameover" being a label on the main timeline (different scene or not, doesn't make any difference)


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