Problem with moving platform
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Problem with moving platform

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    3

    Problem with moving platform

    I'm trying to create a moving platform for a simple platforming game in AS3. The platform starts moving when you activate a switch. The problem is I can't set the boundaries for the platform correctly. It should bounce between 60 and 436 on the X-axis. I'm not sure what I'm doing wrong. When it gets to the left boundary it just stops. Here's the code.

    if (greenSwitch == true)
    {
    lift.vx = -5;
    lift.x += lift.vx;

    if (lift.x < 60)
    {
    lift.vx *= -1;
    }
    if (lift.x > 436)
    {
    lift.vx *= -1;
    }
    }

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    756
    remove the minus sign from:

    if (lift.x > 436)
    {
    lift.vx *= -1;
    }

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

Poll by Flashkit.com