Develop #4
@@ -8,9 +8,9 @@ function arrows.load(game, stage, camera)
|
||||
arrows.left_x = padding
|
||||
arrows.left_y = (game.canvas.height / 2) - (arrows.img_left:getHeight() /2)
|
||||
|
||||
arrows.img_rigth = love.graphics.newImage('assets/sprites/arrows/rigth.png')
|
||||
arrows.rigth_x = (game.canvas.width - arrows.img_rigth:getWidth()) - padding
|
||||
arrows.rigth_y = (game.canvas.height / 2) - (arrows.img_left:getHeight() /2)
|
||||
arrows.img_right = love.graphics.newImage('assets/sprites/arrows/right.png')
|
||||
arrows.right_x = (game.canvas.width - arrows.img_right:getWidth()) - padding
|
||||
arrows.right_y = (game.canvas.height / 2) - (arrows.img_left:getHeight() /2)
|
||||
arrows.game = game
|
||||
end
|
||||
|
||||
@@ -23,8 +23,8 @@ function arrows.draw()
|
||||
love.graphics.draw(arrows.img_left, arrows.left_x, arrows.left_y)
|
||||
end
|
||||
if arrows.game.level ~= arrows.game.end_level then
|
||||
love.graphics.draw(arrows.img_rigth, arrows.rigth_x, arrows.rigth_y)
|
||||
end
|
||||
love.graphics.draw(arrows.img_right, arrows.right_x, arrows.right_y)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -39,12 +39,34 @@ function love.mousepressed(mx, my, button)
|
||||
end
|
||||
end
|
||||
end
|
||||
if x2 >= (ww - arrows.img_rigth:getWidth()) then
|
||||
if mx >= (ww - x1 - arrows.img_rigth:getWidth()) and mx < (ww - arrows.img_rigth:getWidth()) then
|
||||
if my >= arrows.rigth_y and my < arrows.rigth_y + arrows.img_rigth:getHeight() then
|
||||
if x2 >= (ww - arrows.img_right:getWidth()) then
|
||||
same_size = false
|
||||
if ww == arrows.game.canvas.width and x1 == 0 then
|
||||
-- Verify canvas == world
|
||||
same_size = true
|
||||
end
|
||||
if same_size then
|
||||
-- canvas == world
|
||||
|
||||
print 'x'
|
||||
if mx >= arrows.right_x then
|
||||
print 'y'
|
||||
print(my)
|
||||
print(arrows.right_y)
|
||||
if my >= arrows.left_y and my < arrows.left_y + arrows.img_left:getHeight() then
|
||||
arrows.game:nextLevel()
|
||||
end
|
||||
end
|
||||
else
|
||||
-- large world - scroll cam
|
||||
if mx >= (ww - x1 - arrows.img_right:getWidth())
|
||||
and mx <= (ww - arrows.img_right:getWidth())
|
||||
or same_size then
|
||||
if my >= arrows.right_y and my < arrows.right_y + arrows.img_right:getHeight() then
|
||||
arrows.game:nextLevel()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,12 +4,12 @@ local gamera = require 'assets/scripts/vendor/gamera'
|
||||
function game.load()
|
||||
-- Configuration
|
||||
math.randomseed(os.time())
|
||||
local width, height = 1279, 720
|
||||
local width, height = 1280, 720
|
||||
local canvas_width, canvas_height = 2280, 720
|
||||
game.window = { width = width , height = height }
|
||||
game.canvas = { x = width / 2, y= 0, width = canvas_width, height = canvas_height }
|
||||
game.level = 1
|
||||
game.end_level = 5
|
||||
game.end_level = 8
|
||||
|
||||
love.window.setMode(game.window.width, game.window.height)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local stage1 = {}
|
||||
local image
|
||||
|
||||
function stage1.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_mesilla.jpg')
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_libros.jpg')
|
||||
stage1.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage1.world.w, stage1.world.h)
|
||||
arrows.load(game, stage1, camera)
|
||||
|
||||
@@ -6,7 +6,7 @@ local stage2 = {}
|
||||
local image
|
||||
|
||||
function stage2.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_chimenea.jpg')
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_tocadiscos.jpg')
|
||||
stage2.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage2.world.w, stage2.world.h)
|
||||
arrows.load(game, stage2, camera)
|
||||
|
||||
@@ -6,7 +6,7 @@ local stage2 = {}
|
||||
local image
|
||||
|
||||
function stage2.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_tocadiscos.jpg')
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_vacio.jpg')
|
||||
stage2.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage2.world.w, stage2.world.h)
|
||||
arrows.load(game, stage2, camera)
|
||||
|
||||
@@ -6,7 +6,7 @@ local stage4 = {}
|
||||
local image
|
||||
|
||||
function stage4.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_libros.jpg')
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_mesilla.jpg')
|
||||
stage4.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage4.world.w, stage4.world.h)
|
||||
arrows.load(game, stage4, camera)
|
||||
|
||||
@@ -6,7 +6,7 @@ local stage5 = {}
|
||||
local image
|
||||
|
||||
function stage5.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_fotomadre.jpg')
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_puerta.jpg')
|
||||
stage5.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage5.world.w, stage5.world.h)
|
||||
arrows.load(game, stage5, camera)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
local anim8 = require 'assets/scripts/vendor/anim8'
|
||||
local tools = require 'assets/scripts/tools'
|
||||
local arrows = require 'assets/scripts/arrows'
|
||||
|
||||
local stage6 = {}
|
||||
local image
|
||||
|
||||
function stage6.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_chimenea.jpg')
|
||||
stage6.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage6.world.w, stage6.world.h)
|
||||
arrows.load(game, stage6, camera)
|
||||
game.canvas.x = game.window.width / 2
|
||||
end
|
||||
|
||||
function stage6.update(dt, game)
|
||||
arrows.update(dt)
|
||||
end
|
||||
|
||||
function stage6.draw()
|
||||
love.graphics.draw(image)
|
||||
arrows.draw()
|
||||
end
|
||||
|
||||
return stage6
|
||||
@@ -0,0 +1,25 @@
|
||||
local anim8 = require 'assets/scripts/vendor/anim8'
|
||||
local tools = require 'assets/scripts/tools'
|
||||
local arrows = require 'assets/scripts/arrows'
|
||||
|
||||
local stage7 = {}
|
||||
local image
|
||||
|
||||
function stage7.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_armario.jpg')
|
||||
stage7.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage7.world.w, stage7.world.h)
|
||||
arrows.load(game, stage7, camera)
|
||||
game.canvas.x = game.window.width / 2
|
||||
end
|
||||
|
||||
function stage7.update(dt, game)
|
||||
arrows.update(dt)
|
||||
end
|
||||
|
||||
function stage7.draw()
|
||||
love.graphics.draw(image)
|
||||
arrows.draw()
|
||||
end
|
||||
|
||||
return stage7
|
||||
@@ -0,0 +1,25 @@
|
||||
local anim8 = require 'assets/scripts/vendor/anim8'
|
||||
local tools = require 'assets/scripts/tools'
|
||||
local arrows = require 'assets/scripts/arrows'
|
||||
|
||||
local stage8 = {}
|
||||
local image
|
||||
|
||||
function stage8.load(game, camera)
|
||||
image = love.graphics.newImage('assets/sprites/background/fondo_vacio.jpg')
|
||||
stage8.world = { w = image:getWidth(), h= 720}
|
||||
game:setNewSizeWorld(stage8.world.w, stage8.world.h)
|
||||
arrows.load(game, stage8, camera)
|
||||
game.canvas.x = game.window.width / 2
|
||||
end
|
||||
|
||||
function stage8.update(dt, game)
|
||||
arrows.update(dt)
|
||||
end
|
||||
|
||||
function stage8.draw()
|
||||
love.graphics.draw(image)
|
||||
arrows.draw()
|
||||
end
|
||||
|
||||
return stage8
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user