A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to make an elevator or lift in platform game?

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Location
    Chicago
    Posts
    13

    How to make an elevator or lift in platform game?

    I am creating a side scrolling platform game using the book "Flash Game University" by Gary Rosenzweig.

    My current issue is trying to create a lift or elevator to carry the player up or down. The lift is not covered in the book. My thoughts were that the lift constantly moved up and down at a pace determined by a timer. I cannot get my lift to move. I have created a movie clip called "lift" and made it exported for action script. I can make it act similar to a floor movie clip so that I can stand on it, but I cannot get the lift to move on the y axis.

    I tried creating a new function called lift() and using a for loop to count between 0 and 100 using a variable "i" and then make my lift move up 1 unit for each loop cycle. It didn't work.

    lift.y -= lift.y - 1;

    Does anyone have a better solution?

    Thanks,
    Alex
    Alex Dove
    A Web Development Company
    www.pivotalsolution.com
    alex.dove@pivotalsolution.com

  2. #2
    mentally unstable member smayer72's Avatar
    Join Date
    Jan 2001
    Posts
    527
    Hey Alex
    Honestly I would steer away from that book. He uses very little OOP programming and I found his coding method limiting. I would recommend you should look at Citrus Engine instead. It is an AS3 game engine incorporating multiple libraries like Starling, Away3d, Box2d, Nape and FeathersUI. It really makes life easier.
    http://citrusengine.com/
    Scott (Australia)

    Sarcasm, chaos and disorder. My work here is done!

    **Mark you threads as [RESOLVED] please.**

  3. #3
    Registered User
    Join Date
    Dec 2013
    Posts
    9
    Quote Originally Posted by ADove View Post
    I am creating a side scrolling platform game using the book "Flash Game University" by Gary Rosenzweig.

    I tried creating a new function called lift() and using a for loop to count between 0 and 100 using a variable "i" and then make my lift move up 1 unit for each loop cycle. It didn't work.
    lift.y -= lift.y - 1;
    Does anyone have a better solution?
    Thanks,
    Alex
    The problem is lift.y = lift.y - 1;

    One solution is to add the moving code to the EnterFrame Event listener function.

    lift.y = lift.y - incrementValue; //lift starts from bottom
    if(lift.y < topValue || lift.y>bottomValue)
    {
    incrementValue = -incrementValue; // To switch to opposite sides
    }

    Hope this might help you

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