147 votes
Accepted

What is actually moving in an endless runner?

I slightly disagree with Philipp's answer; or at least with how he presented it. It gives the impression that moving the world around the player might be a better idea; when it's the exact opposite. ...
  • 2,054
88 votes

What is actually moving in an endless runner?

Both options work. But if you want the endless runner to be truly endless, you will have to keep the player stationary and move the world. Otherwise you will eventually hit the limits of the ...
  • 113k
48 votes
Accepted

How to differentiate landing on top of an object from falling down the side?

There are three common ways games sort this out: Minimum Separation Vector Upon a collision, compute the shortest movement that pushes the bodies apart into a non-intersecting position. If I've ...
  • 117k
41 votes

How to make healing in an exploration game interesting

I think you need to consider this at a more fundamental level: what is the gameplay purpose of having a health system in your game? A conventional health system serves two purposes: (1) it gives a ...
  • 2,006
37 votes

What is actually moving in an endless runner?

Building off of XenoRo's answer, instead of the re-rooting method they describe, one could do the following: Create a circular buffer of parts of your infinite map generated, which your character ...
  • 1,693
34 votes
Accepted

How can I detect the player being crushed in a 2D platformer?

I think you'll have to take the box's movement into consideration. That is, only crush if the box is moving towards the player. This is similar to other problems in platformers, where the movement is ...
  • 14.6k
23 votes
Accepted

How can I adapt A* pathfinding to work with platformers?

You don't need to adapt A* at all. The only consideration is where you put your nodes and how you connect them. The linked article seems to convert from a platformer-friendly model to a grid based ...
  • 718
14 votes

What is actually moving in an endless runner?

As already asked and accepted, it really depends on the scope and style of your game, but since it wasn't mentioned: FlappyBird moves the obstacle across the screen, rather than the player across the ...
  • 1,740
12 votes

How to make healing in an exploration game interesting

You mentioned having thought about auto-regeneration and your issue with that was the possibility of a player, while in the middle of a fight, running around while they auto-regenerate health. Have ...
  • 138
9 votes

How can I detect the player being crushed in a 2D platformer?

Have the "crush test" points be inside the gray box shown in your image #1 - i.e. kill the player only if you detect a hit on one of the pixels there.
  • 1,019
7 votes
Accepted

Unity2D jumping inconsistancy

I'd recommend changing Input.GetKey("space") to Input.GetKeyDown("space"). This way the check is only performed on the initial ...
7 votes
Accepted

How to make healing in an exploration game interesting

Perhaps you can add some non-conventional healing system. Like for example : Health steal -> percentage of health gained = percentage of enemy health lost, and varies with enemy level. Every nth hit ...
6 votes
Accepted

Level Design: Char Traveling to and from a Site

There are multiple ways to solve this. If you want to include said long drops and other one-way obstacles, that should be factored in possibly as a feature. The Legend of Zelda series often uses ...
6 votes
Accepted

How can I avoid "Moonwalking"

If I recall correctly, both Prince of Persia and Flashback (as well as its predecessor, Another World/Out of This World) only allowed movement in set 'steps': if the player ran or walked, they would ...
6 votes
Accepted

How to handle complex inputs in 2D platform game?

This is an excellent question because you are experiencing a problem that's quite commonplace with less experienced programmers: attempting to solve your problem with a purely imperative approach. ...
  • 1,637
6 votes

How can I detect the player being crushed in a 2D platformer?

As someone who grew up with 80s platformers, my first comment is that the contact points must be exactly on the sprite, not anywhere outside it. There were few experiences more frustrating than dying ...
  • 223
6 votes

How to make healing in an exploration game interesting

There's lots of examples out there in 2D platforming, it's really a question of how you want healing to be "interesting"? I would agree with suggestions that "skillful" play should be rewarded, but ...
  • 301
6 votes
Accepted

How to control jump strength by how long the player presses the jump button?

You have essentially 2 options. You can either apply a constantly decreasing force to the character while the player is pressing the space button and stop immediately when they release it or apply a ...
  • 14.6k
5 votes

How to map gamepad inputs for my platformer?

Most importantly: plan for remappable controls from the start. Different games use different conventions, and different players have different preferences. This is also important for accessibility - ...
  • 117k
4 votes
Accepted

Is it bad practise to have an object for every tile?

It is fine to have lots of instances. An instance of a class without virtual methods is just like a POD C struct in terms of ...
  • 10.5k
4 votes
Accepted

How to test if procedurally generated level for infinite runner can be passed?

I understand you are dealing with both box obstacles and gaps. The way it was described, I can see three possible situations. Correct me if the game is designed differently. With the first, there are ...
  • 2,586
4 votes

Java Libgdx Attaching Sprite to Box2D Body

Two (simple) solutions could look something like this: Give the player class a Sprite (best). ...
  • 7,680
4 votes
Accepted

How to implement a clipped shadow in 2D?

1)Cast a set of rays from origin to the ground evenly distributed through the width of your object. 2)Draw your shadow as a small portions of black sprites with varying height so you can round the ...
  • 1,414
4 votes

How to make healing in an exploration game interesting

Limit healing resources and put any additional resources into new, unexplored areas. Create the incentive where if a player wants to heal, they have to press on into more of the map. You can do this ...
4 votes

How to make healing in an exploration game interesting

If cowarding during a boss fight is your major problem with auto-regeneration, make the auto-regeneration non-linear: give it a cap of auto-regeneration, and disable it during boss fight (boss fight ...
  • 141
3 votes

How do I randomly position objects without overlap?

I'd try something like this: Go from the start to the end and place the platforms at semi-random positions. Ensure this basic level is solvable, i.e. the end may be reached. Once that's done, use ...
  • 8,292
3 votes

Is it bad practise to have an object for every tile?

You need to remember that C++ is a multi-paradigmatic (OOP, functional, procedural, ..) language and you should use the programming paradigm that best solves your current issue. OOP doesn't lend ...
  • 462
3 votes

Level Design: Char Traveling to and from a Site

Here is an idea: You can create one-way paths, with a little tweak. If the player enters the path from "Site 2" he should see everything mirrored. This way, if he starts from Site 1 he can go to Site ...
  • 8,677
3 votes
Accepted

Why does my character stop a little before landing on the ground?

The problem I think the main flaw is that you're checking if the object is in the air using the code place_free(x, y + speedAir). That's effectively like this: ...
  • 13.3k
3 votes
Accepted

Why doesn't this 2d physics calculation yield the desired jump height?

It's because of the discreet time and the way you integrate. Because you step time forward at 1/50 of a second you're not guaranteed to hit the actual apex of 4.0, the delta is just not granular ...
  • 4,296

Only top scored, non community-wiki answers of a minimum length are eligible