more docs cleanup
|
@ -94,8 +94,6 @@ Connect a micro:bit to your computer using your USB cable
|
|||
|
||||
Click or tap the **Download** button for the seismograph program to run the program on the micro:bit.
|
||||
|
||||
![](/static/mb/lessons/seismograph22.png)
|
||||
|
||||
## 9.
|
||||
|
||||
A black line should appear directly beneath the colored line. The black line measures the micro:bit acceleration. And the colored line measures micro:bit simulator acceleration.
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# String
|
||||
|
||||
```cards
|
||||
String.fromCharCode(0);
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
[fromCharCode](/reference//math/string-from-char-code)
|
До Ширина: | Высота: | Размер: 5.9 KiB |
До Ширина: | Высота: | Размер: 16 KiB |
До Ширина: | Высота: | Размер: 3.3 KiB |
До Ширина: | Высота: | Размер: 3.4 KiB |
До Ширина: | Высота: | Размер: 1.8 KiB |
До Ширина: | Высота: | Размер: 3.9 KiB |
До Ширина: | Высота: | Размер: 1.4 KiB |
До Ширина: | Высота: | Размер: 6.6 KiB |
До Ширина: | Высота: | Размер: 2.0 KiB |
До Ширина: | Высота: | Размер: 10 KiB |
До Ширина: | Высота: | Размер: 12 KiB |
До Ширина: | Высота: | Размер: 12 KiB |
До Ширина: | Высота: | Размер: 17 KiB |
До Ширина: | Высота: | Размер: 2.9 KiB |
До Ширина: | Высота: | Размер: 5.7 KiB |
До Ширина: | Высота: | Размер: 6.5 KiB |
До Ширина: | Высота: | Размер: 13 KiB |
До Ширина: | Высота: | Размер: 19 KiB |
До Ширина: | Высота: | Размер: 1.5 KiB |
|
@ -34,7 +34,6 @@ Overview of Touch Develop lessons for the BBC micro:bit.
|
|||
|
||||
### ~hide
|
||||
|
||||
* [Bounce image](/lessons/bounce-image), scroll an image across the screen on shake
|
||||
* [Magic logo](/lessons/magic-logo), show an image on logo up
|
||||
* [Glowing sword](/lessons/glowing-sword), make a glowing sword with fade in and fade out
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# Add Points to Score
|
||||
|
||||
The game library supports simple single-player time-based games. The player will ** add points to score**.
|
||||
|
||||
The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
```
|
||||
|
||||
### Score
|
||||
|
||||
When a player achieves a goal, you can increase the game score
|
||||
|
||||
* add score points to the current score
|
||||
|
||||
```
|
||||
export function addScore(points: number)
|
||||
```
|
||||
|
||||
* get the current score value
|
||||
|
||||
```
|
||||
export function score() : number
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[bop it](/lessons/bop-it) | [game of chance](/lessons/game-of-chance) | [game counter](/lessons/game-counter)
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# Change Score By
|
||||
|
||||
The game library supports simple single-player time-based games. The player will ** add points to score**.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
```
|
||||
|
||||
### Score
|
||||
|
||||
When a player achieves a goal, you can increase the game score
|
||||
|
||||
* add score points to the current score
|
||||
|
||||
```
|
||||
export function addScore(points: number)
|
||||
```
|
||||
|
||||
* get the current score value
|
||||
|
||||
```
|
||||
export function score() : number
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[bop it](/lessons/bop-it) | [game of chance](/lessons/game-of-chance) | [game counter](/lessons/game-counter)
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# Game Over
|
||||
|
||||
You can end the game by calling the `game -> game over` function:
|
||||
|
||||
```blocks
|
||||
game.gameOver()
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[game of chance](/lessons/game-of-chance)
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
# Score
|
||||
|
||||
The game library #docs
|
||||
|
||||
The game library supports simple single-player games. The player has a **score**.
|
||||
|
||||
## Block Editor
|
||||
|
||||
The code below shows a simple game where the user gets to press the button ``A`` and adds 1 point to score that will be displayed on the BBC micro:bit screen
|
||||
|
||||
![](/static/mb/game-library/add-point-to-score-0.png)
|
||||
|
||||
## Touch Develop
|
||||
|
||||
The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds.
|
||||
|
||||
```
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
```
|
||||
|
||||
### Score
|
||||
|
||||
When a player achieves a goal, you can increase the game score
|
||||
|
||||
* add score points to the current score
|
||||
|
||||
```
|
||||
export function addScore(points: number)
|
||||
```
|
||||
|
||||
* set the current score to a particular value.
|
||||
|
||||
```
|
||||
export function setScore(value: number)
|
||||
```
|
||||
|
||||
* get the current score value
|
||||
|
||||
```
|
||||
export function score() : number
|
||||
```
|
||||
|
||||
### Countdown
|
||||
|
||||
If your game has a time limit, you can start a countdown in which case `game->current time` returns the remaining time.
|
||||
|
||||
* start a countdown with the maximum duration of the game in milliseconds.
|
||||
|
||||
```
|
||||
export function startCountdown(ms: number)
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[bop it](/lessons/bop-it) | [game of chance](/lessons/game-of-chance) | [game counter](/lessons/game-counter)
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
# Start Countdown
|
||||
|
||||
The game library #docs
|
||||
|
||||
The game library supports simple single-player time-based games. The general goal of a game will be to achieve a top score before time runs out of time.
|
||||
|
||||
## Block Editor
|
||||
|
||||
![](/static/mb/game-library/start-countdown-0.png)
|
||||
|
||||
## Touch Develop
|
||||
|
||||
The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds.
|
||||
|
||||
```
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
```
|
||||
|
||||
### Score
|
||||
|
||||
When a player achieves a goal, you can increase the game score
|
||||
|
||||
* add score points to the current score
|
||||
|
||||
```
|
||||
export function addScore(points: number)
|
||||
```
|
||||
|
||||
* set the current score to a particular value.
|
||||
|
||||
```
|
||||
export function setScore(value: number)
|
||||
```
|
||||
|
||||
* get the current score value
|
||||
|
||||
```
|
||||
export function score() : number
|
||||
```
|
||||
|
||||
### Countdown
|
||||
|
||||
If your game has a time limit, you can start a countdown in which case `game->current time` returns the remaining time.
|
||||
|
||||
* start a countdown with the maximum duration of the game in milliseconds.
|
||||
|
||||
```
|
||||
export function startCountdown(ms: number)
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[bop it](/lessons/bop-it) | [game of chance](/lessons/game-of-chance) | [game counter](/lessons/game-counter)
|
||||
|
|
@ -17,7 +17,6 @@ Overview of Games for the BBC micro:bit.
|
|||
* [Lucky 7](/lessons/lucky-7), show a number on the LED screen with show number
|
||||
* [Snowflake fall](/lessons/snowflake-fall), repeat an animation with forever
|
||||
* [Answering machine](/lessons/answering-machine), show a text message with show string
|
||||
* [Bounce image](/lessons/bounce-image), scroll an image across the screen on shake
|
||||
* [Magic logo](/lessons/magic-logo), show an image on logo up
|
||||
* [Screen wipe](/lessons/screen-wipe), turn off the LEDs with clear screen
|
||||
* [Blink](/lessons/blink), turn an LED on and off with plot
|
||||
|
|
|
@ -62,7 +62,6 @@ Images that you create in the [Touch Develop editor](/js/editor) are [local vari
|
|||
|
||||
### Lessons
|
||||
|
||||
* [bounce image ](/lessons/bounce-image)
|
||||
* [offset image](/lessons/offset-image)
|
||||
|
||||
### See also
|
||||
|
|
|
@ -22,12 +22,6 @@ Overview of Touch Develop lessons for the BBC micro:bit.
|
|||
* [Answering Machine](/lessons/answering-machine), show a text message with show string
|
||||
* [Snowflake Fall](/lessons/snowflake-fall), repeat an animation with forever
|
||||
|
||||
### ~hide
|
||||
|
||||
* [Bounce Image](/lessons/bounce-image), scroll an image across the screen on shake
|
||||
|
||||
### ~
|
||||
|
||||
* [Magic Logo](/lessons/magic-logo), show an image on logo up
|
||||
* [Screen Wipe](/lessons/screen-wipe), turn off the LEDs with clear screen
|
||||
* [Flashing Heart](/lessons/flashing-heart), display images with a pause
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
# bounce image lesson
|
||||
|
||||
scroll an image across the screen.
|
||||
|
||||
## Topic
|
||||
|
||||
Basic- Show Animation
|
||||
|
||||
## Quick Links
|
||||
|
||||
* [tutorial](/lessons/bounce-image/tutorial)
|
||||
* [quiz](/lessons/bounce-image/quiz)
|
||||
* [quiz answers](/lessons/bounce-image/quiz-answers)
|
||||
* [challenges](/lessons/bounce-image/challenges)
|
||||
|
||||
## Class
|
||||
|
||||
Year 7
|
||||
|
||||
## Prior learning / place of lesson in scheme of work
|
||||
|
||||
Learn how to creating an **animation**, `basic->show animation` to display a series of images. We will be learning how to create a counter app using a forever loop, the input on shake, and show animation.
|
||||
|
||||
## What the teacher needs to know / QuickStart Computing Glossary
|
||||
|
||||
* Algorithm: An unambiguous set of rules or a precise step-by-step guide to solve a problem or achieve a particular objective.
|
||||
* Command: An instruction for the computer to execute, written in a particular programming language.
|
||||
* Hardware: The physical systems and components of digital devices; see also software.
|
||||
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
|
||||
* Loop: A block of code repeated automatically under the program’s control.
|
||||
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
|
||||
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
|
||||
* Program: A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.
|
||||
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
|
||||
* Sequence: To place program instructions in order, with each executed one after the other.
|
||||
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
|
||||
|
||||
## Documentation
|
||||
|
||||
* **forever** : [read more...](/reference/basic/forever)
|
||||
* **show animation** : [read more...](/reference/basic/show-animation)
|
||||
* **on shake** : [read more...](/reference/input/on-gesture)
|
||||
|
||||
## Resources
|
||||
|
||||
* Activity: [tutorial](/lessons/bounce-image/tutorial)
|
||||
* Activity: [quiz](/lessons/bounce-image/quiz)
|
||||
* Extended Activity: [challenges](/lessons/bounce-image/challenges)
|
||||
|
||||
## Objectives
|
||||
|
||||
* learn how to repeat code in the background forever
|
||||
* learn how to show a series of image frames on the LED screen, pausing the specified time after each frame
|
||||
* learn how to run code when the micro:bit is shaken; when running code in the web browser, moving the mouse quickly simulates shaking
|
||||
|
||||
## Links to the National Curriculum Programmes of Study for Computing
|
||||
|
||||
## Progression Pathways / Computational Thinking Framework
|
||||
|
||||
#### Algorithms
|
||||
|
||||
* Uses diagrams to express solutions.(AB)
|
||||
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
|
||||
* Understands that iteration is the repetition of a process such as a loop (AL)
|
||||
* Represents solutions using a structured notation (AL) (AB)
|
||||
|
||||
#### Programming & Development
|
||||
|
||||
* Creates programs that implement algorithms to achieve given goals (AL)
|
||||
* Selects the appropriate data types(AL) (AB)
|
||||
|
||||
#### Hardware & Processing
|
||||
|
||||
* Knows that computers collect data from various input devices, including sensors and application software (AB)
|
||||
|
||||
#### Communication Networks
|
||||
|
||||
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
|
||||
|
||||
#### Information Technology
|
||||
|
||||
* Collects, organizes, and presents data and information in digital content (AB)
|
||||
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
|
||||
* Recognises ethical issues surrounding the application of information technology beyond school.
|
||||
|
||||
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
|
||||
|
||||
## Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [tutorial](/lessons/bounce-image/tutorial)
|
||||
* [quiz](/lessons/bounce-image/quiz)
|
||||
|
||||
## Extended Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [challenges](/lessons/bounce-image/challenges)
|
||||
|
||||
## Homework
|
||||
|
||||
* Extended Activity: [challenges](/lessons/bounce-image/challenges)
|
||||
|
||||
## Intended follow on
|
||||
|
||||
Publish script to the classroom.
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
# bounce image challenges
|
||||
|
||||
Coding challenges for the bounce image tutorial. #docs
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the following guided tutorial:
|
||||
|
||||
* [tutorial](/lessons/bounce-image/tutorial)
|
||||
|
||||
At the end of the tutorial, click `keep editing`. Your code should look like this:
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . #
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . #
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . #
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . #
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . #
|
||||
`, 200)
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
Now, let's add frames to reverse the animation so it looks like the bar is bouncing off the right edge of the display.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
`, 200) // ***
|
||||
})
|
||||
```
|
||||
|
||||
* Run the code to see if it works as expected.
|
||||
|
||||
### Challenge 2
|
||||
|
||||
Let's add a condition for on shake!
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
`, 200)
|
||||
})
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
}) // ***
|
||||
```
|
||||
|
||||
### Challenge 3
|
||||
|
||||
When the BBC micro:bit is shaken we want to show a new animation. Here is an example, but you can create your own. Be creative!
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
# . . . . . # . . . . . # . . . . . # . . . . . # . . . # . . . # . . . # . . . # . . . .
|
||||
`, 200)
|
||||
})
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
basic.showAnimation(`
|
||||
. . . . . . . . . . # # # # # . . . . . . . . . .
|
||||
. . . . . . # # # . # # # # # . # # # . . . . . .
|
||||
. . # . . . # # # . # # # # # . # # # . . . # . .
|
||||
. . . . . . # # # . # # # # # . # # # . . . . . .
|
||||
. . . . . . . . . . # # # # # . . . . . . . . . .
|
||||
`, 200) // ***
|
||||
})
|
||||
```
|
||||
|
||||
* Run the code to see if it works as expected.
|
|
@ -1,60 +0,0 @@
|
|||
# bounce image quiz answers
|
||||
|
||||
scroll an image on the BBC micro:bit.
|
||||
|
||||
This is the answer key for the [bounce image quiz](/lessons/bounce-image/quiz).
|
||||
|
||||
## 1. What does it mean to 'add frames' ?
|
||||
|
||||
Adding frames modifies the animation by including more still images in each animation.
|
||||
|
||||
## 2. Write the code that will display this animation.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-0.png)
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
# . . . .
|
||||
# . . . .
|
||||
# . . . .
|
||||
# . . . .
|
||||
# . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
## 3. Write the code that will display this animation with two frames.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-1.png)
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . .
|
||||
# . . . . . # . . .
|
||||
# . . . . . # . . .
|
||||
# . . . . . # . . .
|
||||
# . . . . . # . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
## 4. Write the code that will display this animation with three frames.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-2.png)
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
# . . . . . # . . . . . # . .
|
||||
# . . . . . # . . . . . # . .
|
||||
# . . . . . # . . . . . # . .
|
||||
# . . . . . # . . . . . # . .
|
||||
# . . . . . # . . . . . # . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
# bounce image quiz
|
||||
|
||||
scroll an image on the BBC micro:bit.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this document to guide your work in the [bounce image tutorial](/lessons/bounce-image/tutorial) !
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. What does it mean to 'add frames' ?
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the code that will display this animation.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-0.png)
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Write the code that will display this animation with two frames.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-1.png)
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Write the code that will display this animation with three frames.
|
||||
|
||||
![](/static/mb/lessons/bounce-image-2.png)
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|