Robotics Enrichment Program
Middle School “Robot + Game = ?” Majors Schedule
What happens when robots and games collide? In Robot + Game = ?, you’ll step into the role of a robotics engineer and game developer, using a game engine to bring intelligent machines to life in virtual worlds. Design and simulate autonomous robots - like drones that navigate through dynamic environments, avoiding obstacles in real time. Through hands-on projects, you’ll integrate LiDAR-based sensing and learning algorithms to develop robotic behavior.
Learning Outcomes:
- Ability to use a game engine-based simulation to create and test robotic systems.
- Problem-solving and teamwork through iterative development and testing.
Session 2
Goal: Create a simple robot game where a robot character navigates a world, senses obstacles, collects goals, and has sound + music.
1. Create Your Robot Character
- Go to MakeCode Arcade.
- Click New Project, name it.
- From the Sprites category, drag out
set mySprite to sprite of kind Player
. - Click on the sprite image to draw your own robot character.
- Run the game to see your robot appear.
2. Build a Scene
- From Scene, drag out a
set tilemap to
block. - Create a map with walls (e.g., maze or obstacle area).
- Add a starting area and some open space for the robot to move.
3. Add Autonomous Movement
- From Sprites, drag
set mySprite vx to
andset mySprite vy to
. - Give your robot an automatic velocity (e.g., vx = 50, vy = 0).
- Run the game — your robot should move on its own.
4. Simulate Sensing (Bumpers)
- From Sprites, use
on sprite of kind Player hits wall
. - Inside, change the velocity so the robot turns (e.g., vx = 0, vy = 50).
- Test it — your robot should bounce or turn when it “senses” a wall.
5. Add a Goal
- Create another sprite (goal, treasure, or object).
- Place it on a random tile: use Scene → place sprite on top of random tile.
- Add an overlap event:
on sprite of kind Player overlaps Goal
. - Inside, increase score by 1 and move the goal to a new random spot.
6. Add Music and Sound
- From Music, add
play melody
at the start of the game for background music. - Add a
play sound effect
inside the overlap event (when robot gets a goal). - Test - you should hear music and effects.
7. Make It a Game
- From Info, add a timer (e.g., 30 seconds).
- Challenge: How many goals can your robot collect before time runs out?
- Optional: Add hazards (enemies) that reduce score when touched.
Session 1
- Introduction to Robotics
- Virtual Robot Movements
- File -> Open Examples, select
Drivetrain Moves and Turns
- Study the code blocks, run the example
- SELECT PLAYGROUND -> Wall Maze
- Modify the code to make it to the finish
- Save (Ctrl + S) your program
- File -> Open Examples, select
- Object Sensing
- Open a new project
- File -> Open Examples -> Coral Reef Cleanup 3
- Test the example code
- Improve it