Introduction to the Game Engine Making a Simple Ball Game

The best way to learn how to use tools is to make something. These tutorials show how to make a simple ball game using the Blender game engine.

The game consists of a ball resting on a plane, by pressing the arrow keys the plane rotates and the ball rolls. The object of the game is to roll the ball into holes made in the plane.

Introduction to the Game Engine Making a Simple Ball Game (First Video Tutorial)

The key points of this tutorial are -

  • how to change to the game logic layout
  • how to change to the game engine renderer
  • how to create logic bricks – sensors, controllers and actuators
  • how to set physics properties for the objects used in the game

In detail -

  • The movement of plane is set up in the logic editor window, setting up keyboard sensors and linking them to motion actuators (sensing events and linking to event handling routines).
  • The sphere is added to the scene and its physics property is set to rigid body.

Click here to download the file without logic bricks rotatingPlane3.blend, click here to download the file with just the motion logic bricks rotatingPlaneTut1.blend and click here to download the final file with score and timer rotatingPlaneTutFinal.blend

Introduction to the Game Engine Developing a Simple Ball Game by Adding a Score

The second tutorial shows how to develop the simple ball game by adding a score

Key Points -

  • How to make an object behave as a proximity sensor to detect if the ball goes through a hole.
  • How to make an object broadcast a message.
  • How to make an object listen for a message.
  • How to create a property for an object.
  • How to create an actuator to update a property.
  • How to create an actuator to restart a scene.

In Detail -

  • An object is created (cylinder) and a ‘near’ sensor logic brick is added to it. When any object (the ball) gets within a specified distance to the object a signal is sent. The signal causes a message actuator to send a message and a scene actuator to restart.
  • Another object is added (an empty) to listen for the message and when received, it sends a signal to a property actuator that updates the score.

Introduction to the Game Engine Developing a Simple Ball Game by Adding a Timer

The third tutorial shows how to develop the simple ball game adding a timer.

Key points -

  • How to set up an ‘always’ sensor to continuously send a pulse signal.
  • How to use the pulse signal to update a timer property by the correct amount.
  • How to use an ‘expression’ controller to filter the signal until a condition is met.
  • How to restart a game after a given time.

In detail -

  • The ‘empty’ object which is used to update the score is also used to update a timer property, the property is added to the object.
  • An ‘always’ logic brick is added. The always will send a signal every frame, 60 frames per second. The signal passes through an AND controller to a ‘property’ actuator. The actuator adds one sixtieth of a second to the timer property.
  • To make the game end after a given time (18 sec) an ‘expression’ controller is added. This will not allow a signal to pass through until an expression is true i.e. timer is greater than 18. The controller is connected to a ‘scene’ actuator that restarts the scene.
Share

Leave a Reply