2 questions..

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Deecodeuh
Citizen
Posts: 70
Joined: Tue Dec 15, 2009 3:18 am
Location: Michigan, USA

2 questions..

Post 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. :)
Attachments
mario.love
(270.15 KiB) Downloaded 113 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: 2 questions..

Post 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
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests