Smart Technology - Codemao

Form 3 - ECA

2024-2025

Floor 4 - Computer Room

Mr. Peter

Outline

Outline

1

Ex05_1 - Meteorites

2

Ex05_2 - Heart Heart

3

Ex05_3 - Arrow and bomb

4

Ex05_4 - Cat and arrow

Codemao Platform

Change language

Change to English

Ex05_1 - Arrow and bomb

Tasks:

Keep emitting arrows

1.

Keep cloning bombs

2.

Setup the scene

1.

Insert the background

2.

4.

Hide the bomb icon

3.

Import bomb.bcmp4

Ex05_1 - Arrow and bomb

1.

When game starts, forever face to the mouse pointer

Code Blocks

Arrow

2.

When game starts, forever to clone itself every 0.2 second

3.

When the character is cloned, forever to move

Clone a character itself

Let a character moving

Define a clone actions after character is clone.

Wait for 0.2 second

Face to mouse Pointer

Ex05_1 - Arrow and bomb

1.

Code Blocks

Bomb

2.

When game starts, forever to clone itself every 0.2 second

2.1.

When the character is cloned

Clone a character itself

Define a clone actions after character is clone.

Wait for 0.2 second

Go to a random position

2.2.

Forever to check if itself touches the Arrow

2.2.1.

Switch to explosion costume if touched

2.2.2.

Fade out during 1 second

Check if the character touches another

Fade out the character

Go to a random position

Swtich costume

Ex05_1 - Arrow and bomb

1.

Code Blocks

Bomb

2.

When game starts, forever to clone itself every 0.2 second

2.1.

When the character is cloned

Clone a character itself

Define a clone actions after character is clone.

Wait for 0.2 second

Go to a random position

2.2.

Forever to check if itself touches the Arrow

2.2.1.

Switch to explosion costume if touched

2.2.2.

Fade out during 1 second

Check if the character touches another

Fade out the character

Go to a random position

Swtich costume

Ex05_1 - Arrow and bomb

Download your program and name it as 01_YourName_Ex05_1.bcm4

Ex05_1 - Arrow and bomb

Ex05_2 - Heart Heart

Tasks:

Press Space key to clone heart icon

1.

Explore if icons are touched each other

2.

Setup the scene

1.

Insert the background

2.

3.

Hide the heart icon

Ex05_2 - Heart Heart

1.

Add a event to listen if Space key is released

Code Blocks

Space key event listener

Heart

2.

Create clone of myself if Space key is released

3.

When the character is cloned

Ex05_2 - Heart Heart

3.1.

Go to a random position

3.2.

Face to a random angle

3.3.

Forever to move and check if on edge then bounce

3.4.

Forever to check if itself touches any heart

3.4.1.

Switch custume to heart after touched

3.4.1.

Explosion effect

Clone a character itself

Bounce a different direction if move over edge of the screen

Let a character moving

Check once if the character itself touches another character

Define a clone actions after character is clone.

Switch costume

Go to a random position

Face to a random direction

Gradually scaling and transparent effect

1.

Add a event to listen if Space key is released

Code Blocks

Space key event listener

Heart

2.

Create clone of myself if Space key is released

3.

When the character is cloned

Ex05_2 - Heart Heart

3.1.

Go to a random position

3.2.

Face to a random angle

3.3.

Forever to move and check if on edge then bounce

3.4.

Forever to check if itself touches any heart

3.4.1.

Switch custume to heart after touched

3.4.1.

Explosion effect

Clone a character itself

Bounce a different direction if move over edge of the screen

Let a character moving

Check once if the character itself touches another character

Define a clone actions after character is clone.

Switch costume

Go to a random position

Face to a random direction

Gradually scaling and transparent effect

Download your program and name it as 01_YourName_Ex05_2.bcm4

Ex05_2 - Heart Heart

Ex05_3 - Meteorites

Tasks:

Control the character by clicking mouse.

1.

Meteorites are in constant motion, moving either from left to right or from right to left.

2.

Display icon if game is ended.

3.

Star icon is used to increase the speed of meteorites and character.

3.

Setup the scene

1.

Insert the background

2.

3.

Import lose.bcmp4

4.

5.

Import star.bcmp4

6.

Hide you-win and lose icons

Ex05_3 - Meteorites

1.

Forever to rotate the meteorites and rotate 1 degree in each loop.

Control meteorites

2.

Forever to move from left to right and right to left, and set 1 second for each movement. From (-270, -200) to (270, -200).

3.

Forever to check if the meteorites touch the Ginger, if then:

Switch costume to "explosion"

Make "lose" image to show

Stop the game

1.1.

1.2.

1.3.

Code Blocks

Go to a specific position from the current position

Rotating current character in 1 degree

