KevKelley Posted November 17, 2021 Share Posted November 17, 2021 I was playing around with some code and when I had changed the order in a collision statement the effect seemed to be different. I don't think I had made any other changes in my program that would have made a difference because at the time I was just changing one line but I was wondering if something like if collision(playfield,player0) then... Would behave differently than if collision (player0,playfield) then... Quote Link to comment https://forums.atariage.com/topic/327261-collision-detection-order/ Share on other sites More sharing options...
KevKelley Posted November 17, 2021 Author Share Posted November 17, 2021 Now to think of it, I think I did have this code placed before the drawscreen, if that makes a difference. Quote Link to comment https://forums.atariage.com/topic/327261-collision-detection-order/#findComment-4947881 Share on other sites More sharing options...
+Gemintronic Posted November 17, 2021 Share Posted November 17, 2021 I don't think I've noticed a difference. Although I have noticed a difference based on where in the main loop the collision checks are being made. I've been making a collision detection section in my code that stores the results in a collision variable. Each type of collision getting its own bit. I can clear all 8 collision flags by just going "collided = 0" before starting the latest round of collision checking. def colp0p1 = collided{0} def colp0p2 = collided{1} def colp0p3 = collided{2} def colp0p4 = collided{3} def colp0p5 = collided{4} This keeps the actual collision checks in one place for easier debugging. But, maybe not the most efficient. 1 Quote Link to comment https://forums.atariage.com/topic/327261-collision-detection-order/#findComment-4948064 Share on other sites More sharing options...
KevKelley Posted November 17, 2021 Author Share Posted November 17, 2021 1 hour ago, Gemintronic said: I don't think I've noticed a difference. Although I have noticed a difference based on where in the main loop the collision checks are being made. I've been making a collision detection section in my code that stores the results in a collision variable. Each type of collision getting its own bit. I can clear all 8 collision flags by just going "collided = 0" before starting the latest round of collision checking. def colp0p1 = collided{0} def colp0p2 = collided{1} def colp0p3 = collided{2} def colp0p4 = collided{3} def colp0p5 = collided{4} This keeps the actual collision checks in one place for easier debugging. But, maybe not the most efficient. I went back in my code and it didn't seem to act differently so maybe I just edited something else but I do notice sometimes it will behave a certain way located elsewhere, and not just before or after drawscreen. I like the variable idea. What made me play around with this was I had originally had a collision detection with the playfield but then I swapped playfield and background and all the colors so that resulted in my changing the collision code since once the player would step out of the PF0 zone it wouldnt work like it did before. I ended up making 3 hit boxes for the area I originally had covered with the one collision check. I was just hoping to stick with the collision code since it was simpler but I like the change. 1 Quote Link to comment https://forums.atariage.com/topic/327261-collision-detection-order/#findComment-4948129 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.