Post no.11
I have combined the duplicate.js from testing into my game. Firstly I had some trouble with the height and width of the container because they worked in reverse. If I were to put the container at 600px width and 200px height, the blood bullets triggered by the space bar would fly 600px height and 200px width. Which was pretty confusing, so I tried and tested a couple of values and finally thought of using % instead of pixels.
Once I put the divs within the master wrapper, I put 90% width so the bullets would only spawn till 90% of the width of the master wrapper.
Before this, everytime I hit the spacebar, it would spawn 3 more clickable elements. Therefore, the more I hit the spacebar it would just multiply by 3 for each clickable element. After a few presses, the whole area would lagged and be totally filled with those elements. What I did to fix this is that I put 'hidden' once it spawned and therefore hiding the clickable elements and only spawning one at a time. (Kinda hard to explain, but yeah somehow it worked).
Trial and error! Works best.
No comments:
Post a Comment