Trying to make an infinite jumper as a school programming project and would be cool if you guys could help me on the way and where I should start.
Some few questions I have:
How do I make the screen "infinite"?
How can I follow the player?
Thanks
infinite jumper
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: infinite jumper
Obviously, your computer cannot generate an infinite level at once and store it in the memory. The solution is to only have the part of the level in memory that is currently drawn on screen. You can do this by randomly creating new platforms on the right of the screen and constantly moving these to the left. Once a platform leaves the screen on the left, remove the platform from memory.
Check out my blog on gamedev
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: infinite jumper
By jumper, do you mean a platformer?
I'm going to assume so for the purposes of this post:
First, you need to know about cameras. A camera is not really an actual concept within LÖVE, it's just a bit of math you use to draw things with an offset. There are libraries out there that make this a little bit easier, but in this case it's probably easier to just use a little bit of math (assuming you only move the camera to the right and left). The math is really simple, I promise: it's just a single addition in the place you draw things.
To make it infinite is not really difficult. It makes it simpler in some ways, in fact, since you can just leave out some checks for the edge of the world. Now, what kind of level you want is more important here. Is it going to repeat? Or do you want it to be different every time? If the latter, you'll need to randomly generate the level piece by piece.
I'm going to assume so for the purposes of this post:
First, you need to know about cameras. A camera is not really an actual concept within LÖVE, it's just a bit of math you use to draw things with an offset. There are libraries out there that make this a little bit easier, but in this case it's probably easier to just use a little bit of math (assuming you only move the camera to the right and left). The math is really simple, I promise: it's just a single addition in the place you draw things.
To make it infinite is not really difficult. It makes it simpler in some ways, in fact, since you can just leave out some checks for the edge of the world. Now, what kind of level you want is more important here. Is it going to repeat? Or do you want it to be different every time? If the latter, you'll need to randomly generate the level piece by piece.
Help us help you: attach a .love.
Re: infinite jumper
I have multiple objects that are falling down and you are suppose to jump on them and go higher and higher up.Robin wrote:By jumper, do you mean a platformer?
I'm going to assume so for the purposes of this post:
First, you need to know about cameras. A camera is not really an actual concept within LÖVE, it's just a bit of math you use to draw things with an offset. There are libraries out there that make this a little bit easier, but in this case it's probably easier to just use a little bit of math (assuming you only move the camera to the right and left). The math is really simple, I promise: it's just a single addition in the place you draw things.
To make it infinite is not really difficult. It makes it simpler in some ways, in fact, since you can just leave out some checks for the edge of the world. Now, what kind of level you want is more important here. Is it going to repeat? Or do you want it to be different every time? If the latter, you'll need to randomly generate the level piece by piece.
eh... just have the love file
I've made some improvements and it looks now like it is "going up" but how do I make the objects fall randomly? they are falling exactly the same everytime I start the game.
--VIEWER DISCRETION IS ADVISED--
Very messy code.
- Attachments
-
- Project.love
- (2.8 KiB) Downloaded 127 times
Re: infinite jumper
Well, I don't understand of what you said. Do you want to camera always go up and player must follow the camera or the camera must follow the player? Are the objects the platform to jump? If the objects is then your objects doesn't need collision and moving slower when on the ground actually. You shouldn't need camera anyway because the objects falls (but it's alright if you want to make the camera follows player). Camera tutorial can be found on the wiki. If you mean by "screen", do you mean the objects? (For stable perfomance) you should delete object(s) that over the edge. If you want to make objects falls from different position, you should seed the random generated number.
Re: infinite jumper
Because you are using math.random() which isn't seeded by default. Use love.math.random() insteadMiken1 wrote: I've made some improvements and it looks now like it is "going up" but how do I make the objects fall randomly?
Also the current movement of your platforms feels a bit strange. It doesn't really feel like you are going up. It's more like platforms falling into hot lava and only stay on the surface for a few seconds (you could make a game based on that concept too ).
In Journey To The Stars I did something quite similar (the concept is the same just applied to a horizontal movement).
You are on the right track by moving the platforms instead of the player. My approach certainly isn't bullet proof but it works quite fine for the game I think.
Basically I have a queue of objects to be spawned (in my case asteroids). At the start of the game the queue is full and every few seconds a new object is popped from the queue and spawned in a certain area outside of the screen on the right side. All "living" objects are the moved to the left at a certain speed until they leave the screen on the left side and are removed. They are pushed to the back of the queue and wait for the next time they need to be spawned. To prevent walls of objects coming at the player I made sure that the asteroids are spawned at a random distance to each other.
For your game you'd probably need to limit the maximum distance the platforms can have to each other to the jump distance, so that the player can reach every spawned platform.
Who is online
Users browsing this forum: Google [Bot] and 2 guests