Play a Game!

 

Open the simplified Catch A clown game here. Play the game for a while.

Events and Actions

In gaming, the “cause” is called an Event and the “effect” is called an Action. 

During gameplay, certain Events will happen and cause specific Actions to take place

eg.: If Player collides with enemy, then 1 Life is lost

Event: ball collides with wall
Action:bounce

Q4 What events are used in the clown game?
Q5 What actions are used in the clown game?

Clue!

Possible events are: Create, Mouse event (L click, right click etc), Destroy, Draw, Collision, and many others!

Possible actions are: Bounce, jump, start moving in a random direction, play a sound, add a number to a score, jump to a new random position, add a life and many many more!

Conditional Statements: , If, Then

If...then

You may already be familiar with conditional statements from Maths or Science classes, such as    If x=3, then x+4=7    or if salt is added to water, then the salt will dissolve. Conditinal statements can relate to your daily activities, such as how you get from bed to school:   . If the alarm goes of at six, then I get out of bed.. If mom makes breakfast, then I sit down and eat it. . If I miss the bus, then I must walk to school.

Some conditional statements used in the ball game:

  • If the clown is created, then start moving in any direction
  • If the clown collides with wall, then bounce.
  • If the clown is clicked with left mouse button, then points increase.

Q6. Complete the list below of the 8 conditional statements used in the clown game.

IF clown is created   ,THEN move
object 1 Event   Action
           
IF clown is created   ,THEN ?
object 1 Event   Action
           
IF clown Collides with Wall ,THEN Bounce
object 1 Event object 2 Action
           
IF clown Collides with Wall ,THEN ?
object 1 Event object 2 Action
           
IF clown Left mouse Pressed   ,THEN add 10 to score
object 1 Event   Action
           
IF clown Left mouse Pressed   ,THEN play click sound
object 1 Event   Action
           
IF clown ?   ,THEN Jump to random position
object 1 Event   Action
           
IF clown ?   ,THEN ?
object 1 Event   Action
           

Possible events are: Create, Mouse event (L click, right click etc), Destroy, Draw, Collision, and many others!

Possible actions are: Bounce, jump, start moving in a random direction, play a sound, add a number to a score, jump to a new random position, add a life and many many more!

 

Conditional Statements: ,Else

Else can be part of a conditional statement and is an alternative to the condition.  It does not necessarily mean opposite, as you may assume.  Else is an alternate to the condition, not just an opposite.

If the alarm goes of at six, then I get out of bed, else I stay in bed..
If mom makes breakfast, then I sit down and eat it, else I starve until lunch. .
If I miss the bus, then I must walk to school, else I get to ride the bus to school.

 

See here for a detailed description of conditional statements.

Move onto making your first game (catch a clown) here

or try the ball game from TexasGames.net here