pxt-calliope/docs/lessons/pogo.md

47 lines
1.2 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# pogo lesson
2016-04-02 01:22:47 +02:00
create a game that relies on precise instincts and timing reflexes #if #.
2016-03-26 00:47:20 +01:00
## Topic
Running Time
## Quick Links
2016-04-13 17:27:45 +02:00
* [activity](/lessons/pogo/activity)
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn how to use running time. We will be learning how to create a pogo game using variables, forever loop, conditionals, on button pressed, as well as simple commands, such as show LEDs and clear screen.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
2016-04-01 00:51:42 +02:00
let jumps = 0
let acc = input.acceleration(Dimension.Y)
2016-04-05 07:33:13 +02:00
basic.showNumber(0)
2016-04-01 00:51:42 +02:00
led.stopAnimation()
2016-04-05 07:33:13 +02:00
radio.sendNumber(0)
2016-04-01 00:51:42 +02:00
basic.forever(() => { })
basic.showLeds(`
. . . . .
. # . # .
. . # . .
# . . . #
. # # # .
`)
basic.clearScreen()
2016-04-05 07:33:13 +02:00
if (true) {}
radio.onDataPacketReceived(() => { })
2016-04-01 00:51:42 +02:00
```
2016-03-26 00:47:20 +01:00
## Objectives
* learn how to create a function as a unit of code that performs a specific task and returns a result
* learn how arithmetic operators operate on numbers and return a number
* learn how to repeat code in the background forever
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to run code when an input button is pressed
* learn how to pause your code for the specified number of milliseconds
2016-08-10 14:44:10 +02:00
```package
radio
2016-08-10 14:44:10 +02:00
```