+ 4
Call function inside function (nested functions)
I want to call shoot() function inside animate() function. How can i do that? function shoot(){ bullets.pop() numberOfBullets -= 1 for(var i = 0; i < numberOfBullets; i++){ bullets[i].shoot() } } https://code.sololearn.com/W3iUJwtX589C/?ref=app
7 Antworten
+ 2
Case have closed answered correctly by Heng Jun Xi. For more information visit the link below.
https://www.sololearn.com/discuss/2488529/?ref=app
+ 2
I see error message "Scene is not defined".
Mirielle[ InAcTiVe ]
+ 2
Tri Satria [NEW] Somewhat like this
https://code.sololearn.com/W4H8dQfKos51/?ref=app
+ 2
Is that what you wanted?
Recommendation: don't use onclick of html, use addEventListener or onclick of js. Don't call functions through html!
https://code.sololearn.com/WDMJnlBs4Z7I/?ref=app
+ 2
We cant place the shoot() outside animate() as since the bullet animation wont occur. Therefore, i wanna place that inside however shoot isnt defined
+ 1
Pass function to animate function and call shoot inside animate ,or what are you trying to do?
+ 1
If shoot button is clicked, it will call shoot() inside animate() but it wont work that way, so i wanna know how to do given question
check my recent question