Page 1 of 1

i keep getting out of range pixel when using a certain method for collision detection

Posted: Sun Sep 16, 2018 1:29 am
by keco2002
so im making a top down kart racing game and it is coming along great, but i am using a kind of strange method for collision detection because i am so bad at coding. you see i made a separate picture of the track so that i can make certain areas do something a little different, for example, blue is a blockade, red slows you down, and green is road.
The attachment easytrackcolisionmap.png is no longer available
The attachment easytrack.png is no longer available
but whenever i load up the game the collision doesn't work at all, the speed will act as if i'm in the gravel on certain parts of the road and acts as if i am touching a wall in other parts and sometime i can just go through walls.
The attachment easytrackcolisionmap.png is no longer available

Re: i keep getting out of range pixel when using a certain method for collision detection

Posted: Sun Sep 16, 2018 8:21 am
by pgimeno
Hello!

The forums don't seem to allow attaching more than one image per post (I've had that myself), but more importantly, it's impossible to know what you're doing wrong without having any code to look into. How about you attach a .love file with the project?

Re: i keep getting out of range pixel when using a certain method for collision detection

Posted: Sun Sep 16, 2018 1:16 pm
by keco2002
well i did attatch my code but i guess it messed that up
racer.zip
(160.38 KiB) Downloaded 108 times
either way i already fixed the issue much later after writing the question, sorry.

for anyone doing this method of collision detection my issue was that the middle of my map was 0,0 and so i just had to subtract half the width and height of the map from the proper vars.