let pikachuName = "Pikachu" let pikachu = { name: "Pikachu", health: 45, image: "Images/pikachu.png", level: 8, }; let bulbasaur = { name: "Bulbasaur", health: 70, image: "Images/bulbasaur.png", level: 12, }; let oranguru = { name: "Oranguru", health: 170, image: "Images/oranguru.png", level: 45, }; let drowzee = { name: "Drowzee", health: 90, image: "Images/drowzee.png", level: 33, }; let bjarne = { name: "Bjarne", image: "Images/pokemonTrainerIdle.png", pokemon: [], } let possiblePokemon = [pikachu, bulbasaur, oranguru, drowzee]; let randomPokemon = null; let app = document.getElementById("app"); updateView(); function updateView() { getRandomPokemon() // randomPokemon.level = Math.floor(Math.random() * 100) // randomPokemon.health = Math.floor(Math.random() * 100) // console.log(randomPokemon.level, randomPokemon.health); app.innerHTML = /*HTML*/ `
${randomPokemon.name}
lvl: ${randomPokemon.level}
${bjarne.name}
`; } function caughtPokemonView() { app.innerHTML = /*HTML*/`

Du fanget ${bjarne.pokemon[bjarne.pokemon.length - 1].name}

`; } function catchPokemon() { bjarne.pokemon.push(randomPokemon); caughtPokemonView(); } function showPokemon() { app.style = null; app.innerHTML = ''; for (i = 0; i < bjarne.pokemon.length; i++){ app.innerHTML = /*HTML*/ `
${bjarne.pokemon[i].name}
`; } app.innerHTML += /*HTML*/`
`; } function getRandomPokemon() { let randomNum = Math.floor(Math.random() * possiblePokemon.length); randomPokemon = possiblePokemon[randomNum]; }