Lesson 5.3
          < Previous Page  
Next Page >

Refining the Game

This will be a relatively short section devoted to improving the control of object_player. In playing the game you may have noticed that it is possible for the player's character to get 'stuck' in certain parts of the game. It can also sometimes be difficult to get into the exactly the right position to move up a corridor or into an alcove in the maze.

Now you may like this 'feature' and you might want to leave it in the game to make it slightly more difficult. Usually the player's character can be moved into the right position by moving away and coming back to the opening. However, if you don't like this feature, this section will show you how you can prevent it from happening.

You need to add an action called Check Grid in front of the Moved Fixed actions in each of the Left, Right, Up and Down events. This will make sure that object_player is aligned exactly to the grid before allowing the next Moved Fixed action to take place. In this way the player can only move in whole grid units, which for this game is 32 pixels at a time. Follow these steps to set this up:

Double-click on object_player in the Resources Explorer window to open the Object Properties form. Click the object's <Left> event to show the Move Fixed action.

Drag the Check Grid action from the control tab into the Actions panel. Enter a value of 32 into both the snap hor and snap vert fields on the Check Grid form which pops up as shown on the right.

Finally, if necessary drag the Check Grid action so that it above the Moved Fixed action in the Actions panel.

Click OK to finish.

You need to repeat this procedure for the other three directions of <Up>, <Right> and <Down>.

Now when you test your player's movement it should no longer get stuck in between blocks in any position. However, it is now moving a little quicker than before.

Slowing the player down

If you feel the player's character moves too quickly and this makes the game too easy (or in some cases too difficult), it can be slowed down simply by editing the speed value in object_player.

Double-click on object_player in the Resources Explorer window to open its Objective Properties form. To change the player's speed you'll need to edit the Moved Fixed actions in each of the Left, Right, Up and Down events. At the moment they are all set to 8 - try changing them to 6 and test the game to see how this affects the gameplay.

A word of warning though - having just set the Check Grid action up in the previous step, it is possible to make the speed too slow and the player will get stuck in some positions and will not be able to move at all. If this happens to your player, simply increase the speed again or don't use the Check Grid action.

That's all the refinements we'll do for now, but I'm sure that there's plenty of other things that can be improved.

Postscript: After trying the above procedure to slow the player down I found that object_player would stick using any value below 8 as it was indicated may happen. Therefore I decided to leave the player speed set to 8 for this game. The other option was not to use the Check Grid action and then I could set the player speed at any value, but this sometimes makes the game awkward for the reasons given above. Another possibility is to use the Check Grid with a value of 16 X 16 instead of 32 x 32, and then reduce the player's speed, but I haven't tested this yet. Why don't you?

< Previous Page
             
Next Page >