So, I really can figure out how to get this darn thing to work. My collision for the top and bottom, are the same for left and right.
In the col.lua it reads a png to see the collision map...
Lots of cool code for spawning mobs and players, so, feel free to use!
Thanks
Nate
edit: I fixed it just added like one pixel padding
Left and Right Collision Detection Help! [FIXED]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Left and Right Collision Detection Help! [FIXED]
- Attachments
-
- Game.love
- (5.71 KiB) Downloaded 151 times
Last edited by TheP3 on Sun Aug 26, 2012 1:29 am, edited 1 time in total.
I write rules for my computer... I'm not the ruler of the world(yet)... Also, I livestream stuff http://NateAGeek.com/Live
Re: Left and Right Collision Detection Help! .love file incl
Which part do you need help with? When I first tried it, it seems that when the player is on the ground they can't move left, but right works fine. I changed the code so that it is
And now left and right movement on the ground works.
Code: Select all
if typecol == "left" then
if ColMap[math.floor(obj1x/32)][math.floor((obj1y + obj1h - 1)/32)] == 1 then
print("Left")
return true
else
return false
end
end
if typecol == "rigth" then
if ColMap[math.floor((obj1x + obj1w)/32)][math.floor((obj1y + obj1h - 1)/32)] == 1 then
print("Right")
return true
else
return false
end
end
Who is online
Users browsing this forum: MummyTheTiger and 3 guests