Search found 107 matches
- Sat Jan 08, 2022 10:57 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3418
Re: Problems when using world callbacks[Solved]
You don't know which of a or b is going to be the player and which is going to be the platform. You need to check both, but you only check b. Also, which one is the fixture? self.fixture or self.physics.fixture? self.physics.fixture and now i corrected the check for b to also be self.physics.fixture
- Sat Jan 08, 2022 10:55 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3418
Re: Problems when using world callbacks
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...
- Sat Jan 08, 2022 10:17 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3418
Re: Problems when using world callbacks
Tysm! It atleast doesnt crash anymore, now i can acctually implement functioning gravity.grump wrote: ↑Sat Jan 08, 2022 12:28 amCode: Select all
-- not correct world:setCallbacks(player.beginContact) -- correct world:setCallbacks(function(a, b, c) player:beginContact(a, b, c) end)
- Sat Jan 08, 2022 10:13 am
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3418
Re: Problems when using world callbacks
Can you post your World:setCallbacks call? In main.lua 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
- Fri Jan 07, 2022 9:14 pm
- Forum: Support and Development
- Topic: Problems when using world callbacks[Solved]
- Replies: 12
- Views: 3418
Problems when using world callbacks[Solved]
Hello, for some reason i get the error message "Error player.lua:93: attempt to index local 'coll' (a nil value)'" when this code gets used : function Player:beginContact(a, b, coll) if self.grounded == true then return end local mx,my = coll:getNormal() if b == self.physics.fixture then i...
- Mon Jan 03, 2022 7:21 pm
- Forum: Support and Development
- Topic: How to use self. and how to run a script multiple times
- Replies: 2
- Views: 1299
- Mon Jan 03, 2022 5:58 pm
- Forum: Support and Development
- Topic: How to use self. and how to run a script multiple times
- Replies: 2
- Views: 1299
How to use self. and how to run a script multiple times
Hello, i have just recently started using Lua and Löve and i cant grasp the concept of using more then the main.lua file. I am working on a game where i want to make multiple enemies fall from the ceeling and in this example i would like to know how to create multiple cubes of the same script and ho...