pacgreg #1 Posted December 18, 2013 I'm trying to figure out a way to detect if there is a playfield part between two sprites, and use that to switch a bit on or off to be used elsewhere, something like the enemies in marauder switching invisible/visible when on the opposite side of a playfield part. Does anyone know how I would accomplish this? Quote Share this post Link to post Share on other sites
+Random Terrain #2 Posted December 18, 2013 So you are wanting to do something similar to what is in the post below? atariage.com/forums/topic/152123-bloober-and-the-gnarl/?p=1864981 One way is to convert the positions of the two sprites to playfield coordinates, then use pfread to look between them. Quote Share this post Link to post Share on other sites
pacgreg #3 Posted December 18, 2013 I was thinking about something like this, I guess I'll have to break out some algebra to find out points between them. Thank you! Quote Share this post Link to post Share on other sites
pacgreg #4 Posted January 9, 2014 My game doesn't move on a grid, where do I look for playfield so that it isn't too or too little sensitive. I tried fourths and it wasnt sensitive enough, and fifths or more slow down my game. How did you get it working? Quote Share this post Link to post Share on other sites
+Random Terrain #5 Posted January 9, 2014 My game doesn't move on a grid, where do I look for playfield so that it isn't too or too little sensitive. I tried fourths and it wasnt sensitive enough, and fifths or more slow down my game. How did you get it working? In a game like Marauder, your position determines what is seen. I don't know how to do that yet. The only thing I have done is have an enemy check the playfield in the direction that he is looking/moving. If he sees a playfield pixel, he continues his normal activities. If he sees the player, the enemy speeds up. Quote Share this post Link to post Share on other sites
RetroFiends #6 Posted January 11, 2014 The first thing that comes to mind is to do it in such a way that is similar to software collisions. Simply check if there is a playfield pixel at a y coordinate that is +- the sprites' y positions. Of course, this is easier said and done, and will likely include many if statements, especially if it needs to be true for both players. You'll probably need to use pfread, which can take variables and arrays as arguements. So, you'll probably need to set a counter that goes from 0 to 31 to check each position to see if there's a pixel, then plug that into an array which gives you the actual x positions of those pixels, the y position in the pf read argument can be the playery's y position rounded to the pixel rows as you see fit. Then, you check the second player, and see if they match up.In practice however, it would seem that this code would take up way too many cycles to ever actually be useful. If you know the places where the pfpixels are, you can cut down on the redundant checking and go straight to the comparison.In the case of a game like maurader though, this whole thing is way more complex and out of my jurisdiction. Pretty much what you're asking for is line of sight. and in that case, you'll need to check if there is a pixel within the player's line of site, and if not, show the sprites in the direction of the player's line of site. You will definitely need to do some calculations for something like that. Quote Share this post Link to post Share on other sites