Beginner Tutorial 8 - isEaten = isColliding

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
perpetual
Posts: 3
Joined: April 4th, 2020, 7:39 am

Beginner Tutorial 8 - isEaten = isColliding

Post by perpetual » April 4th, 2020, 11:15 pm

Chili mentions in the wiki that you cannot assign Eaten = isColliding, which is true, The collision would be checked the next frame and based off the provided parameters will be assigned "false", and then the draw code will show the image.
The cleaner way, in my opinion is to do

Code: Select all

if(!poo0_isEaten){
poo0_isEaten = isColliding(player_x, player_y, 20, 20, poo0_x, poo0_y, 25, 25);
}
That way you're not checking for collision the next frame for a non-existent entity. which if you attempt to expand on this can have unintended side-effects. Just thought I'd share so someone can learn from it.

Post Reply