Infinite sidescroller with randomized objects flying in


(Froom7) #1

Heya fellow punkers!
I want to make an infinite sidescroller(e.g. Canabalt) and I recall(long, loooong time ago) that Zach made a simple example of one. Does somebody know if that example game still exists?
If not, can someone help push me in the right direction. I already got the basics of FP down for a simple sidscroller(A running backdrop, animation etc.). Now I want to implement random obstacles flying at you while you run towards your goal. Think of fences of different heights etc.
Thanks in advance you guys…


How would create randomly generated barriers
How can I add enemies randomly?
(Bora Kasap) #2

I think you should describe the point you can’t get. Or you’re asking how to make “whole game”?


(Froom7) #3

I’m not asking for a whole game… I only want to know how to get objects of different heights flying in towards you…


(Jacob Albano) #4

I’m working on something fairly similar. Here’s my basic approach:

  • Create an Entity that acts as a platform
  • Add enough to fill the screen.
  • Each platform.update(), check if (platform.right < FP.camera.x)
  • If so, remove the platform and add a new one at x = (FP.camera.x + newPlatform.halfWidth), assuming your platforms’ origins are centered.

(Froom7) #5

Hmmm… I can see the basic idea here… Did some little research myself too and I think I can start experimenting with this idea


(Zachary Lewis) #6

So, I read this post and found some new art by Kenney, so I put a little demo together of an infinite runner somewhat similar to a popular avian game.

Press spacebar to flap fly.

TappyPlane.swf (v1.0.0) (131.2 KB)

View the complete source on GitHub. https://github.com/zachwlewis/tappy-plane

Let me know if this helps, or if it needs any additional clarification.


(Froom7) #7

Oooh… This seems interesting… I surely will look at the source. Thx man!
Can’t wait to play around with the source…


(azrafe7) #8

Hey, very nice trick in there for the atanmatic animation when the plane bumps into something!

Also… we now know that Hitboxes in Masklist don’t get rendered. :smirk:


(Nicole Brauer) #9

For further reading this article by the maker of Canabalt might be interesting:

Adam Saltsman also made the source code of Canabalt available (and I think it was made with Flixel) so you could pick that apart.


(Zachary Lewis) #10

Yeah, that was driving me nuts. I kept thinking I’d fucked something up, but things seemed to work okay, so I just left it as is.


(B6ka) #11

Also check out this awesome tutorial from Thomas Gorence
http://producerism.com/blog/flashpunk-dame-and-lua-tutorial-part-0/

A very good setup for infinite runner using FP and DAME.