and stuff
This commit is contained in:
29
game.lua
29
game.lua
@@ -44,6 +44,8 @@ function Chu.new(x, y, debug)
|
|||||||
world:addClass('Player')
|
world:addClass('Player')
|
||||||
world:addClass('GamePlan')
|
world:addClass('GamePlan')
|
||||||
world:addClass('Crate')
|
world:addClass('Crate')
|
||||||
|
world:addClass('Pier')
|
||||||
|
world:addClass('Crane')
|
||||||
obj.gamePlan = world:addChain(true, {
|
obj.gamePlan = world:addChain(true, {
|
||||||
x - PLAN_SIZE.marginX, y - PLAN_SIZE.marginY,
|
x - PLAN_SIZE.marginX, y - PLAN_SIZE.marginY,
|
||||||
x + PLAN_SIZE.w + PLAN_SIZE.marginX, y - PLAN_SIZE.marginY,
|
x + PLAN_SIZE.w + PLAN_SIZE.marginX, y - PLAN_SIZE.marginY,
|
||||||
@@ -51,6 +53,25 @@ function Chu.new(x, y, debug)
|
|||||||
x - PLAN_SIZE.marginX, y + PLAN_SIZE.h + PLAN_SIZE.marginY
|
x - PLAN_SIZE.marginX, y + PLAN_SIZE.h + PLAN_SIZE.marginY
|
||||||
}):setClass('GamePlan')
|
}):setClass('GamePlan')
|
||||||
|
|
||||||
|
obj.pier = world:addRectangle(x + 80 - (PLAN_SIZE.marginX/2), y + PLAN_SIZE.h - 64, 160 + PLAN_SIZE.marginX, 128)
|
||||||
|
obj.pier:setType('static')
|
||||||
|
|
||||||
|
--[[obj.crane = world:addChain(true, {
|
||||||
|
x + 36, y + 80,
|
||||||
|
x + 36 + assets.sprites.crane:getWidth(), y + 80,
|
||||||
|
x + 36 + assets.sprites.crane:getWidth(), y + 80 + assets.sprites.crane:getHeight(),
|
||||||
|
x + 36, y + 80 + assets.sprites.crane:getHeight()
|
||||||
|
}):setClass('Crane')
|
||||||
|
|
||||||
|
obj.moving = world:addRectangle(x + (36/2) + 1, y + 40 + 1, assets.sprites.movingstuff:getWidth() - 2, assets.sprites.movingstuff:getHeight() - 2)
|
||||||
|
]]--
|
||||||
|
|
||||||
|
obj.crane = {}
|
||||||
|
obj.crane.top = world:addRectangle(x + (assets.sprites.crane:getWidth()/2) + (18*2), y + 84, assets.sprites.crane:getWidth(), 6)
|
||||||
|
obj.crane.top:setType('static')
|
||||||
|
obj.crane.left = world:addRectangle(x + 36, y + 87, 6, assets.sprites.crane:getHeight() - 12)
|
||||||
|
obj.crane.left:setType('static')
|
||||||
|
|
||||||
magnet.collider = world:addRectangle(x + 50, y + 50, magnet.w, magnet.h):setClass('Player')
|
magnet.collider = world:addRectangle(x + 50, y + 50, magnet.w, magnet.h):setClass('Player')
|
||||||
magnet.collider:setRestitution(0)
|
magnet.collider:setRestitution(0)
|
||||||
|
|
||||||
@@ -119,6 +140,14 @@ function Chu:draw()
|
|||||||
love.graphics.draw(assets.sprites.level.background, self.x, self.y)
|
love.graphics.draw(assets.sprites.level.background, self.x, self.y)
|
||||||
love.graphics.draw(assets.sprites.level.clouds, self.x, self.y + 32)
|
love.graphics.draw(assets.sprites.level.clouds, self.x, self.y + 32)
|
||||||
love.graphics.draw(assets.sprites.level.clouds, self.x, self.y, 0, -1, 1, assets.sprites.level.clouds:getWidth())
|
love.graphics.draw(assets.sprites.level.clouds, self.x, self.y, 0, -1, 1, assets.sprites.level.clouds:getWidth())
|
||||||
|
|
||||||
|
love.graphics.draw(assets.sprites.cranevert, self.x + 60, self.y + PLAN_SIZE.h - 456)
|
||||||
|
love.graphics.draw(assets.sprites.cranevert, self.x + PLAN_SIZE.w - 112, self.y + PLAN_SIZE.h - 456)
|
||||||
|
love.graphics.draw(assets.sprites.crane, self.x + 36, self.y + 80)
|
||||||
|
|
||||||
|
|
||||||
|
love.graphics.draw(assets.sprites.level.pier, self.x, self.y + PLAN_SIZE.h - 128)
|
||||||
|
|
||||||
world:draw()
|
world:draw()
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
|
|||||||
13
main.lua
13
main.lua
@@ -1,5 +1,5 @@
|
|||||||
-- Chuchu by Makaron
|
-- Chuchu by Makaron
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = false
|
||||||
-- my own libs
|
-- my own libs
|
||||||
Chu = require 'game'
|
Chu = require 'game'
|
||||||
|
|
||||||
@@ -18,10 +18,13 @@ assets = require('deps.cargo').init({
|
|||||||
local game = nil
|
local game = nil
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
if DEBUG_MODE then love.window.setMode(1024, 900)
|
if DEBUG_MODE then
|
||||||
else love.window.setMode(512, 512) end
|
love.window.setMode(1024, 900)
|
||||||
|
game = Chu.new(200, 200, true)
|
||||||
game = Chu.new(200, 200, DEBUG_MODE)
|
else
|
||||||
|
love.window.setMode(512, 512)
|
||||||
|
game = Chu.new(0, 0, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
|
|||||||
Reference in New Issue
Block a user