Week 5


This week I worked on collision detection in createjs for the nutrition game created with the JavaScript library suite createjs using easeljs and preloadjs. I currently have a game that begins when the user presses the space button, so that the player only starts falling when the user engages with the game. The mock nutrients begin moving and being added over time with a Ticker when the game begins as well.

This week I worked on adding a scoreboard to the screen. I plan on changing the visuals on the scoreboard, but it works for development now. I am having moderate success with the collision detection. So far I am getting collisions acknowledged most of the time and I am able to update the score in the scoreboard. I believe that right now the points are being added too many times per collision, which I will have to remedy… each time I have to interact with a nutrient (here represented by circles) I have to do so in reference to the stage’s children, since these objects are being created dynamically. The best place to check on collision detection with the player then is in the Ticker event handler, so that it is checked endlessly… however this means that collision is getting checked so often that points are adding up for the entire amount of time theĀ  nutrient and player are overlapped. In order to fix this I will likely have to find a different place to test for collision, or I will need to keep track of a boolean value collided and keep that true so long as the last x coordinate of a nutrient is in line with the last x coordinate of the player character. This would likely allow more accurate tallying of points.

I am also seeming to have an issue with the radius of the player character allowing nutrients to collide with it on the rear 1/4th or so of the character with no points getting tallied. I suspect that I will need to adjust the radius being used in the function so that that area is not left out of collision detection.

Leave a Reply

Your email address will not be published. Required fields are marked *

*