Creating the Tilt Game with Blender 2.49b Create a tilting platform. Start a new blend. Delete the default cube right click to select then press X and choose Erase Selected Object. Switch to Top view (NUM 7). Press SPACE and add a cube. Scale it larger on x and y axes to create a platform. Also make the cube thinner on the z axis. Open the Shading Buttons (F5). In the Links and Pipelines panel select Add New. This adds the default grey material to the platform. Select the camera by right-clicking it. Press G and move the camera so that the platform can be seen in the viewport. Press the LMB to place the camera. Press NUM 0 to view from the camera and ensure it looks like the diagram below. Adding the hole. Switch to Top view (NUM 7). Add a cylinder (SPACE) and scale the cylinder s size up to make it a little larger. Press S and move the mouse to scale. Click LMB to finish.
Position the cylinder so that it is between the centre of the platform and a corner. Also position it on the Z axis ensuring that it sits halfway through the platform. We will use the cylinder to cut a hole in the platform. Select the platform, the SHIFT-select the cylinder. Press W to open the Boolean Tools and choose Difference. Now press X and erase the selected object. This leaves behind a platform with a hole in it. Right click to select, then press N and rename the Cube to platform1. Open the Logic Buttons F4 (Pacman icon). Add a sensor, controller and actuator and link them together. Change the sensor from Always to Keyboard and assign the UP Arrow key. Ensure the actuator is a MOTION actuator and set the Rotation on the X axis to -0.02. Repeat for the DOWN arrow key, but set the Rotation on X Axiz to 0.02. Create sensors, controllers and actuators for the LEFT and RIGHT arrow keys, and set them to Rotate on the Y axis. Test the game (move the mouse pointer over viewport and press P). You should be able to tilt the platform. Esc to exit. Add the ball. In Top view (NUM 7) add a UVsphere by pressing SPACE. Make sure the sphere is small enough to fit through the hole. If you need to scale the sphere, then press S and move the mouse. Open the Shading Buttons (F5). In the Links and Pipelines panel select Add New. This adds the default grey material to the ball. Using multiple views, move the sphere so it is above the centre of the platform. Select the sphere (right click) and open the Logic Buttons (F4 or Pacman icon).
Change the sphere s type from Static to Rigid Body and set the Bounds to sphere. Also, press the Add Property button and set the name to ball. Now when you test the game (P) the ball will fall onto the platform and when you tilt the platform the ball will react in a realistic manner. With practice you should be able to guide the ball into the hole. Adding a light and shadow. In Top view, add a lamp by pressing SPACE and choosing Lamp-Spot. Using multiple views, move the lamp so that it is above the centre of the platform, looking down on it. To turn the shadows and lighting on in the Game Engine, go to the main menu at the top of the screen and choose Game Blender GLSL Materials. In the same menu ensure that all GLSL Material Settings are switched on. Some computers will warn you if your graphics card does not support GLSL settings. If this is the case then unfortunately the lighting and shadows won t work. Select the spot lamp (RMB) and change to the Shading (F5) / Lamp buttons. Under the Shadow and Spot menu ensure that Buf. Shadow is selected and Bias is set to 0.1. At the bottom of the main viewport, set the Draw Type to Textured.
You should now be able to see the light and shadow effect. Also, when you test the game (P), you should see realtime lighting and shadows. The realtime shadows help you to determine where the sphere is positioned in 3D space. Next we need to create an object beneath the hole that can be used to detect the ball falling through. In Top View, press SPACE and add a Plane. Position the plane so that it is just below the hole in the platform and large enough so that the ball will hit the plane if it falls through the hole. Select the plane and then SHIFT select the platform. Press Ctrl-P and choose Make Parent. This makes the plane a child-object of the platform. When the platform moves, so will the plane. Select the plane, open the Logic Buttons (F4, Pacman icon). Add a sensor, controller and actuator, and link them together. Set the sensor to Collision and set the property to ball. Remember we set this property up earlier when making the sphere. Set the Actuator to Scene / Restart. Now, when the ball hits the plane, the game restarts. Ideally this would cause the game to go onto the next level, but we need to finish this level first before making the next. You can also make the plane invisible by toggling the Invisible button under the Logic Panel. What if the ball falls off? If the ball falls off the platform, then nothing happens. We need to restart the level if the ball falls off the platform. Add a large plane beneath the platform that will catch the ball. Add a sensor, controller and actuator, and set these up exactly as we did with the previous plane, but DO NOT Parent it to the platform. Now that we have a playable game, test it to ensure there aren t any bugs. Can you think of any flaws in the game? Flaws You can turn the platform upside down. You could flip the ball up and catch it on the plane beneath the hole without the ball falling through. You might be able to flip the ball so that it doesn t hit the large plane beneath. Ending the level Next we will add a Well Done message that appears after successfully completing the level.
Add a new empty scene by selecting ADD SCENE from the menu at the top of the screen, and choosing Empty. In top view, add a camera, which should be facing directly downwards. Add a plane beneath the camera to form the background of our message screen. Make sure the plane fills the view from the camera. Add the default material to the plane. Add a normal lamp to the scene above the plane and camera. Add a text object and place it between the camera and the background plane. Select the text, then go into editing Mode (TAB). Delete the default text and replace it with the words Well Done!. TAB back into Object Mode and ensure the text is selected. Press Alt-C and choose Convert Font to Mesh. Now add a material to the text mesh to ensure it stands out against the background. Finally, go back the first scene, select the plane beneath the hole and in the Logic Panel, change the Actuator from restart to Set Scene. Type the name of the second scene where it says SCE: Test the game and when you get the ball in the hole, it should display the Well Done! Message.