VIII. Map Collisions

In the end, it was relatively unsatisfactory that we now have a level and a player, but the latter doesn't want to know anything about the former, but simply flew past it. Come with colleagues, today we let the player hit hard.

For this chapter I have updated the tileset. If you use this tutorial tileset, you can download the new version in the upper right corner, under "Assets". Please note that you also have to reload the new IFF in ™REDPILL, under "Tiles"!

Now that we have the new tileset, we're going straight into the topic: Let the player collide with the map. To define which tiles the player should collide with, in which way he should do this and which tiles he can simply walk through like "Neo" in "The Matrix", we define under "Tiles" and there under "Edit Properties".

In this area we have again, like in the level editing, the possibility to select a tile in the upper part of the screen and then set the properties of this tile in the lower part (which you can see here in the screenshot). Especially note the button labeled "Non Solid". In ™REDPILL every tile is equipped without collision right from the start. That's also the reason why our player currently just falls through the map. If we select a tile and click on the button "Non Solid", the button changes to "Platform" and the display of the selected tile changes as well. Another click on the button and the label changes to "Solid" and the display of the selected tile changes again. But what is the difference between "Non Solid", "Platform" and "Solid"?

Well, by default, all tiles in ™REDPILL are "Non Solid" -- "Not Solid" -- "Permeable". The player can simply walk "through" these tiles, or pass in front of them. If you set the collision of the tile to "Platform", the tile becomes a very special candidate: The player can fall on the tile and stay on it. He can also run through the tile if it hangs low enough. But if the player stands under this tile and then jumps up, he stays on the "Platform". That means: The player only collides with the tile if he falls from above onto the tile. One platform even. Crazy.
The third possibility, the ominous "solid", simply means: No matter how hard you try, you will not get through this tile. You collide with it horizontally, you can stand on it and even with jumping and the thickest skull, you cannot get through from below.

So now we know how to protect individual tiles from the player just walking through them. Why don't you edit the floor tiles, make them solid. Place the new platforms from the new tileset and configure them as "platforms". You may need to reposition the player again, as shown in the last chapter. But when you click on "Play", the magic happens: The player stops on the level floor.

™REDPILL has already preconfigured the player with control keys. With the cursor (arrow) keys you can control him already now. Left and right move the player in the same direction, while the up arrow lets the player jump. Now ... actually the player does not jump. He is running upwards because ™REDPILL does not know that there is an up and down. Also everything seems to jerk and jerk a little bit. But these are problems we will deal with in two other chapters.

 

 

last update: 2020-07-30 -- v0.5.0