-
Notifications
You must be signed in to change notification settings - Fork 0
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
MNG-99 & MNG-100 #21
MNG-99 & MNG-100 #21
Conversation
memeraki
commented
Feb 10, 2021
> created menu and back button with options. Options need to be fixed (now are default). Animation also needs to look better
attackButtonOne.addEventListener('click', () => { | ||
console.log('attack One used!'); | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
//also change player function | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); | ||
attackButtonTwo.addEventListener('click', () => { | ||
console.log('attack Two used!'); | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
// also change player function | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); | ||
backButton.addEventListener('click', () => { | ||
//timeout and style for some button animation - the animation needs to be change | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think there is some repeated logic, that can be extracted out? :)
switchButtonOne.addEventListener('click', () => { | ||
console.log('pokemon One gooo!'); | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
// also change player function | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); | ||
switchButtonTwo.addEventListener('click', () => { | ||
console.log('pokemon Two gooo!'); | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
// also change player function | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); | ||
backButton.addEventListener('click', () => { | ||
//timeout and style for some button animation - the animation needs to be change | ||
setTimeout( ()=> { | ||
gameHandler.generateActionButtons(player); | ||
}, 500); | ||
for(let i = 0; i < battleButtons.length; i++) { | ||
battleButtons[i].style.backgroundColor = 'green'; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. It might be possible to extract it to one function. As input it could take: 1) button on which the event listener should be added; 2) the function it should call (i.e. eatMango(), switchToPokemon(1) or something)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm picking on, but it is for your own good 🙃
I am really amazed by the amount of the code you have done here, looks very structured, just as I like!