Sidescroller, Player and Enemies in lanes

MarcoColMarcoCol Member, PRO Posts: 297
edited June 2012 in Working with GS (Mac)
Hi,

my game is growing and growing.
No I had an idea, but I didn't know how the put it in the game:
The game is a sidescroller. And the player (left) and all enemies (random from right to left) should be moving in one of five lanes. The lanes are:
5
4
3
2
1
So if the player starts in lane 3, and he push the down-arrow, he should move to lane 2 and so on.
The opponents (6 differen) should be appear in one of the 5 lanes by random. And if one of them is currently on a lane (till he was destroyed or move left out of the screen) there should be no other at this time.
How can I do that? Did you have an idea?

Best

Answers

  • HapiappsHapiapps Member Posts: 373
    1. Determine y coordinates for each lane

    2. Lets say lane is 1 right now. When up arrow is pressed, change attribute lane to lane+1

    3. If lane=2 constrain self position y to this y position

    4. Do this for all 5 lanes, and lane-1 for down arrow


    To spawn in random lanes, just make an attribute, then have it choose a random number 1-5
    Then when it =1, a certain y value, do this for the other 5 as well.
  • MarcoColMarcoCol Member, PRO Posts: 297
    Hi Hapiapps,

    thank you for your comments.
    I do 1.
    Also I combine the push-buttons for the movement of the character.

    But I didn't know how to set the lanes. Are the lanes Actors?
  • MarcoColMarcoCol Member, PRO Posts: 297
    So what should I do, if the player release the button for changing the lane, before the character reach the lane?
Sign In or Register to comment.