function Player:beginContact(a, b, coll)
if self.grounded == true then return end
local mx,my = coll:getNormal()
if b == self.physics.fixture then
if my > 0 then
self:Land()
end
elseif b == self.fixture then
if my < 0 then
self:Land()
end
end
end
Last edited by NoreoAlles on Sat Jan 08, 2022 10:19 am, edited 1 time in total.
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
function love.load()
World = love.physics.newWorld(0, 0)
World:setCallbacks(beginContact, endContact)
...
end
function beginContact(a, b, coll)
Player:beginContact()
end
function endContact(a, b, coll)
Player:endContact()
end
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
Something suspicious is a possible confusion between the player class and the player instance. But that's an entirely different thing.
So, i did some testing and found out that when the player is on the ground from frame 1, that the script does work and y Vel is 0. That means it simply isnt updated (correct me if im wrong, but everything gets executed once when starting, right?) Buuuut, you`re probably right with your susspicion. Everytime i try to put the beginContact function into any function that ends up in love.update, i get an index error. I do not know how to fix this.
Last edited by NoreoAlles on Sat Jan 08, 2022 10:56 am, edited 1 time in total.
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle