Answer the question
In order to leave comments, you need to log in
How to make new blocks appear when 5 breaks in Breakout game in JS and HTML?
I'm trying to make it so that every time the score increases by 5 (i.e. 5 blocks are removed), the drawNewBlocks() and contactWithNewBlocks() functions are run. I tried to do a loop, and if but nothing happened. What did I do wrong and how can I solve this situation?
Answer the question
In order to leave comments, you need to log in
Quick and dirty: Each time the score increases, check that the score is a multiple of five, and, according to this condition, pull the functions you need.
More correctly: Have a separate counter for the number of broken blocks and check it. After all, the score does not always have to increase by 1 for each block. Suddenly you want to add blocks of different cost, bonuses, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question