Moving tile codeÄ
Code: Select all
local newobj={}
newobj.body = love.physics.newBody(world,i*32-32,j*32-32,"dynamic")
newobj.shape = love.physics.newRectangleShape(32,32)
newobj.fixture = love.physics.newFixture(newobj.body, newobj.shape)
newobj.body:setAwake(false)
newobj.id = layout[j][i]
newobj.fixture:setFriction(100)
newobj.fixture:setDensity(100)
newobj.body:setMass(0.01)
newobj.fixture:setCategory(2)
newobj.fixture:setMask(2)
Code: Select all
local newobj={}
newobj.body = love.physics.newBody(world,i*32-32,j*32-32,"static")
newobj.shape = love.physics.newRectangleShape(32,32)
newobj.fixture = love.physics.newFixture(newobj.body, newobj.shape)
newobj.fixture:setFriction(100)
Wrecking ball codeÄ
Code: Select all
ball.body = love.physics.newBody(world,player.x,player.y+96,"dynamic")
ball.shape = love.physics.newCircleShape(15)
ball.fixture = love.physics.newFixture(ball.body, ball.shape)
ball.body:setMass(500)
Code: Select all
player.body = love.physics.newBody(world,player.x,player.y,"kinematic")
player.shape = love.physics.newRectangleShape(2,2)
player.fixture = love.physics.newFixture(player.body, player.shape)
player.fixture:setMask(2)
Code: Select all
ropeJoint = love.physics.newRevoluteJoint(player.body, ball.body, 1, 1, 16, 16, 16, false)
Up, down: move crane up/down
Left, right: move crame left/right
Music by Eiffel 65
Löve 0.8.0
Compiled with LÖVIDE
Move to the right to find the building to wreck, the movable blocks are reddish
EditÄ For some reason I canöt include the .love file in an attachment, so hereös a dropbox linkÄ
https://dl.dropboxusercontent.com/u/21596039/Game.love