Page 1 of 1

2 questions..

Posted: Thu Feb 25, 2010 6:50 pm
by Deecodeuh
Hello, I have 2 questions about my code..

1. Why does mario look like he's floating on the ground?
2. Why does mario fall through the ground after a minute or two? Does it have something to do with garbage collecting?

Thanks in advance. :)

Re: 2 questions..

Posted: Thu Feb 25, 2010 7:17 pm
by Robin
Deecodeuh wrote:2. Why does mario fall through the ground after a minute or two? Does it have something to do with garbage collecting?
You have to store a reference to the shapes:

Code: Select all

function generateLevel()
  --ground
  ground = love.physics.newBody(world, 0, 576, 0)
  ground_shape = love.physics.newRectangleShape(ground, 0, 0, 15360, 64)

  --left wall
  wall = love.physics.newBody(world, 0, 0, 0)
  wall_shape = love.physics.newRectangleShape(wall, 0, 0, 10, 1000)

end