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 4 of 4

Thread: I need help for my platformer!

  1. #1

    I need help for my platformer!

    Hi,
    i don't know if this has been posted up before (Im new) So I'm posting this anyway.
    I've got my character working fine and everything is but I don't want my character to fall off the stage (I got a scrolling bg) But I don't want a wall, Does anyone know the code for when my character hits 0 on the left hand side of the stage it stops? My friend gave me a code but it didnt work.

    Also could you tell me where it would go?


    Please reply,

    Amy xxx

  2. #2
    if(_root.character_mc._x<=0){
    speed = 0;
    }
    if(_root.character_mc._x<=550){
    speed = 0;
    }
    that ought to work for you there the numbers are just the stage dimensions so you can easily adjust them to make him stop farther away from the edge or accomodate a larger stage and it is made to go on the main timelin e where the rest of your code should be attempted be organized hope that works

  3. #3
    Quote Originally Posted by cooldude88 View Post
    if(_root.character_mc._x<=0){
    speed = 0;
    }
    if(_root.character_mc._x>=550){
    speed = 0;
    }
    There. Fixed that for you, else the character wouldn't ever move.

    You could do it different ways. Basically, what you need to do is check if your character's _x is greater than the width of the stage or less than zero.Depending on the case you either subtract his 'Speed' variable(assuming there's one) from his _x value, or add to it.

    if(char._x>=Stage.width){
    char._x-=Speed;
    }
    if(char._x<=0){
    char._x+=Speed;
    }

    Last edited by zuperxtreme; May 10th, 2008 at 06:20 PM.

  4. #4
    Jephz's Avatar
    106
    posts
    The Penguin n00b
    or you can just draw a rectangle bar, set the alpha to 0, and put the code to push the character away. But I guess zupers way is better ^^.
    Don't you ever, ever, EVER call me a Noob. I mean it!

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