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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
keco2002
Prole
Posts: 4
Joined: Tue Mar 13, 2018 9:13 pm

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

Post 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
Attachments
easytrack.png
easytrack.png (10.24 KiB) Viewed 2602 times
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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?
keco2002
Prole
Posts: 4
Joined: Tue Mar 13, 2018 9:13 pm

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

Post by keco2002 »

well i did attatch my code but i guess it messed that up
racer.zip
(160.38 KiB) Downloaded 107 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Mathisto, Semrush [Bot] and 48 guests