Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load()
- c = 0
- posix = 0
- posiy = 0
- posfx = 0
- posfy = 0
- rotation = 0
- objects = {}
- objects.wall = {}
- love.graphics.setColor(0,0,0)
- love.graphics.setBackgroundColor(255,250,250)
- world = love.physics.newWorld(0, 0, 650, 650) --create a world for the bodies to exist in with width and height of 650
- world:setGravity(0, 700) --the x component of the gravity will be 0, and the y component of the gravity will be 700
- world:setMeter(64) --the height of a meter in this world will be 64px
- width = 100
- end
- function love.update(dt)
- world:update(dt)
- end
- function love.mousereleased(x, y, button)
- if button == 'l' then
- posix, posiy = x, y
- c = 2
- end
- end
- function love.draw()
- if(c == 2) then
- --line = love.graphics.line(posix, posiy, posfx, posfy)
- objects.wall.body7 = love.physics.newBody(world, posix, posiy, 0, 0)
- objects.wall.shape7 = love.physics.newRectangleShape(objects.wall.body7, 25, 25, 50, 50, rotation)
- objects.wall.shape7:setFriction(0)
- c = 3
- end
- if(c == 3) then
- love.graphics.polygon("line", objects.wall.shape7:getPoints())
- end
- love.graphics.rectangle("fill", love.mouse.getX(), love.mouse.getY(), width, 10)
- love.graphics.print("Rotacao " .. rotation, 50, 50)
- end
- function love.keyreleased(key)
- if key == "up" then
- rotation = rotation + 10
- elseif key == "down" then
- rotation = rotation - 10
- end
- if key == "p" then
- width = width + 10
- elseif key == "m" then
- width = width - 10
- end
- if key == "r" then
- love.filesystem.load("main.lua")()
- love.load()
- end
- end
Add Comment
Please, Sign In to add comment