View Single Post
Junior Member
Status: Offline
Posts: 3
Join Date: Apr 2018
Location: I live in Ho Chi Minh city, Vietnam
Default 04-30-2018, 07:52 AM

Originally Posted by coynerm View Post
Trying to create a global counter variable to keep track of collision events ie each time an object collides then increment counter but...can only create local variable for each collision event. Is there a way to create a global variable in the initializeEventListeners?

Also, why doesnt the 'object.isCollidingWith.otherObject' function work? I tried using this but it didnt detect the collision so I went w/ the eventListener for collision detection. If I can get this function working then I can create a global variable....thx.

In 'isCollidingWith' function, if you want it to work while the program is running, you should put it into 'while' statement because it is a condition, if you set up it once, the program just compares one, and then passes it, so i think while statement will help you repeat until the condition is true.
Reply With Quote