pxt-calliope/docs/skillmap/space/activity1.md

172 lines
4.4 KiB
Markdown
Raw Permalink Normal View History

V4 updates for beta testing (#147) * change simulator svg * change radio image * Remove google fonts cdn * change color of 'advanced' button * font fix * font fix 2 * display fix * change fullsceen simulator bg * Continuous servo * handle continuous state * adding shims * update rendering for continuous servos * fixing sim * fix sig * typo * fix sim * bump pxt * bump pxt * rerun travis * Input blocks revision - add Button and Pin event types - merge onPinPressed & onPinReleased in new onPinEvent function - create new onButtonEvent function * update input blocks in docs and tests * remove device_pin_release block * Hide DAL.x behind Enum * bring back deprecated blocks, but hide them * shims and locales files * fix input.input. typing * remove buildpr * bump V3 * update simulator aspect ratio * add Loudness Block * revoke loudness block * Adds soundLevel To be replaced by pxt-common-packages when DAL is updated. * Remove P0 & P3 from AnalogPin * Fix Sound and replace AnalogPin.P0 * remove approved extensions * V4 Updates from remote Repo * locales * add storage functions * fix storage functions * fix int/float values * decrease decimal precision * reorder blocks * Update BLE Settings and Storage Blocks * Fetch MicroBit changes up to v4.0.18 * Update timing for LED Matrix usage * use 32kb ram (mini v2) * resize gatt table * Revert "use 32kb ram (mini v2)" This reverts commit 4b15592f0f0eacfc1a2e826f34682bc589faf16e. * fix missleading indentation * add support for 32kb and 16kb ram * only MIT extensions in preferredRepos * remove extensions without MIT License file * add updated extensions * add extensions with MIT license Co-authored-by: Juri <gitkraken@juriwolf.de> Co-authored-by: Juri <info@juriwolf.de>
2022-03-22 17:36:19 +01:00
# Space Explorer
## Introduction @showdialog
** Let's explore the depths of space! **
In this tutorial, you'll design a spaceship for your journey.
![Flying through space](/static/skillmap/space/space1.gif "Blasting through a starfield" )
## Set the scene
**Give 'em something to look at** 🔭
---
► Drag the ``||scene:start screen [confetti] effect ⊕||`` from the ``||scene:Scene||`` category and
into the ``||loops:on start||`` block that's already in the workspace.
► Next, select ``||scene:star field||`` (instead of ``||scene:confetti||``) from the dropdown
and watch as you blast into space! 🚀
---
```blocks
// @highlight
effects.starField.startScreenEffect()
```
## Draw your ship
**🧑🏿‍🚀 Time to choose our ship! 👩🏾‍🚀**
---
► From the ``||sprites:Sprites||`` category, drag the ``||variables:set [mySprite] to sprite [ ] of kind [Player]||``
block and place it at the end of the ``||loops:on start||`` container.
► Click on the grey box in the middle of your
``||variables:set [mySprite] to sprite [ ] of kind [Player]||`` block
to design a ship of your own! Are you a rusty pile of scraps or a sleek, futuristic rocket?
---
**Tip:** Don't feel like drawing your ship? Once you're in the sprite editor,
flip to the gallery and choose from premade images.
```blocks
effects.starField.startScreenEffect()
// @highlight
let mySprite = sprites.create(img`
. . . . . . . 9 9 . . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . 9 . 9 9 9 9 9 9 . 9 . . .
. . . 9 . 9 . . . . 9 . 9 . . .
. . 9 . 9 9 . 9 9 . 9 9 . 9 . .
. . 9 . 9 9 . . . . 9 9 . 9 . .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
9 . 9 9 9 9 9 9 9 9 9 9 9 9 . 9
9 . . . . . . . . . . . . . . 9
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
`, SpriteKind.Player)
```
## Control your ship
🌟 Let's get your ship moving 🌟
---
► Find the ``||controller:move [mySprite] with buttons ⊕||`` block
and drag it into the bottom of the ``||loops:on start||`` container.
** Now try moving your ship around on the game screen! **
Your ship will move with the joystick, arrow keys, or **W A S D** keys.
```blocks
effects.starField.startScreenEffect()
let mySprite = sprites.create(img`
. . . . . . . 9 9 . . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . 9 . 9 9 9 9 9 9 . 9 . . .
. . . 9 . 9 . . . . 9 . 9 . . .
. . 9 . 9 9 . 9 9 . 9 9 . 9 . .
. . 9 . 9 9 . . . . 9 9 . 9 . .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
9 . 9 9 9 9 9 9 9 9 9 9 9 9 . 9
9 . . . . . . . . . . . . . . 9
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
`, SpriteKind.Player)
// @highlight
controller.moveSprite(mySprite)
```
## Stay in screen
**Uh-oh, if you move off screen, your ship disappears!**
---
► To keep your ship from exploring beyond the edges, find
the ``||sprites:set [mySprite] stay in screen <on>||`` block and
snap it in at the end of the program.
```blocks
effects.starField.startScreenEffect()
let mySprite = sprites.create(img`
. . . . . . . 9 9 . . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . . 9 . . 9 . . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . . 9 . 9 9 . 9 . . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . . 9 . 9 9 9 9 . 9 . . . .
. . . 9 . 9 9 9 9 9 9 . 9 . . .
. . . 9 . 9 . . . . 9 . 9 . . .
. . 9 . 9 9 . 9 9 . 9 9 . 9 . .
. . 9 . 9 9 . . . . 9 9 . 9 . .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
. 9 . 9 9 9 . 9 9 9 9 9 9 . 9 .
9 . 9 9 9 9 9 9 9 9 9 9 9 9 . 9
9 . . . . . . . . . . . . . . 9
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
`, SpriteKind.Player)
controller.moveSprite(mySprite)
// @highlight
mySprite.setStayInScreen(true)
```
## Finale @showdialog
**Great Job!**
---
**Try your project on the game screen
before you click finish on the tutorial.**
Is everything how you want it? You can always go back and edit steps if you discover you'd like them to work differently.
## Byeeee
** 🚀 That's it! 🚀**
You're all set to travel the universe!
Click **Finish** to return to the main page where you can share your game
with family and friends!