VII. The Player

Surely you have already noticed the small blinking white square in the upper left corner of the screen. This small, inconspicuous gnome is actually the player. Without graphics and without animation. If you click once on "Play", you will see your level from the last chapter. But nothing else happens. Why is that so? Let's explore what the player actually is.

In ™REDPILL almost everything that exists beside the map is an object. Imagine a stone that your player can pick up from the ground. In this case the object "player" would pick up an object of the type "item". If the player shoots, he will use objects of the type "Shot" and probably on objects of the type "Enemy". You will have read it out ... the player is an object of the type "Player". If you start a new project in ™REDPILL, there already exists an object with the number 0 (we come closer to the story with the notebook) which is of the type "Player".

So if you want to change the properties of the player, you have to do this under "Objects", because the player is, as just explained, only one object among many possible ones ... even if it is a little bit special.

Bring the gladiator into the arena!

What we should do first: Drag the player to the position of the level where you want him to start in that very level. For this we click on "Levels" and should have landed in our level from the last chapter "Level". Now we can click into the small rectangle, hold it and drag the rectangle to the desired position in the level. For this level this is now the starting point where the player starts his adventure.

So now the rectangle is in your map. But if we click on "Play" now, nothing happens, except that another area of your level might be visible. Remember in the chapter "AGA, ECS, Colors" I told you to check the box "Camera Follow" and just now I said that the object "Player" has the number 0? Well, there was a number next to "Camera Follow", namely 0 and the camera always follows the object with the number entered next to "Camera Follow". You can also let the camera follow an Enemy or a Shot. In this tutorial this would be useless, but it would work!

But why does nothing else happen? Well, since ™REDPILL can be used for various game genres, it doesn't make sense that the player always falls down or the camera follows him. In this tutorial we build something like a platform run. That means that we think it's cool if the player can fall and jump. To achieve this we have to tell the object "player" that we want to do this.

So we click on the button "Objects".

In the upper left corner, at "Object", we see the object number 0, and since we can read "My Player" directly to the right and see "Type: Player" further to the right, we can assume with a probability bordering on certainty that this object is our player. But if you compare this screenshot with what you see on the screen, you will notice that I made some changes to the object in ™REDPILL.

First of all I have checked the box "Visible". Such a visible player is already something cool. As long as we don't have any player graphics it's irrelevant, because we can see the collision box of the player, but that way we won't forget it later and won't have to hunt for a mistake for nights on end.

Furthermore I have activated "Map Collisions", which has no effect at the moment, but will be an eye opener soon.

I have also checked the "Physics" box, which will make sure that the player is subject to gravity. That's pretty cool for a jump'n run.

The last change I made was to change the size of the player to 32x32 pixels using "Width" and "Height". A 16x16 pixel per tile map can easily handle such a big player and at my age I don't like to go looking for the tiny player in the map.

If you have now made all the changes as shown above, you can click on "OK" and then on "Play". If you have followed all the steps from this chapter, a rectangle should fall through your map and the camera should follow this poor devil well.

For a game, this is still quite skinny ... but let's look at the next chapter to see how we can stop the eternally falling one to keep him on the ground of facts ... respectively the map... respectively the map.

last update: 2022-05-16 -- v0.5.1