How can I make an infinite runner game?

CabacoCabaco Member Posts: 414
edited November -1 in Working with GS (Mac)
I want to make a runner game like i.e. Chop Chop Runner.
Can you teach me step by step how to do so please?

Comments

  • DreamLabDreamLab Member Posts: 2,127
    I know there are a couple templates out there like this. but I am not so sure how without just giving you the template. So Someone else will have to answer that.

    DL
  • andrekadowandrekadow Member Posts: 29
    This works for a infinite game and a game with levels too? I never understood why the scene moves and the runner just jump.
  • DrGlickertDrGlickert Member Posts: 1,135
    don't take this the wrong way, but there are very few people (if any) that will walk you through a game (at least for free). Especially if you want to sell the game.

    I would never walk someone through a game for free and have them turn around and sell it.

    Best advice I can give, is start the project, when you run into a snag, ask on the forums for a work-around or the proper way to code it.

    Good luck to you!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    1) Create a platform actor. Make it move to the left (use interpolate or move or change velocity or...) When it gets all the way off screen you'll need to move it back to the right side of the scene to "recycle" it. You'll need multiple platforms that recycle. After each "recycling" you'll probably want to change the width of the platform as well as the gap between platforms. You'll also want a way to speed the movement up as teh game goes on.

    2) create a character actor that can jump but not move left or right. Set it towards the left side of the screen.

    or

    go to the market place thread and buy a runner template.

    :)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    DrGlickert said:
    don't take this the wrong way, but there are very few people (if any) that will walk you through a game (at least for free). Especially if you want to sell the game.

    I would never walk someone through a game for free and have them turn around and sell it.

    Best advice I can give, is start the project, when you run into a snag, ask on the forums for a work-around or the proper way to code it.

    Good luck to you!

    +1

    Follow your doctors advice.
  • olster1olster1 Member Posts: 396
    I wrote this a couple days ago for another thread, just an explanation of how to have an infinite amount of scrolling obstacles.

    In fact, it's better to have all the actors on screen and once and to recycle them rather than destroying and spawning. What I explain below is assuming each of the obstacles are different sizes.

    Create a game intiger attribute called obstacle
    Create a boolean attribute in each obstacle called move

    Create an actor or anything to use as your randomiser. Add a timer in it and say
    every X seconds change attribute game.obstacle random (1, however many obstacles there are)

    Assign a number to each obstacle and create rule when game.obstacle = the number you assigned
    change attribute self.move to true

    Create a second rule when self.move=true
    move actor at 180 speed 90 (something like that) If you want to interpolate instead of move then say interpolate position x to -50 select linear and have a duration of 1. If you want it slower make the duration bigger.

    Create a third rule When Attribute self.position.X < - self.Size.Width /2
    Change attribute self.position.X to self.Position.X + self.Size.Width + game.Display Size.Width AND change self.move to false.

    Place each actor just out of view of the camera on the right.

    This is at least what I use, not sure if it's the most efficient but seems like the best solution.

    If your obstacles are the same size this may save more memory:

    Create a game intiger attribute called obstacle
    Create a boolean attribute in each obstacle called move
    Create another game intiger attribute called image

    Create an actor or anything to use as your randomiser. Add a timer in it and say
    every X seconds change attribute game.obstacle random (1, however many obstacles there are on screen at any one time)

    Create a single prototype actor and chuck all of these rules in there.

    What is the maximum number of obstacles on screen at any one time, lets say its 3. So drag 3 copies of this prototype onto your scene on right hand side. Assign a number to each obstacle 1,2 and 3 and create rule when game.obstacle = the number you assigned
    change attribute self.move to true AND change attribute game.image to random (1, however many images of obstacles you have)

    Assign each image with a number and create a second rule thats says when game.image = the assigned number
    change image to the image you assigned.

    Create a third rule when self.move=true
    move actor at 180 speed 90 (something like that) If you want to interpolate instead of move then say interpolate position x to -50 select linear and have a duration of 1. If you want it slower make the duration bigger.

    Create a fourth rule When Attribute self.position.X < - self.Size.Width /2
    Change attribute self.position.X to self.Position.X + self.Size.Width + game.Display Size.Width AND change self.move to false.

    So with this method you only have one prototype and only 3 actors on scene but all 10 obstacles.

    Hope that helps :)
Sign In or Register to comment.