Untitled
unknown
plain_text
a year ago
1.3 kB
10
Indexable
const BlockSpriteKind = SpriteKind.create();
const BreakableBlockSpriteKind = SpriteKind.create();
const OneTimeBlockSpriteKind = SpriteKind.create();
const SlimeBlockSpriteKind = SpriteKind.create();
let highestScore = 0;
const myPlayer = sprites.create(assets.image`sybit_logo`, SpriteKind.Player);
let debug_mode: boolean = false;
const Blocke = SpriteKind.create();
let playerName: string;
let playerNames: string[] = ["a", "b"]; // Speicher für Spielernamen
let playerHighscores: number[] = []; //Speicher für Scores
scene.setBackgroundColor(12);
startNewGame();
function showControls() {
// showLongText automatically pauses until A is pressed
game.showLongText("Hallo " + playerName +"!\n->Press A to go left!\n->Press B to go right!\n->Press A + B to start!", DialogLayout.Center);
}
function startNewGame() {
playerName = game.askForString("Gib deinen Namen ein: ", 10); //Spielername eingeben
playerNames.forEach((name, index) => {
if (name == playerName) {
console.log("a");
playerName = game.askForString("Bitte gib einen neuen Namen ein:", 10);
} else {
console.log("b");
playerNames.push(playerName);
showControls();
startGame();
}
});
}Editor is loading...
Leave a Comment