function love.load(arg)
player = { x = 200, y = 210, speed = 150, img = nil }
player.img=love.graphics.newImage ("char.png")
love.physics.setMeter (32)
world = love.physics.newWorld(0 , 32*9.81)
player.body = love.physics.newBody (world, player.x, player.y, dynamic)
player.shape = love.physics.newRectangleShape(32, 64)
player.fixture = love.physics.newFixture (player.body, player.shape, 5)
end
function love.update(dt)
if love.keyboard.isDown ("a") then
player.x=player.x-player.speed*dt
end
if love.keyboard.isDown ("d") then
player.x=player.x+player.speed*dt
end
end
function love.draw(dt)
love.graphics.draw(player.img, player.x, player.y)
end
I can move right and left my character but he doesn't fall down. Why?
(Scuse me if i've done some grammar error, i can't speak english very well)
function love.load()
player = { x = 200, y = 210, speed = 150, img = nil }
player.img=love.graphics.newImage ("char.png")
love.physics.setMeter (32)
world = love.physics.newWorld(0 , 32*9.81)
player.body = love.physics.newBody (world, player.x, player.y, dynamic)
player.shape = love.physics.newRectangleShape(32, 64)
player.fixture = love.physics.newFixture (player.body, player.shape, 5)
end
function love.update(dt)
world:update (dt)
if love.keyboard.isDown ("a") then
player.x=player.x-player.speed*dt
end
if love.keyboard.isDown ("d") then
player.x=player.x+player.speed*dt
end
end
function love.draw()
love.graphics.draw(player.img, player.x, player.y)
end
dynamic is a variable, probably not set so it's nil by default,
you wanted to write 'dynamic', a string.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.