Check if myself touches Ginger

Switch to another costume

Show some charater that was hidden

Stop the game

Ex05_3 - Meteorites

1.

Forever to rotate the meteorites and rotate 1 degree in each loop.

Control meteorites

2.

Forever to move from left to right and right to left, and set 1 second for each movement. From (-270, -200) to (270, -200).

3.

Forever to check if the meteorites touch the Ginger, if then:

Switch costume to "explosion"

Make "lose" image to show

Stop the game

1.1.

1.2.

1.3.

Code Blocks

Go to a specific position from the current position

Rotating current character in 1 degree

Check if myself touches Ginger

Switch to another costume

Show some charater that was hidden

Stop the game

Ex05_3 - Meteorites

1.

Forever to changing the costume when game started.

Code Blocks

Keep changing the character's costume

Control the character

2.

Add an event that listens for the background to be clicked, then increments the character's y-axis by 300 in 0.5 seconds

3.

Forever to check if the character left the screen edge, then show the you-win icon

Check if the character left the edge of the screen

Click event

Increase the Y axis of character

Show icon

Ex05_3 - Meteorites

1.

Forever to changing the costume when game started.

Code Blocks

Keep changing the character's costume

Control the character

2.

Add an event that listens for the background to be clicked, then increments the character's y-axis by 300 in 0.5 seconds

3.

Forever to check if the character left the screen edge, then show the you-win icon

Check if the character left the edge of the screen

Click event

Increase the Y axis of character

Show icon

Ex05_3 - Meteorites

Location:

X: -270, Y: -200

Moving from right to left:

X: 270, Y: -200
X: -270, Y: -200

Location:

X: -270, Y: 400

Moving from right to left:

X: 270, Y: 400
X: -270, Y: 400

Location:

X: 270, Y: 100

Moving from left to right:

X: -270, Y: 100
X: 270, Y: 100

Ex05_3 - Meteorites

If the Meteorites code is done, we can right click the character and duplicate it.

Code Blocks

Control the speed

1.

Create a variable called speed

2.

Click the star icon to increase the speed of meteorite and character

3.

To control the speed of meteorites, we can control the movement speed of the glide code block.

Ex05_3 - Meteorites

Download your program and name it as 01_YourName_Ex05_3.bcm4

Ex05_3 - Meteorites

Ex05_4 - Cat and Arrow

Task

1.

Cat following the cursor and jump

2.

Arrows emit from four edges

3.

Explosion and stop the game if Arrow touches the cat

Setup the scene

1.

Insert the background

2.

Import Arrow

3.

Hide arrow

4.

Set the landscape

Ex05_4 - Cat and Arrow

5.

Set Left-Right of the cat

1.

Forever face to the mouse pointer and track it.

Code Blocks

Jumping

Cat

Ex05_4 - Cat and Arrow

2.

Forever jumping

Tracking

1.

Forever to clone a arrow in every second

Arrow

Ex05_4 - Cat and Arrow

2.

When a arrow is clone:

2.1.

Create a variable called "direction" to store a random number from 0 to 3.

"direction" variable is to represent which edge side arrow is going to emit from.

2.2.

Use if condition to check the random number

-

0 represents emit from top edge of screen

-

1 represents emit from bottom edge of screen

-

2 represents emit from left edge of screen

-

3 represents emit from right edge of screen

-

2.3.

Face to the cat

2.4.

Emit the arrow and keep to check if the arrow touches the cat

Set to sprite, because other characters no need to use this variable

1.

Forever to clone a arrow in every second

Arrow

Ex05_4 - Cat and Arrow

2.

When a arrow is clone:

2.1.

Create a variable called "direction" to store a random number from 0 to 3.

"direction" variable is to represent which edge side arrow is going to emit from.

2.2.

Use if condition to check the random number

-

0 represents emit from top edge of screen

-

1 represents emit from bottom edge of screen

-

2 represents emit from left edge of screen

-

3 represents emit from right edge of screen

-

2.3.

Face to the cat

2.4.

Emit the arrow and keep to check if the arrow touches the cat

1.

Forever to clone a arrow in every second

Arrow

Ex05_4 - Cat and Arrow

2.

When a arrow is clone:

2.1.

Create a variable called "direction" to store a random number from 0 to 3.

"direction" variable is to represent which edge side arrow is going to emit from.

2.2.

Use if condition to check the random number

-

0 represents emit from top edge of screen

-

1 represents emit from bottom edge of screen

-

2 represents emit from left edge of screen

-

3 represents emit from right edge of screen

-

2.3.

Face to the cat

2.4.

Emit the arrow and keep to check if the arrow touches the cat

Download your program and name it as 01_YourName_Ex05_4.bcm4

Ex05_4 - Cat and Arrow