Here my question: I try to get the PhysicsBody-mixing running, but have problems doing so. Before getting into the details... It would be cool, to have a downloadable project, with example stuff in it - then maybe questions like this would become obsolete.
Here I define the Player-object.
Code: Select all
require 'mogamett/mogamett'
-- physics enabled entity template
Player = mg.class('Player', 'Entity')
Player:implement(mg.PhysicsBody)
function Player:new(world, x, y, settings)
Player.super.new(self, world, x, y, settings)
self:physicsBodyNew(world, x, y, settings)
end
function Player:update(dt)
self:physicsBodyUpdate(dt)
end
function Player:draw()
self:physicsBodyDraw()
end
Code: Select all
player = Player(mg.world, 100, 100,{})
mogamett/mixins/PhysicsBody.lua:53 attempt to index a nil value
Going back to Player.lua line 9:
Code: Select all
self:physicsBodyNew(world, x, y, settings)
player = Player.new(mg.world, 100, 100) or player = Player:new(mg.world, 100, 100,{})