Bill246 Posted January 4 Share Posted January 4 I'm a novice/hobbyist programmer and nearly lifelong Intellivison fan. Lately I've been having fun making graphics and animations with Inty Basic. Right now I'm trying to make collision detection work, but I'm not having any success. My program consists of an animated helicopter and a fuel tank at which moves across the bottom of the screen, like in Super Cobra. The helicopter is 16-pixesl wide. The right half of it is SPRITE 0. The left half is SPRITE 1. The fuel tank is also made up of 2 sprites, SPRITE 2 and SPRITE 3. Here is my code which is supposed to detect a collision between the helicopter and the fuel tank: IF COL0 AND HIT_SPRITE2 THEN PRINT AT 0 COLOR 2, "COLLISION!" WAIT x=10 y=10 END IF Can anyone tell if it's incorrect? I looked at examples in Oscar's book and demos from the Inty Basic collection but can't figure out what's wrong with mine. All I want it to do is let me know when a collision occurs. Once I get it working, then I'll draw an explosion or something. I can post my entire code if necessary. Thanks. Bill Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted January 4 Share Posted January 4 Hi, Bill, Welcome to the forum! A couple of things to check that could affect collisions: The COLx variables will only be set on the next frame after moving the sprites, so you should test them after a WAIT statement, or close to it. You need to make sure that your sprites have the "interaction" flag set. This is bit 8 ($0100) on the X register, or using the HIT constant from the "Constants.bas" file. Let me know if any of that helps. If not, we'll dig deeper. Cheers! -dZ. 1 Quote Link to comment Share on other sites More sharing options...
Bill246 Posted January 8 Author Share Posted January 8 Thanks a lot for the suggestions. Once I put in the HIT constant, it worked. I encountered a few other problems, but by looking at the "game2" demo from Inty Basic, and at other topics in this forum, I was able to make progress. Bill 2 Quote Link to comment 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.