Catch The Egg Game Lesson - MakeCode

Skip to main content Microsoft Microsoft MakeCode About FAQ Projects GitHub Support Courses CS Intro About Introduction References Acknowledgements Making Introduction Unplugged Walkthrough Project Standards Algorithms Overview Unplugged Activity Project Standards Variables Overview Unplugged Activity Project Standards Conditionals Overview Unplugged Activity Project Standards Iteration Overview Unplugged Activity Project Standards Mini-project Review Activity Project Standards Coordinates Overview Unplugged Activity Project Standards Booleans Overview Unplugged Activity Project Standards Binary Overview Unplugged Activity Project Standards Radio Overview Unplugged Activity Project Standards Arrays Overview Unplugged Activity Project Standards Final Project Review Project Examples Standards Blocks to JavaScript Hello JavaScript Starter Blocks Writing Code Conditional Loops Writing Functions Science experiments Data collection Overview Setup and procedure Resources Population Traits Overview Setup and procedure Resources Temperature Overview Setup and procedure Resources Soil Moisture Overview Setup and procedure Resources Gravity, Motion and Waves Overview Setup and procedure Resources Body Electrical and Waves Overview Setup and procedure Resources Electricity Overview Setup and procedure Resources Rocket Acceleration Overview Build Setup and procedure Resources Logic Lab Logic and Expressions Boolean Elements Logic Explorer Logic Gates Programmable Logic Reference Basic show number show icon show leds show string clear screen forever pause show arrow Input on button pressed on gesture on pin pressed button is pressed compass heading pin is pressed temperature acceleration light level rotation magnetic force running time set accelerometer range Music play tone ring tone rest beat tempo change tempo by set tempo Led plot unplot point toggle brightness set brightness stop animation plot bar graph enable Radio send number send value send string on received number on received string on received buffer received packet set group set transmit power set transmit serial number on data packet received write received packet to serial Game create sprite delete move turn if on edge bounce get set change is touching is touching edge add score score set score set life add life remove life start countdown game over pause resume Images create image create big image show image scroll image arrow image icon image arrow number Pins digital read pin digital write pin analog read pin analog write pin analog set period map on pulsed pulse duration pulse in servo write pin servo set pulse i2c read number i2c write number set pull analog pitch analog set pitch pin spi write spi Pins spi format spi frequency Serial write line write number write value write string read until read line read string on data received redirect redirect to usb set baud rate set write line padding write buffer read buffer Control in background reset wait micros on event raise event event timestamp event value Bluetooth About Pairing on bluetooth connected on bluetooth disconnected start accelerometer service start button service start io pin service start led service start magnetometer service start temperature service start uart service uart read until uart write string uart write number uart write value advertise url stop advertising advertise uid advertise-uid-buffer Extensions Blocks On Start Loops repeat for while for of Logic if Boolean Variables assign change var var Math JavaScript blocks Custom blocks Python Calling Sequencing Variables Operators Statements Functions Classes JavaScript Calling Sequencing Variables Operators Statements Functions Types Classes Interfaces Generics Types Number String Boolean Array Function Buffer Using buffers Number format Blocks Gallery Miscellaneous About Support Translate Sharing projects Offline support Save Sign In Cloud Sync Home Page Content Hardware Data Analysis Plotting with LEDs Viewing Data Writing Data Generating Data Analyzing Data Remote Data Error codes Foil circuits Incompatible Hardware MES events Pins Reactive Screen Serial Servo Simulator USB WebUSB WebUSB Troubleshoot Flashing via HID (CMSIS-DAP) Developers Command Line Interface Visual Studio Code support Blocks Embed Projects Flashing Heart Smiley Buttons Love Meter Rock Paper Scissors Magic Button Trick Coin Flipper Salute! Hack Your Headphones Banana Keyboard Guitar Duct Tape Wallet Watch Soil Moisture Plant Watering Reaction Time States of Matter Mood Radio Tele-Potato Hot or Cold Voting Machine Infection Fireflies Rock Paper Scissors Teams Inchworm Milk Carton Robot Milk Monster RC Car Timing Gates Compass Telegraph Railway Crossing Karel Stopwatch Name Tag Step counter Servo calibrator Analog Pin Tester Light Level Meter Radio bridge Snap the dot Red light green light Name Badge catch the egg game lesson

A game to catch eggs in a basket.

Topic

Variables

  • activity
  • challenge
  • quiz
  • quiz answers

Prior learning/place of lesson in scheme of work

Learn how to create a catch the egg game game with ||led:plot|| , ||led:unplot||, and ||input:acceleration|| to turn on and off LED lights on the screen.

Documentation

The blocks used in this lesson:

let x = 2; led.unplot(0, 0); basic.forever(() => {}); x += 1; led.plot(0, 0); basic.pause(300); input.acceleration(Dimension.X); Math.min(0,0); Math.max(0,1); randint(0, 4); game.addScore(1); game.score(); game.removeLife(1);

Objectives

  • learn how to create a variable as a place where you can store data so that you can use it later in your code, accessible across functions and in nested code blocks
  • learn how to repeat code in the background forever
  • learn how to turn off a LED light on the LED screen
  • learn how to turn on a LED light on the LED screen
  • learn how to learn how to conditionally run code depending on whether a condition is true or not
  • learn how to learn how to get the acceleration value (g-force), in one of three specified dimensions
  • learn how to return the smaller of two numbers
  • learn how to return the larger of two numbers
  • learn how to return a random number
  • learn how to return the modulus
  • learn how to show a number of the micro:bit screen
  • learn how to pause your code for the specified number of milliseconds

Edit this page on GitHub Edit template of this page on GitHub Edit template of this page on GitHub

Select Language

How do I add a new language? Translate this page

Từ khóa » Egg Trò Chơi