Part 4: Your first rule

Steps 13 to 17. Open the Events tab and write a rule: when the ball hits a brick, smash the brick and bounce the ball.

Chocobreak — NutHouse
The condition picker with the Ball chosen, showing tests like Collides with another object
First click the thing to test, then choose the test.

What this part teaches

This is the heart of NutHouse. A rule has two halves. The when half is a condition: something NutHouse watches for. The do half is one or more actions: what happens. One row in the Events tab is one rule.

WhenBall collides with Brick
DoDestroy BrickBounce Ball

The card is red because this rule happens once, at the moment the ball first touches a brick. And only the brick that was touched gets destroyed, not all forty.

Step 13: Rules make the game

Objects only do clever things when you give them rules, called events: “when this happens, do that”. Click the Events tab.

Step 14: When the ball hits a brick…

  1. Press + New event. The picker asks “Which thing do you want to test? Click it.”
  2. Click the Ball.
  3. Click Collides with another object.
  4. Pick the Brick and press Add.
Collides with another object

Step 15: …smash the brick

Now the do half. The columns along the top are the things that can do something. Find the Brick picture. In your new row, click the empty cell under it and choose Destroy.

Destroy

Step 16: …and bounce the ball

In the same row, click the cell under the Ball and choose Bounce. A rule can have as many actions as you like.

Bounce

Step 17: Test your first rule

Press ▶ Play level. The ball smashes a brick and bounces away. It still goes through the paddle, and that is the next part. Press Esc.

Reading the row

Red chip on the leftThe condition. Red means “happens once, at a moment”.
✓ under BrickBrick does something: Destroy.
✓ under BallBall does something: Bounce.

Next: Part 5: Bouncing and the edges.

Still stuck?

Try the Chocobreak tutorial, open a sample game and read its rules, or look at the questions people ask.