Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starter project for globetrotters #6104

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

```