Skip to content

Commit

Permalink
Starter project for globetrotters (#6104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiki-lee authored Oct 5, 2023
1 parent 96369a0 commit c0c5a41
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions docs/tutorials/globetrotters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Starter Project
### @explicitHints true

## GET INTO THE GAME! @showdialog

Let's create a trivia game starring the Globetrotters!

![Level 1 splash image](/static/skillmap/globetrotters/level1-splash.jpg)

Follow the instructions in your document to create a game of your own.






```ghost
sprites.onOverlap(SpriteKind.Player, SpriteKind.NPC, function (sprite, otherSprite) {
controller.moveSprite(mySprite, 0, 0)
globetrotters.askQuestion(otherSprite)
controller.moveSprite(mySprite, 100, 0)
if (globetrotters.NPCNumberOf(otherSprite) >= 4) {
if (info.score() >= 30) {
effects.confetti.startScreenEffect(500)
play_next_level()
} else {
music.play(music.melodyPlayable(music.wawawawaa), music.PlaybackMode.UntilDone)
game.showLongText("TRY AGAIN! You need 31 points to get to the basketball court. YOU GOT THIS!!!", DialogLayout.Full)
game.reset()
}
}
})
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
globetrotters.tossBall(assets.image`ball`)
})
function play_next_level () {
globetrotters.setLevel2(assets.image`tnt`)
game.showLongText("Press B to shoot the basketballs. You must get to 200 points!", DialogLayout.Bottom)
info.startCountdown(45)
}
info.onCountdownEnd(function () {
game.showLongText("Keep practicing!", DialogLayout.Top)
game.gameOver(false)
})
sprites.onOverlap(SpriteKind.Projectile, SpriteKind.Bucket, function (sprite, otherSprite) {
info.changeScoreBy(2)
sprites.destroy(sprite)
})
info.onScore(200, function () {
game.showLongText("You could become a Harlem Globetrotter!!!", DialogLayout.Top)
game.gameOver(true)
})
let mySprite: Sprite = null
scene.setBackgroundImage(globe_imgs.audience)
scroller.scrollBackgroundWithCamera(scroller.CameraScrollMode.BothDirections)
mySprite = sprites.create(assets.image`tnt`, SpriteKind.Player)
game.showLongText("Get a Harlem Globetrotter into the game and help them to score. Press A to begin.", DialogLayout.Full)
mySprite.ay = 275
controller.moveSprite(mySprite, 120, 0)
scene.cameraFollowSprite(mySprite)
globetrotters.setNPC(1, globetrotters.NPCnum.WHAM)
globetrotters.setNPC(2, globetrotters.NPCnum.CHEESE)
globetrotters.setNPC(3, globetrotters.NPCnum.JET)
globetrotters.setNPC(4, globetrotters.NPCnum.COACH)
characterAnimations.loopFrames(
mySprite,
assets.animation`tnt_standing`,
200,
characterAnimations.rule(Predicate.NotMoving)
)
characterAnimations.loopFrames(
mySprite,
assets.animation`tnt_dribble`,
200,
characterAnimations.rule(Predicate.MovingRight)
)
```


```package
arcade-background-scroll=github:microsoft/arcade-background-scroll
globe_imgs=github:kiki-lee/globe_imgs
globe_animations=github:kiki-lee/globe_animations
globe_ext=github:kiki-lee/globe_ext
```

0 comments on commit c0c5a41

Please sign in to comment.