Skip to content

Commit

Permalink
Uploading fixes and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiki-lee committed Oct 5, 2023
1 parent d623f29 commit a336734
Show file tree
Hide file tree
Showing 10 changed files with 861 additions and 56 deletions.
4 changes: 2 additions & 2 deletions docs/skillmap/sparks/sparks1.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ controller.A.onEvent(ControllerButtonEvent.Pressed, function () {



## {8. Play!}
## {14. Play!}

- :binoculars: Take a look at what you've made!

Expand All @@ -305,7 +305,7 @@ How many points can you get in twenty seconds?



## {9. Finale}
## {15. Finale}

**🪵 Way to Go 🪵**

Expand Down
5 changes: 1 addition & 4 deletions docs/skillmap/sparks/sparks2.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,6 @@ Don't touch any buttons or keys...you should lose the game after five seconds.

Click the (A) button as fast as you can. Is the game any harder to win?

💡 _Don't worry if your game is still too easy. In the next tutorial, we'll add more
levels, which will make the game much harder!_




Expand Down Expand Up @@ -318,7 +315,7 @@ info.onScore(30, function () { })
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
kindling.startEffect(effects.fire, 50)
kindling.startEffect(effects.fire, 500)
})
let kindling: Sprite = null
Expand Down
Binary file added docs/static/skillmap/sparks/pink.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 88 additions & 33 deletions docs/test/skillmap/globetrotters/globetrotters1.md

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions docs/test/skillmap/sparks/sparks1.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,14 @@ to the right of the <br/>
``||sprites: [kindling] start [fire] effect||`` <br/>
block.

- :mouse pointer: Change **500** to **100** so that the sparks barely have a chance to build as each click is added.


#### ~ tutorialhint
```blocks
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
//@highlight
kindling.startEffect(effects.fire, 100)
kindling.startEffect(effects.fire, 500)
})
```

Expand Down Expand Up @@ -344,7 +343,7 @@ controller.B.onEvent(ControllerButtonEvent.Pressed, function () {}
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
kindling.startEffect(effects.fire, 25)
kindling.startEffect(effects.fire, 500)
})
info.onScore(30, function () {
game.gameOver(true)
Expand Down
2 changes: 1 addition & 1 deletion docs/test/skillmap/sparks/sparks2.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ stopwatch.startTimer(stopwatch.TimerType.Tens)
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
kindling.startEffect(effects.fire, 100)
kindling.startEffect(effects.fire, 500)
})
let kindling: Sprite = null
Expand Down
2 changes: 1 addition & 1 deletion docs/test/skillmap/sparks/sparks3.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ stopwatch.startTimer(stopwatch.TimerType.Tens)
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
kindling.startEffect(effects.fire, 100)
kindling.startEffect(effects.fire, 500)
})
let kindling: Sprite = null
Expand Down
271 changes: 262 additions & 9 deletions docs/test/skillmap/sparks/sparks4.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ hint~

## {4. Put it in the program}

Add the variable to your program.
**Set the variable in your program.**

---

Expand All @@ -110,17 +110,263 @@ let kindling = sprites.create(sparks.pile1, SpriteKind.Player)
kindling.setPosition(70, 80)
```

```blockconfig.local
let level = 1




## {5. Replace in the game event}

**Add the variable to your code.**

Let's use the variable to take away a larger amount of points in each level.

---

- :binoculars: Look for the <br/>
``||info: change score by [-1]||`` <br/>
block that's **already inside of** <br/>
``||game(noclick):on game update every [1000]ms||``.

- :mouse pointer: **Delete** the <br/>
``||info: change score by [-1]||`` <br/>
block and replace it with <br/>
``||info: change score by [level x -1]||`` <br/>
from the ``||info:Info||`` category<br/>

---

_**Tip:** Having a hard time finding a block? Click the colored text in the instruction to
pop open the category that you need._

![Again and Again](/static/skillmap/sparks/pink.gif "Let's add more levels." )



#### ~ tutorialhint
```blocks
game.onUpdateInterval(1000, function () {
//@highlight
info.changeScoreBy(level * -1)
})
```




## {6. Check Your Game!}


- :binoculars: Try your project in the game window.

It should work exactly the same way as it did before...until the level goes up!






## {7. Going Up}

The level should go up each time the player gets to 30 points.
We'll need a function to make that happen.


~hint What's a function? 💡

---

A **function** is a set of code that you name so that you can **call** it
over and over inside of your program without having to write the code
again each time.

Here is an example of a function **definition**:

```blocks
let textSprite: TextSprite = null
let firePit: Sprite = null
function change_level () {
info.setScore(0)
let level = level + 1
textSprite.setText("Level " + level)
}
```

And here is the block we'll use to **call** our function when we want to use that code:

```block
//@hide
function change_level () {}
change_level()
```

↑ That block represents all of the
code that we added into our function
definition.


hint~

- :chevron down: Click **Advanced** in the toolbox to reveal
the ``||functions:Functions||`` category.

- :function: Click on ``||functions:Functions||``, then click <br/>
**Make a Function**.

- :mouse pointer: Give your function the name **change_level** and click "Done".


## {9. Finale}

**👨🏽‍🚒 You're FIRE 👨🏽‍🚒**


## {8. What's your function}

Let's add the code to add one to the level inside the function.

---

- :align justify: Open ``||variables: Variables||`` and drag <br/>
``||variables:set [level] to [0]||`` <br/>
into the ``||functions(on click):function [change_level]||`` container. <br/>

- :calculator: From ``||math:Math||``, drag <br/>
``||math:[0] + [0]||`` in to **replace** the **0** in the <br/>
``||variables:set [level] to [0]||`` block.



#### ~ tutorialhint
```blocks
function change_level () {
level = 0 + 0
}
```




## {9. Another one}

Add one to level...

---

- :align justify: Open ``||variables: Variables||`` and drag <br/>
``||variables:level||`` in to replace the first **0** inside of <br/>
``||variables:set [level] to [0 + 0]||``.

- :mouse pointer: Find <br/>
``||variables:set [level] to [level + 0]||`` <br/>
and change the last **0** to a **1**.



#### ~ tutorialhint
```blocks
function change_level () {
level = level + 1
}
```





## {10. Another one}

If you play your game right now, you'll see nothing has changed, because you're not
using the


```block
//@hide
function change_level () {}
change_level()
```

block anywhere yet. Let's fix that.

---

- :mouse pointer: Delete everything inside of <br/>
``||info(no click):on score [30]||`` <br/>
**without** deleting the container itself.


- :function: From ``||functions:Functions||``, drag <br/>
``||functions:call change_level||`` into <br/>
``||info(no click):on score [30]||``. <br/>


#### ~ tutorialhint


```blocks
//@hide
function change_level () {}
info.onScore(30, function () {
change_level()
})
```



## {11. Check Your Game!}


- :binoculars: Try your game now.

When you get to 30, things should start to get harder, but that's all you'll see.
After that, the game will keep going on forever. We'll change that in the next step.





## {12. Another one}

Resetting the score inside your function will allow you to trigger change_level
again the next time you reach 30.

---

- :id card: From ``||info:Info||``, drag <br/>
``||info:set score to [0]||`` <br/>
into the **top of** the <br/>
``||function: function [change_level]||`` function.


#### ~ tutorialhint

```blocks
//@hide
function change_level () {}
info.onScore(30, function () {
info.setScore(0)
change_level()
})
```




## {13. Play Your Game!}


- :binoculars: Try your game again.

This time when you play, your score will start over every time you reach 30 and
the game will get harder each time.




## {14. Finale}

**🪨 Your game ROCKS!! 🪨**

What a great game you've got there!

Expand All @@ -143,12 +389,19 @@ add levels to your game!


```blockconfig.global
let textSprite: TextSprite = null
let firePit: Sprite = null
info.changeScoreBy(level * -1)
info.onScore(30, function () {})
game.gameOver(true)
let kindling = sprites.create(img`.`, SpriteKind.Player)
kindling.setPosition(70, 80)
kindling.startEffect(effects.fire)
info.onScore(30, function () { })
info.setScore(0)
let level = level + 1
textSprite.setText("Level " + level)
```

```template
Expand All @@ -157,7 +410,7 @@ info.onScore(-5, function () {
})
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
info.changeScoreBy(1)
kindling.startEffect(effects.fire, 25)
kindling.startEffect(effects.fire, 500)
})
info.onScore(30, function () {
game.setGameOverScoringType(game.ScoringType.LowScore)
Expand Down Expand Up @@ -188,9 +441,9 @@ info.onScore(-5, function () {
game.gameOver(false)
})
info.onScore(30, function () {
bumpLevels()
change_level()
})
function bumpLevels () {
function change_level () {
if (level == 5) {
info.setScore(game.timeSinceStartSec())
game.setGameOverMessage(true, "Great job, Fire Maker!")
Expand Down
Loading

0 comments on commit a336734

Please sign in to comment.