Smart Technology - Lesson04
Form 3 - ECA
2023-2024
Floor 4 - Computer Room
Mr. Peter
Outline
Outline
Game rules description
1
Game development - Ex03_1
2
Game development - Ex03_2
3
Game development - Ex03_3
4
Let's learn Microbit
Game development - Ex03_1
Declare x and y variables for storing the moving LED coordinate
1
Moving the LED by trigging events
Plot the LED at the beginning of the game
2
Unplot the original position LED
3
Update X and Y axis
4
Plot the new LED position
5
6
Listening to different action events
Game development - Ex03_1
name it as 01_YourName_Ex03_1.hex
Download it
Game development - Ex03_2
Test and understand the number range of acceleration.
Game development - Ex03_2
Moving the LED by determining the acceleration.
Check if the acceleration X of the Microbit is greater / Less then 200
1
Check if the acceleration Y of the Microbit is greater / Less then 200
2
Control the LED depends on the value of acceleration
3
Pause 100 ~ 300ms to avoid the LED moving so fast.
4
Game development - Ex03_2
Adding more conditions to prevent the LED moving out of border
5
Game development - Ex03_2
name it as 01_YourName_Ex03_2.hex
Download it
Adding food in the game
Random the coordinate of food from 0 ~ 4
2
Plot the food LED
3
Game development - Ex03_3
Declare x and y variables for storing the food coordinates on start
1
Generate food again if food is eaten
Check if the coordinate of food is same as the moving LED
2
Pause 2 seconds for generating new food
3
Plot the new food LED
4
Game development - Ex03_3
Create a new forever block
1
Generate food again if food is eaten
Check if the coordinate of food is same as the moving LED
2
Pause 2 seconds for generating new food
3
Plot the new food LED
4
Game development - Ex03_3
Create a new forever block
1
Game development - Ex03_3
name it as 01_YourName_Ex03_3.hex
Download it
Game development - Ex03_3
Smart Technology - Lesson04
By Mr Peter
Smart Technology - Lesson04
- 236