Friday, July 18, 2008

Step 3 - A Room with a view

Ok in this post we will setup the room with the player and the boundaries. We will also add a few HUD elements as well. And what I mean by hud elements are actors the provide us with game information, like scoreboard.

  1. Select Scenes and then main.
  2. You should be seeing the really awesome dungeon background we selected last time. If not redo the last step.
  3. Select the boundary actor in the left menu bar and click on the dungeon scene.
  4. Click the snapping icon to make sure it is NOT highlighted. You do not want snapping enabled when setting up boundaries.
  5. We are going to use this boundary to stop the actor from falling off the left side of the screen. Now resize the boundary to be as tall as the scene and only 10 pixels wide. Just click on the square on the corners of the icon and drag to resize.
  6. Once resized move (click its center, hold down the mouse and drag) the actor to the left edge of the scene were you can barely see it and leave it there. There's boundary number one. Now repeat for the right side and the top side. The bottom side is special so we'll do that next. Hint, the resize controls are a bit buggy, sometime I have to use the top square to resize and sometimes the buttom, just try either until you resize it properly.
  7. The bottom boundary is special because it will also be the background for our HUD. So add one to the scene, make it as wide as the scene but this time make it 50 pixels in height. And place it at the bottom of the scene were all 50 pixels are visible.

Great! The boundaries are all done. Now let's drop in our player and test the scene.

  1. In the main scene, select Behaviours and in the sub menu select Appear.
  2. Select the Player actor and set it's offset relative to scene with X:500 and Y:600. That should do it.
  3. Now close the scene and test the game. Click "Play"
  4. You should be able to move around the scene without leaving it. If you can move through the boundaries then you for got to make that actor solid, so click the boundary actor and make it solid.

Great it's loooking like a game now. But wait, something seems wrong, the player is moving annoyingly slow. What's up? Well let's just say its physics. So to fix the speed, select Actors->Player->Behavior->MoveLeft->Motion->MaxSpeed. Set this value to 200. I think that feels better. Now set the speed for MoveRight, MoveUp and MoveDown. Note: when editing Motion, you can immediately test out your changes by clicking on the preview button.

We're almost done, let's add a scoreboard actor to enhance the hud.

  1. Click Actors->Search->Controls->Score Display Typewriter. That should do for this game as the font has a gothic look to it.
  2. Now rename the actor to scoreboard.
  3. Click Scene->Main and then click the scoreboard actor.
  4. Resize the scoreboard to fit nicely on the hud.
  5. I placed mine on the bottom right corner of the screen, ON the HUD.

Well that it for now. Next time we do fun stuff, like collect treasure and poke around with the HUD.

No comments: