Skip to content
Permalink
0e4f315901
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
43 lines (33 sloc) 1.56 KB
import { Alert, Confirm, Prompt } from "./game-framework.js";
/**
* Week 04 - Control Flow
*/
// Modify the text for the introduction
await Alert('Welcome to House Cat Simulator. Make decisions to experience a day in the life of a house cat!')
let name = await Prompt("What is your cat name?")
// Level 1
if(await Confirm(`Hi ${name}. Do you want to go to sleep?`)) {
let decision = await Prompt('Do you want to sleep on the windowsill, bed, or in a box?')
if (decision.toLowerCase() === "windowsill") {
await Alert('You find a spot to nap on the windowsill and fall asleep in the warmth of the sun.')
} else if (decision.toLowerCase() === "bed") {
await Alert('You find a cozy spot on the bed with your human and fall asleep snuggled next to them.')
} else if (decision.toLowerCase() === "box") {
await Alert('You find a cool box and fall asleep inside of it.')
}
} else {
if (await Confirm('Do you want to play?')) {
if (await Confirm('Are there toys nearby?')) {
await Alert ('You bat around a toy and chase it around.')
} else {
await Alert('You play with a makeshift toy made out of crumpled paper.')
}
} else {
if (await Confirm('Are you hungry?')) {
await Alert('You eat some food from your bowl, licking your chops. You are happy.')
} else {
await Alert("Since you don't want to do anything and are bored, you go look for your human to give you some attention.")
}
}
}
window.location.reload()