scrimba
Build an RPG
Build a role-playing game part 3 - The gameplay
Launch the first attack!
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Launch the first attack!
AboutCommentsNotes
Launch the first attack!
Expand for more info
index.js
run
preview
console
import characterData from './data.js'
import Character from './Character.js'

/*
CHALLENGE
1. Make the attack button trigger a dice roll for both
wizard and orc (which method on the constructor does that??)
2. Make sure the new dice score shows in the app
**hint.md for help!!**
*/

function attack(){

}

function render() {
document.getElementById('hero').innerHTML = wizard.getCharacterHtml();
document.getElementById('monster').innerHTML = orc.getCharacterHtml();
}

document.getElementById("attack-button").addEventListener('click', attack)

const wizard = new Character(characterData.hero)
const orc = new Character(characterData.monster)
render()
Console
/index.html
-2:16