Compare commits
No commits in common. "8440be2ab1162fba986d7ff98350b5ff2f07fe1c" and "f689632a92a031f3952d819e3b937d2bbd05177d" have entirely different histories.
8440be2ab1
...
f689632a92
@ -20,7 +20,6 @@ function GameKeyPressed(key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- debug map changes!
|
-- debug map changes!
|
||||||
--[[
|
|
||||||
if DebugFlag and key == "1" then
|
if DebugFlag and key == "1" then
|
||||||
_G.CUR_LEVEL = 1
|
_G.CUR_LEVEL = 1
|
||||||
RestartGame()
|
RestartGame()
|
||||||
@ -31,10 +30,4 @@ function GameKeyPressed(key)
|
|||||||
RestartGame()
|
RestartGame()
|
||||||
love.load()
|
love.load()
|
||||||
end
|
end
|
||||||
if DebugFlag and key == "3" then
|
|
||||||
_G.CUR_LEVEL = 3
|
|
||||||
RestartGame()
|
|
||||||
love.load()
|
|
||||||
end
|
|
||||||
--]]
|
|
||||||
end
|
end
|
||||||
|
@ -39,14 +39,6 @@ function UpdateGame(dt)
|
|||||||
|
|
||||||
for i, v in ipairs(Bullets1) do
|
for i, v in ipairs(Bullets1) do
|
||||||
v:update(dt)
|
v:update(dt)
|
||||||
|
|
||||||
-- Check bounce count
|
|
||||||
if v.bounce >= _G.BULLETS_BOUNCE_MAX then
|
|
||||||
table.remove(Bullets1, i)
|
|
||||||
v.collider:destroy()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle screen edges
|
|
||||||
if v.y < 0 then --top of screen
|
if v.y < 0 then --top of screen
|
||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
@ -54,8 +46,6 @@ function UpdateGame(dt)
|
|||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player2
|
|
||||||
if v.collider:enter("Player2") then
|
if v.collider:enter("Player2") then
|
||||||
print("Player1 hit Player2!")
|
print("Player1 hit Player2!")
|
||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
@ -65,7 +55,6 @@ function UpdateGame(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player1
|
|
||||||
if v.collider:enter("Player1") then
|
if v.collider:enter("Player1") then
|
||||||
print("Player 1 hit themselves!")
|
print("Player 1 hit themselves!")
|
||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
@ -74,24 +63,10 @@ function UpdateGame(dt)
|
|||||||
UserPlayer1.health = UserPlayer1.health - 1
|
UserPlayer1.health = UserPlayer1.health - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Hit another bullet
|
|
||||||
if v.collider:enter("Bullet1") then
|
|
||||||
table.remove(Bullets1, i)
|
|
||||||
v.collider:destroy()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, v in ipairs(Bullets2) do
|
for i, v in ipairs(Bullets2) do
|
||||||
v:update(dt)
|
v:update(dt)
|
||||||
|
|
||||||
-- Check bounce count
|
|
||||||
if v.bounce >= _G.BULLETS_BOUNCE_MAX then
|
|
||||||
table.remove(Bullets2, i)
|
|
||||||
v.collider:destroy()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle screen edges
|
|
||||||
if v.y < 0 then --top of screen
|
if v.y < 0 then --top of screen
|
||||||
table.remove(Bullets2, i)
|
table.remove(Bullets2, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
@ -100,7 +75,6 @@ function UpdateGame(dt)
|
|||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player2
|
|
||||||
if v.collider:enter("Player1") then
|
if v.collider:enter("Player1") then
|
||||||
print("Player2 hit Player1!")
|
print("Player2 hit Player1!")
|
||||||
table.remove(Bullets2, i)
|
table.remove(Bullets2, i)
|
||||||
@ -109,24 +83,16 @@ function UpdateGame(dt)
|
|||||||
UserPlayer2.health = UserPlayer2.health - 1
|
UserPlayer2.health = UserPlayer2.health - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player1
|
|
||||||
if v.collider:enter("Player2") then
|
if v.collider:enter("Player2") then
|
||||||
print("Player 2 hit themselves!")
|
print("Player 2 hit themselves!")
|
||||||
table.remove(Bullets2, i)
|
table.remove(Bullets2, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
|
|
||||||
if UserPlayer2.health > 0 then
|
if UserPlayer2.health > 0 then
|
||||||
UserPlayer2.health = UserPlayer2.health - 1
|
UserPlayer2.health = UserPlayer2.health - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Hit another bullet
|
|
||||||
if v.collider:enter("Bullet2") then
|
|
||||||
table.remove(Bullets2, i)
|
|
||||||
v.collider:destroy()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
UserPlayer1:handleKeys("w", "s", "a", "d", dt)
|
UserPlayer1:handleKeys("w", "s", "a", "d", dt)
|
||||||
UserPlayer2:handleKeys("up", "down", "left", "right", dt)
|
UserPlayer2:handleKeys("up", "down", "left", "right", dt)
|
||||||
UserPlayer1:updateCol()
|
UserPlayer1:updateCol()
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
--
|
--
|
||||||
GAMESTATE = "MENU"
|
GAMESTATE = "MENU"
|
||||||
|
|
||||||
-- Mute for game
|
|
||||||
MUTED = false
|
|
||||||
|
|
||||||
MENU_POS = 0
|
MENU_POS = 0
|
||||||
MENU_MAX = 3 --0 play, 1 ?, 2 ?, 3 quit
|
MENU_MAX = 3 --0 play, 1 ?, 2 ?, 3 quit
|
||||||
|
|
||||||
@ -19,7 +16,7 @@ PAUSE_POS = 0
|
|||||||
PAUSE_MAX = 2 -- 0 resume, 1 menu, 2 quit
|
PAUSE_MAX = 2 -- 0 resume, 1 menu, 2 quit
|
||||||
|
|
||||||
BULLETS_MAX = 10 -- MAX amount of bullets a player can shoot
|
BULLETS_MAX = 10 -- MAX amount of bullets a player can shoot
|
||||||
BULLETS_BOUNCE_MAX = 7 -- MAX amount of bounces before exploding!
|
--BULLETS_BOUCE_MAX = 7 -- MAX amount of bounces before exploding!
|
||||||
BULLETS_LIFETIME = 50
|
BULLETS_LIFETIME = 50
|
||||||
|
|
||||||
-- WIN flags for P1 and P2
|
-- WIN flags for P1 and P2
|
||||||
|
@ -29,30 +29,9 @@ function ClearBullets(bullets)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setNewLevelFromRandom(count)
|
|
||||||
local level = math.random(1, count)
|
|
||||||
_G.CUR_LEVEL = level
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getLevelCount()
|
|
||||||
local levelcount = 0
|
|
||||||
local suf = ".lua"
|
|
||||||
local files = love.filesystem.getDirectoryItems("maps/")
|
|
||||||
|
|
||||||
for _, file in ipairs(files) do
|
|
||||||
if string.find(file, suf) then
|
|
||||||
levelcount = levelcount + 1
|
|
||||||
--print(k .. ". " .. file) --outputs something like "1. main.lua"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return levelcount
|
|
||||||
end
|
|
||||||
|
|
||||||
function RestartGame()
|
function RestartGame()
|
||||||
setNewLevelFromRandom(getLevelCount())
|
|
||||||
|
|
||||||
-- Stop the music
|
-- Stop the music
|
||||||
--StopAllMusic()
|
StopAllMusic()
|
||||||
|
|
||||||
-- Clear the players collision
|
-- Clear the players collision
|
||||||
ClearPlayerCollision()
|
ClearPlayerCollision()
|
80
main.lua
80
main.lua
@ -1,55 +1,21 @@
|
|||||||
Object = require("libs/classic")
|
|
||||||
|
|
||||||
require("constants")
|
require("constants")
|
||||||
WF = require("libs/windfield")
|
WF = require("libs/windfield")
|
||||||
STI = require("libs/sti")
|
STI = require("libs/sti")
|
||||||
|
|
||||||
World = WF.newWorld(0, 0) --no gravity
|
World = WF.newWorld(0, 0) --no gravity
|
||||||
--World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames
|
World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames
|
||||||
World:addCollisionClass("Player1")
|
World:addCollisionClass("Player1")
|
||||||
World:addCollisionClass("Bullet1")
|
World:addCollisionClass("Bullet1")
|
||||||
World:addCollisionClass("Player2")
|
World:addCollisionClass("Player2")
|
||||||
World:addCollisionClass("Bullet2")
|
World:addCollisionClass("Bullet2")
|
||||||
World:addCollisionClass("Wall")
|
World:addCollisionClass("Wall")
|
||||||
|
|
||||||
require("restart")
|
|
||||||
require("player")
|
|
||||||
require("bullet")
|
|
||||||
require("mapsloader")
|
|
||||||
|
|
||||||
require("Game/UpdateGame")
|
|
||||||
require("Menu/UpdateMenu")
|
|
||||||
require("Pause/UpdatePause")
|
|
||||||
require("Win/UpdateWin")
|
|
||||||
|
|
||||||
require("Game/DrawGame")
|
|
||||||
require("Menu/DrawMenu")
|
|
||||||
require("Pause/DrawPause")
|
|
||||||
require("Win/DrawWin")
|
|
||||||
|
|
||||||
require("Game/GameKeyPressed")
|
|
||||||
require("Menu/MenuKeyPressed")
|
|
||||||
require("Pause/PauseKeyPressed")
|
|
||||||
require("Win/WinKeyPressed")
|
|
||||||
|
|
||||||
--Fonts used in the game
|
--Fonts used in the game
|
||||||
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60)
|
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60)
|
||||||
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12)
|
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12)
|
||||||
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45)
|
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45)
|
||||||
Walls = {}
|
Walls = {}
|
||||||
|
|
||||||
-- Music streaming
|
|
||||||
musicMenu = love.audio.newSource("music/menu.mp3", "stream") or nil
|
|
||||||
musicBattle = love.audio.newSource("music/battle.mp3", "stream") or nil
|
|
||||||
--musicStory = love.audio.newSource("music/story.mp3", "stream") or nil
|
|
||||||
|
|
||||||
musicPause = musicBattle:clone()
|
|
||||||
musicPause:setFilter({
|
|
||||||
type = "lowpass",
|
|
||||||
volume = 0.7,
|
|
||||||
highgain = 0.4,
|
|
||||||
})
|
|
||||||
|
|
||||||
function love.run()
|
function love.run()
|
||||||
if love.load then
|
if love.load then
|
||||||
love.load(love.arg.parseGameArguments(arg), arg)
|
love.load(love.arg.parseGameArguments(arg), arg)
|
||||||
@ -104,14 +70,34 @@ function love.run()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.load(args)
|
function love.load()
|
||||||
|
Object = require("libs/classic")
|
||||||
|
require("libs/restart")
|
||||||
|
require("player")
|
||||||
|
require("bullet")
|
||||||
|
require("mapsloader")
|
||||||
|
|
||||||
|
require("Game/UpdateGame")
|
||||||
|
require("Menu/UpdateMenu")
|
||||||
|
require("Pause/UpdatePause")
|
||||||
|
require("Win/UpdateWin")
|
||||||
|
|
||||||
|
require("Game/DrawGame")
|
||||||
|
require("Menu/DrawMenu")
|
||||||
|
require("Pause/DrawPause")
|
||||||
|
require("Win/DrawWin")
|
||||||
|
|
||||||
|
require("Game/GameKeyPressed")
|
||||||
|
require("Menu/MenuKeyPressed")
|
||||||
|
require("Pause/PauseKeyPressed")
|
||||||
|
require("Win/WinKeyPressed")
|
||||||
|
|
||||||
-- Set a random seed
|
-- Set a random seed
|
||||||
love.math.setRandomSeed(love.timer.getTime())
|
love.math.setRandomSeed(love.timer.getTime())
|
||||||
|
|
||||||
--Game values (reset after each load)
|
--Game consts
|
||||||
HEALTH = 3
|
HEALTH = 3
|
||||||
P1_DELAY = 0.5
|
DELAY = 0.5
|
||||||
P2_DELAY = 0.5
|
|
||||||
|
|
||||||
--Bullet lists
|
--Bullet lists
|
||||||
Bullets1 = {}
|
Bullets1 = {}
|
||||||
@ -120,16 +106,28 @@ function love.load(args)
|
|||||||
DebugFlag = false
|
DebugFlag = false
|
||||||
EnableKeyPress1 = true
|
EnableKeyPress1 = true
|
||||||
KeyPressTime1 = 0
|
KeyPressTime1 = 0
|
||||||
KeyDelay1 = P1_DELAY
|
KeyDelay1 = DELAY
|
||||||
|
|
||||||
EnableKeyPress2 = true
|
EnableKeyPress2 = true
|
||||||
KeyPressTime2 = 0
|
KeyPressTime2 = 0
|
||||||
KeyDelay2 = P2_DELAY
|
KeyDelay2 = DELAY
|
||||||
|
|
||||||
local playerSpeed = 12000
|
local playerSpeed = 12000
|
||||||
UserPlayer1 = Player(1, 1000, 100, HEALTH, "assets/player1.png", playerSpeed)
|
UserPlayer1 = Player(1, 1000, 100, HEALTH, "assets/player1.png", playerSpeed)
|
||||||
UserPlayer2 = Player(2, 200, 300, HEALTH, "assets/player2.png", playerSpeed)
|
UserPlayer2 = Player(2, 200, 300, HEALTH, "assets/player2.png", playerSpeed)
|
||||||
|
|
||||||
|
-- Music streaming
|
||||||
|
musicMenu = love.audio.newSource("music/menu.mp3", "stream") or nil
|
||||||
|
musicBattle = love.audio.newSource("music/battle.mp3", "stream") or nil
|
||||||
|
--musicStory = love.audio.newSource("music/story.mp3", "stream") or nil
|
||||||
|
|
||||||
|
musicPause = musicBattle:clone()
|
||||||
|
musicPause:setFilter({
|
||||||
|
type = "lowpass",
|
||||||
|
volume = 0.7,
|
||||||
|
highgain = 0.4,
|
||||||
|
})
|
||||||
|
|
||||||
--STI Map loading
|
--STI Map loading
|
||||||
LoadMap(_G.CUR_LEVEL)
|
LoadMap(_G.CUR_LEVEL)
|
||||||
end
|
end
|
||||||
|
368
maps/map3.lua
368
maps/map3.lua
@ -1,368 +0,0 @@
|
|||||||
return {
|
|
||||||
version = "1.10",
|
|
||||||
luaversion = "5.1",
|
|
||||||
tiledversion = "1.11.0",
|
|
||||||
class = "",
|
|
||||||
orientation = "orthogonal",
|
|
||||||
renderorder = "right-down",
|
|
||||||
width = 25,
|
|
||||||
height = 15,
|
|
||||||
tilewidth = 64,
|
|
||||||
tileheight = 64,
|
|
||||||
nextlayerid = 4,
|
|
||||||
nextobjectid = 23,
|
|
||||||
properties = {},
|
|
||||||
tilesets = {
|
|
||||||
{
|
|
||||||
name = "tileset",
|
|
||||||
firstgid = 1,
|
|
||||||
class = "",
|
|
||||||
tilewidth = 64,
|
|
||||||
tileheight = 64,
|
|
||||||
spacing = 0,
|
|
||||||
margin = 0,
|
|
||||||
columns = 9,
|
|
||||||
image = "../assets/tileset.png",
|
|
||||||
imagewidth = 576,
|
|
||||||
imageheight = 384,
|
|
||||||
objectalignment = "unspecified",
|
|
||||||
tilerendersize = "tile",
|
|
||||||
fillmode = "stretch",
|
|
||||||
tileoffset = {
|
|
||||||
x = 0,
|
|
||||||
y = 0
|
|
||||||
},
|
|
||||||
grid = {
|
|
||||||
orientation = "orthogonal",
|
|
||||||
width = 64,
|
|
||||||
height = 64
|
|
||||||
},
|
|
||||||
properties = {},
|
|
||||||
wangsets = {},
|
|
||||||
tilecount = 54,
|
|
||||||
tiles = {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
layers = {
|
|
||||||
{
|
|
||||||
type = "tilelayer",
|
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
width = 25,
|
|
||||||
height = 15,
|
|
||||||
id = 1,
|
|
||||||
name = "floor",
|
|
||||||
class = "",
|
|
||||||
visible = true,
|
|
||||||
opacity = 1,
|
|
||||||
offsetx = 0,
|
|
||||||
offsety = 0,
|
|
||||||
parallaxx = 1,
|
|
||||||
parallaxy = 1,
|
|
||||||
properties = {},
|
|
||||||
encoding = "lua",
|
|
||||||
data = {
|
|
||||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
|
|
||||||
19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = "tilelayer",
|
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
width = 25,
|
|
||||||
height = 15,
|
|
||||||
id = 2,
|
|
||||||
name = "inner walls",
|
|
||||||
class = "",
|
|
||||||
visible = true,
|
|
||||||
opacity = 1,
|
|
||||||
offsetx = 0,
|
|
||||||
offsety = 0,
|
|
||||||
parallaxx = 1,
|
|
||||||
parallaxy = 1,
|
|
||||||
properties = {},
|
|
||||||
encoding = "lua",
|
|
||||||
data = {
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 31, 0, 0, 0,
|
|
||||||
0, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 35, 54, 40, 0, 0, 0,
|
|
||||||
0, 51, 52, 53, 0, 0, 0, 0, 0, 31, 31, 31, 0, 0, 0, 0, 0, 42, 43, 44, 54, 11, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 11, 11, 11, 40, 40, 40, 0, 0, 0, 0, 0, 51, 52, 53, 31, 11, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 32, 32, 32, 33, 34, 35, 31, 31, 0, 0, 0, 54, 54, 31, 40, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 41, 41, 41, 42, 43, 44, 40, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 52, 53, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 33, 34, 34, 34, 35, 0, 0, 0, 0, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 42, 43, 43, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 54, 54, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 42, 43, 43, 43, 44, 0, 0, 0, 0, 0, 0, 0, 33, 34, 34, 34, 34, 35, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 51, 52, 52, 52, 53, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 44, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 52, 52, 52, 52, 53, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = "objectgroup",
|
|
||||||
draworder = "topdown",
|
|
||||||
id = 3,
|
|
||||||
name = "Walls",
|
|
||||||
class = "",
|
|
||||||
visible = false,
|
|
||||||
opacity = 1,
|
|
||||||
offsetx = 0,
|
|
||||||
offsety = 0,
|
|
||||||
parallaxx = 1,
|
|
||||||
parallaxy = 1,
|
|
||||||
properties = {},
|
|
||||||
objects = {
|
|
||||||
{
|
|
||||||
id = 1,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
width = 1600,
|
|
||||||
height = 16,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 2,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1584,
|
|
||||||
y = 0,
|
|
||||||
width = 16,
|
|
||||||
height = 960,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 3,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 0,
|
|
||||||
y = 944,
|
|
||||||
width = 1600,
|
|
||||||
height = 16,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 4,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 0,
|
|
||||||
y = 0,
|
|
||||||
width = 16,
|
|
||||||
height = 960,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 5,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 112,
|
|
||||||
y = 64,
|
|
||||||
width = 96,
|
|
||||||
height = 192,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 6,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 400,
|
|
||||||
y = 368,
|
|
||||||
width = 160,
|
|
||||||
height = 64,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 7,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 576,
|
|
||||||
y = 208,
|
|
||||||
width = 192,
|
|
||||||
height = 96,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 8,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 608,
|
|
||||||
y = 336,
|
|
||||||
width = 128,
|
|
||||||
height = 160,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 10,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 768,
|
|
||||||
y = 336,
|
|
||||||
width = 128,
|
|
||||||
height = 96,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 11,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 768,
|
|
||||||
y = 496,
|
|
||||||
width = 128,
|
|
||||||
height = 64,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 13,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 240,
|
|
||||||
y = 528,
|
|
||||||
width = 224,
|
|
||||||
height = 224,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 14,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1008,
|
|
||||||
y = 656,
|
|
||||||
width = 272,
|
|
||||||
height = 144,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 15,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1168,
|
|
||||||
y = 592,
|
|
||||||
width = 160,
|
|
||||||
height = 32,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 16,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1120,
|
|
||||||
y = 144,
|
|
||||||
width = 128,
|
|
||||||
height = 160,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 17,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1104,
|
|
||||||
y = 336,
|
|
||||||
width = 96,
|
|
||||||
height = 32,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 19,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1216,
|
|
||||||
y = 336,
|
|
||||||
width = 64,
|
|
||||||
height = 96,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 20,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1280,
|
|
||||||
y = 80,
|
|
||||||
width = 64,
|
|
||||||
height = 288,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = 22,
|
|
||||||
name = "",
|
|
||||||
type = "",
|
|
||||||
shape = "rectangle",
|
|
||||||
x = 1344,
|
|
||||||
y = 80,
|
|
||||||
width = 64,
|
|
||||||
height = 96,
|
|
||||||
rotation = 0,
|
|
||||||
visible = true,
|
|
||||||
properties = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="25" height="15" tilewidth="64" tileheight="64" infinite="0" nextlayerid="4" nextobjectid="23">
|
|
||||||
<editorsettings>
|
|
||||||
<export target="map3.lua" format="lua"/>
|
|
||||||
</editorsettings>
|
|
||||||
<tileset firstgid="1" name="tileset" tilewidth="64" tileheight="64" tilecount="54" columns="9">
|
|
||||||
<image source="../assets/tileset.png" width="576" height="384"/>
|
|
||||||
</tileset>
|
|
||||||
<layer id="1" name="floor" width="25" height="15">
|
|
||||||
<data encoding="csv">
|
|
||||||
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,
|
|
||||||
19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21
|
|
||||||
</data>
|
|
||||||
</layer>
|
|
||||||
<layer id="2" name="inner walls" width="25" height="15">
|
|
||||||
<data encoding="csv">
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,33,34,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,31,0,0,0,
|
|
||||||
0,42,43,44,0,0,0,0,0,0,0,0,0,0,0,0,0,33,34,35,54,40,0,0,0,
|
|
||||||
0,51,52,53,0,0,0,0,0,31,31,31,0,0,0,0,0,42,43,44,54,11,0,0,0,
|
|
||||||
0,0,0,0,0,0,11,11,11,40,40,40,0,0,0,0,0,51,52,53,31,11,0,0,0,
|
|
||||||
0,0,0,0,0,0,32,32,32,33,34,35,31,31,0,0,0,54,54,31,40,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,41,41,41,42,43,44,40,40,0,0,0,0,0,40,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,51,52,53,32,32,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,33,34,34,34,35,0,0,0,0,41,41,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,42,43,43,43,44,0,0,0,0,0,0,0,0,0,0,54,54,54,0,0,0,0,
|
|
||||||
0,0,0,42,43,43,43,44,0,0,0,0,0,0,0,33,34,34,34,34,35,0,0,0,0,
|
|
||||||
0,0,0,51,52,52,52,53,0,0,0,0,0,0,0,42,43,43,43,43,44,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,52,52,52,52,53,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|
||||||
</data>
|
|
||||||
</layer>
|
|
||||||
<objectgroup id="3" name="Walls" visible="0">
|
|
||||||
<object id="1" x="0" y="0" width="1600" height="16"/>
|
|
||||||
<object id="2" x="1584" y="0" width="16" height="960"/>
|
|
||||||
<object id="3" x="0" y="944" width="1600" height="16"/>
|
|
||||||
<object id="4" x="0" y="0" width="16" height="960"/>
|
|
||||||
<object id="5" x="112" y="64" width="96" height="192"/>
|
|
||||||
<object id="6" x="400" y="368" width="160" height="64"/>
|
|
||||||
<object id="7" x="576" y="208" width="192" height="96"/>
|
|
||||||
<object id="8" x="608" y="336" width="128" height="160"/>
|
|
||||||
<object id="10" x="768" y="336" width="128" height="96"/>
|
|
||||||
<object id="11" x="768" y="496" width="128" height="64"/>
|
|
||||||
<object id="13" x="240" y="528" width="224" height="224"/>
|
|
||||||
<object id="14" x="1008" y="656" width="272" height="144"/>
|
|
||||||
<object id="15" x="1168" y="592" width="160" height="32"/>
|
|
||||||
<object id="16" x="1120" y="144" width="128" height="160"/>
|
|
||||||
<object id="17" x="1104" y="336" width="96" height="32"/>
|
|
||||||
<object id="19" x="1216" y="336" width="64" height="96"/>
|
|
||||||
<object id="20" x="1280" y="80" width="64" height="288"/>
|
|
||||||
<object id="22" x="1344" y="80" width="64" height="96"/>
|
|
||||||
</objectgroup>
|
|
||||||
</map>
|
|
@ -60,15 +60,12 @@ function Player:handleKeys(up, down, left, right, dt)
|
|||||||
if love.keyboard.isDown(up) then
|
if love.keyboard.isDown(up) then
|
||||||
self.vx = cos(self.rotation) * (self.speed * dt)
|
self.vx = cos(self.rotation) * (self.speed * dt)
|
||||||
self.vy = sin(self.rotation) * (self.speed * dt)
|
self.vy = sin(self.rotation) * (self.speed * dt)
|
||||||
end
|
elseif love.keyboard.isDown(down) then
|
||||||
if love.keyboard.isDown(down) then
|
|
||||||
self.vx = cos(self.rotation) * (self.speed / 2 * dt) * -1
|
self.vx = cos(self.rotation) * (self.speed / 2 * dt) * -1
|
||||||
self.vy = sin(self.rotation) * (self.speed / 2 * dt) * -1
|
self.vy = sin(self.rotation) * (self.speed / 2 * dt) * -1
|
||||||
end
|
elseif love.keyboard.isDown(left) then
|
||||||
if love.keyboard.isDown(left) then
|
|
||||||
self.rotation = self.rotation - (self.rotSpeed * dt)
|
self.rotation = self.rotation - (self.rotSpeed * dt)
|
||||||
end
|
elseif love.keyboard.isDown(right) then
|
||||||
if love.keyboard.isDown(right) then
|
|
||||||
self.rotation = self.rotation + (self.rotSpeed * dt)
|
self.rotation = self.rotation + (self.rotSpeed * dt)
|
||||||
end
|
end
|
||||||
self.collider:setLinearVelocity(self.vx, self.vy)
|
self.collider:setLinearVelocity(self.vx, self.vy)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user