The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 3 of 3

Thread: Next level via using 1 key? :S

  1. #1

    Next level via using 1 key? :S

    Hi guys, I have yet another problem!

    I've been working on this really cool platform/adventure game and in this game to get to the next level you have to go through a door, but this door isn't on the stage until you get the magical gem. Before you say, I have all of that sorted out it's just I don't know what code to use for when the door is on the stage and to get to the next level the character (instance: char) is on the door movieclip (instance: door) AND the player has to press the D key(68) to get to the next level.

    My friend gave me this code to go inside of the players code:
    if(Key.isDown(68)){
    if(Math.abs(_x-door._x)<(door._width/2)){
    _root.gotoAndStop(2)
    }
    }

    But nothing happens?

    Please could you reply a.s.a.p!

  2. #2
    that code should work assuming you have level 1 on frame 1, and level 2 on frame 2 of your timeline...

    if(Key.isDown(68) and char.hitTest(door._x,door._y,true))
    {
    this.gotoAndStop("level 2")
    }
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  3. #3
    I would do almost the same thing as bluemagica

    if(Key.isDown(68) and _root.door.hitTest(_root.char._x,(_root.char._y,tr ue))
    {
    this.gotoAndStop("level 2")
    }

    i would also like you to be sure that your objects have the instance names rather than just the instances have the names.
    Last edited by Lolghurt; July 22nd, 2008 at 02:04 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012