Computer Science Canada How Do I Code A Pic.Draw to Sense Collisions from all points of Player.

 Author: jaki723 [ Mon Jun 05, 2023 5:01 pm ] Post subject: How Do I Code A Pic.Draw to Sense Collisions from all points of Player. What is it you are trying to achieve? I'm trying to get collision for falling so that it sense all parts of the player sprite and not just two separate points like I have done. If there is a better way by using something else like a draw box or something please let me know. What is the problem you are having? It creates too much code if we want to input every single coordinate of the sprite. With only two points the player will fall off edges and sometimes not even sense smaller objects. Describe what you have tried to solve this problem I don't know what else to try to solve this problem. I don't want too much code but I can't seem to simplify it. Please specify what version of Turing you are using I'm using Turing 4.1.1

 Author: scholarlytutor [ Thu Jun 08, 2023 11:55 am ] Post subject: RE:How Do I Code A Pic.Draw to Sense Collisions from all points of Player. Thanks for including the code and pictures. I got the program running. I assume you're talking about when the character falls down a pit, correct? I see no need to have to sense all the pixels in the sprite. The only thing that matters is the y value of any of the bottom pixels. I believe Pic.Draw uses the bottom left pixel as the position where the character is drawn from So as soon as the Y value of that bottom left pixel becomes 0 (meaning they have touched the bottom edge of the screen), they need to stop falling and you should show the damaged character (perhaps with a delay of 250-500 milliseconds) then put the normal picture back on top. For falling off platforms, if the character is moving left, it should be their x value + how many pixels wide the character is which determines whether they fall, so they don't start to fall too early, which seems to be happening at the moment. If I'm misunderstanding anything, please feel free to clarify.

 :