What to say when you meet someone
A GUI, Diamonds, Money, and Energy
My Last Day at the University
Enjoying the Sun
A GUI, Diamonds, Money, and Energy
After I haven't done anything with Rock'n'Roll for a long time, I just recently thought that it might be a good idea to continue and so I implemented quite a few things. First, I designed a pretty simple GUI for in-game display. It's a semi-transparent panel showing the current score of the player, the energy left and how much money the player collected (furthermore, the frames per second are also displayed, but I am pretty sure that I will remove this info in the final version). On the right hand side of the panel, the player can see how many keys of which color she already found. For now, this is a sufficiently verbose GUI, in the future, however, it will have to be extended: Which extra is currently selected? Is an extra active? How long will it be active? Furthermore, a possible time limit for a level has to be displayed and thus, the time that has passed since the player started the level... Well, I'll do that later...What else did I do? Well, in order to display any score, the player must be allowed to collect some points. Thus, there now are diamonds in several colors. If they are collected, the player gets points (depending on the color of the diamond). Also, since I have an energy bar in the GUI, it has to be affected somehow. Thus, whenever the ball is caught in a closing door, its energy is reduced. If the energy drops to 0, the player loses one of his lives. Furthermore, now there are different colored doors and keys and a door in color x can only be opened by a key in color x. After using the key, it is removed from the player's inventory. So, the player has to carefully plan which door to open with which key... Finally, I have added horizontally sliding doors, which wasn't difficult, but which made me rework (some of) the graphics. So now, there's a huge (3x3 tiles) start tile like in the original Rock'n'Roll. On the new start tile, there's an effect region which will push the player away from its center, so that it appears as if the player is rolling uphill if she tries to climb the start tile. I have also changed the end tile of a level, which now resembles a hole.
From a technical point of view, I have struggled with my favorite issue: Collision detection. I (finally!!) seem to have been able to conquer it! The ball can no longer get stuck anywhere. The idea I had some time ago that the ball getting stuck was due to its too low speed was correct, it turned out. At first, however, I tried to overcome this problem by introducting a minimal speed when the ball hits anything. This didn't accomplish anything, though, because floating point arithmetic still allows the ball to be at a distance smaller than 1 pixel after the collision (i.e. the ball has then a distance of 0 pixel and touches the object again -- it gets stuck). But, the problem could be solved by introducing a minimal distance to the object after it had been hit: After the collision, I ensure that there's at least one pixel between the ball's new position and the object (more distance if ithe ball hit at higher speed). And lo and behold: I did not succeed in getting the ball stuck anymore!! Yayyy!
By the way: A decent level editor for Rock'n'Roll still does not exist. Granted, I did start to write a very flexible editor for 2D computer games and I can also make some levels for Rock'n'Roll with it, but it's still a long way from being completed and editing a level is still very difficult (and yet: it's a better solution than the text-editor).
My next steps will (probably) be:
- Draw animations for the coins in the game. For now, they're just test graphics made of strokes.
- model items with a price: the level designer will be able to assign a price to an item (extra) and when the player rolls over that item and has enough money, it will be bought.
- design functions for those items. For example, the player could buy spikes, which make it easier to roll over ice, bombs to destroy weaknesses in walls, etc...
- brainstorming for more elements. I am sure that I want to have levers, but I'm not sure what else... Let's see what I can come up with.
- Finally release a demo version
- Imrpove my level-loading routine. It's based on a visitor pattern (see here) to determine which tile is to be loaded. This seems to be overkill and there are easier and faster solutions, I suppose.
On the left picture, you can see the new start tile, the right picture shows the new end tile and (if you click on it) on the left side, there are the test graphics for the coins (currently black strokes).