├── LICENSE ├── README.md ├── _releases ├── 0.0.1 │ └── legend-win32-0.0.1.zip ├── 0.0.2 │ └── legend-win32-0.0.2.zip ├── 0.0.3 │ └── legend-win32-0.0.3.zip ├── 0.0.4 │ └── legend-win32-0.0.4.zip ├── 0.0.5 │ └── legend-win32-0.0.5.zip ├── 0.0.6 │ └── legend-win32-0.0.6.zip ├── 0.0.7 │ ├── legend-win32-0.0.7.zip │ └── legend-win32-0.0.7a.zip ├── 0.0.8 │ └── legend-win32-0.0.8.zip └── 0.0.9 │ ├── legend-win32-0.0.9.zip │ └── legend-win32-0.0.9a.zip ├── conf.lua ├── fonts ├── kenney-pixel-square │ └── Kenney-Pixel-Square.ttf ├── kenney_fontpackage │ ├── Fonts │ │ ├── Kenney Blocks.ttf │ │ ├── Kenney Future Narrow.ttf │ │ ├── Kenney Future.ttf │ │ ├── Kenney High Square.ttf │ │ ├── Kenney High.ttf │ │ ├── Kenney Mini Square.ttf │ │ ├── Kenney Mini.ttf │ │ ├── Kenney Pixel Square.ttf │ │ ├── Kenney Pixel.ttf │ │ ├── Kenney Rocket Square.ttf │ │ └── Kenney Rocket.ttf │ └── License.txt └── vt323 │ └── VT323-Regular.ttf ├── libraries ├── .DS_Store ├── Simple-Tiled-Implementation │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── doc │ │ └── config.ld │ ├── main.lua │ ├── spec │ │ └── map_spec.lua │ ├── sti │ │ ├── graphics.lua │ │ ├── init.lua │ │ ├── plugins │ │ │ ├── box2d.lua │ │ │ └── bump.lua │ │ └── utils.lua │ ├── tests │ │ ├── hex.lua │ │ ├── images │ │ │ ├── grid.png │ │ │ ├── hale_may_320.png │ │ │ ├── hex1.png │ │ │ └── iso.png │ │ ├── iso.lua │ │ ├── objects.lua │ │ ├── ortho-inf.lua │ │ ├── ortho.lua │ │ ├── stag.lua │ │ ├── tmx │ │ │ ├── hex.tmx │ │ │ ├── iso.tmx │ │ │ ├── objects.tmx │ │ │ ├── ortho-inf.tmx │ │ │ ├── ortho.tmx │ │ │ └── stag.tmx │ │ └── tsx │ │ │ ├── grid.tsx │ │ │ └── may.tsx │ └── tutorials │ │ ├── 01-introduction-to-sti.md │ │ └── img │ │ ├── tiled-01.png │ │ ├── tiled-02.png │ │ ├── tiled-03.png │ │ ├── tiled-04.png │ │ └── tiled-05.png ├── anim8 │ ├── MIT-LICENSE.txt │ └── anim8.lua ├── flux │ ├── LICENSE │ └── flux.lua ├── hump │ ├── .travis.yml │ ├── README.md │ ├── camera.lua │ ├── class.lua │ ├── gamestate.lua │ ├── hump-0.4-2.rockspec │ ├── signal.lua │ ├── spec │ │ └── timer_spec.lua │ ├── timer.lua │ ├── vector-light.lua │ └── vector.lua ├── show.lua ├── tesound.lua └── windfield │ ├── init.lua │ └── mlib │ ├── Changes.txt │ ├── LICENSE.md │ ├── README.md │ └── mlib.lua ├── main.lua ├── maps ├── _old │ ├── test.lua │ └── test.tmx ├── _old2 │ ├── empty.lua │ ├── empty.tmx │ ├── test.lua │ ├── test.tmx │ ├── test2.lua │ ├── test2.tmx │ ├── test3.lua │ ├── test3.tmx │ ├── test4.lua │ ├── test4.tmx │ ├── test5.lua │ ├── test5.tmx │ ├── test6.lua │ ├── test6.tmx │ ├── test7.lua │ ├── test7.tmx │ ├── testCave.lua │ ├── testCave.tmx │ ├── testCave2.lua │ ├── testCave2.tmx │ ├── testDungeon.lua │ ├── testDungeon.tmx │ ├── testDungeon2-2.lua │ ├── testDungeon2-2.tmx │ ├── testDungeon2.lua │ ├── testDungeon2.tmx │ ├── testShop.lua │ └── testShop.tmx ├── _old3 │ ├── test.lua │ ├── test.tmx │ ├── test2.lua │ ├── test2.tmx │ ├── test3.lua │ └── test3.tmx ├── _tilesets │ ├── Overworld-comfy.png │ ├── Overworld-edit-lospec.png │ ├── Overworld-edit.png │ ├── Overworld-edit2.aseprite │ ├── Overworld-edit2.png │ ├── Overworld-rebase.png │ ├── cave.png │ ├── inner.png │ └── overworld.png ├── menu.lua ├── menu.tmx ├── test.lua ├── test.tmx ├── test2.lua ├── test2.tmx ├── testCave.lua └── testCave.tmx ├── sounds ├── enemies │ ├── enemyDie.wav │ ├── enemyHurt.wav │ └── projectile.wav ├── items │ ├── arrow.wav │ ├── boomerang.wav │ ├── chest.wav │ ├── coin-edit.wav │ ├── coin.wav │ ├── explosion.wav │ ├── fire.wav │ ├── grapple.wav │ ├── set.wav │ └── sword.wav ├── player │ ├── playerHurt.wav │ └── roll.wav └── ui │ ├── click.wav │ ├── menu-close.wav │ ├── menu-open.wav │ └── select.wav ├── sprites ├── _edit │ ├── arrow.aseprite │ ├── bat.aseprite │ ├── bat2.aseprite │ ├── bomb-sheet.aseprite │ ├── bomb.aseprite │ ├── boomerang.aseprite │ ├── bow.aseprite │ ├── coin.aseprite │ ├── darkness-wide.xcf │ ├── eye.ase │ ├── fire-icon.aseprite │ ├── fire.aseprite │ ├── hookshot.aseprite │ ├── lantern.aseprite │ ├── player-bow.aseprite │ ├── player-idle.aseprite │ ├── player-roll.aseprite │ ├── player.aseprite │ ├── player.png │ ├── player2.png │ ├── player3.aseprite │ ├── player4.aseprite │ ├── playerSheet.aseprite │ ├── skeleton-knife.aseprite │ ├── skeleton-mage.aseprite │ ├── skeleton.aseprite │ ├── slice.aseprite │ ├── sword.aseprite │ ├── tree.aseprite │ └── ui.aseprite ├── _shelf │ └── gfx │ │ └── gfx │ │ ├── Inner.png │ │ ├── NPC_test.png │ │ ├── Overworld.png │ │ ├── cave.png │ │ ├── character.png │ │ ├── font.png │ │ ├── log.png │ │ └── objects.png ├── effects │ ├── blobs │ │ ├── blob.aseprite │ │ ├── blob1.png │ │ ├── blob2.png │ │ ├── blob3.png │ │ └── blob4.png │ ├── darkMagicB.png │ ├── darkMagicW.png │ ├── darkness-wide.png │ ├── darkness.png │ ├── death.png │ ├── explosion.png │ ├── fireball.png │ ├── fuseSmoke.png │ ├── fuseSmoke2.png │ ├── rock.png │ ├── scorch.png │ ├── scorch │ │ ├── raw-triangle.png │ │ └── triangle.png │ ├── scorch2.png │ ├── scorch3.png │ ├── shadows │ │ ├── arrow.png │ │ ├── boomerang.png │ │ └── tree.png │ ├── slice.png │ └── sliceAnim.png ├── enemies │ ├── alert.png │ ├── bat.png │ ├── batDead.png │ ├── eye │ │ ├── eye1.png │ │ ├── eye2.png │ │ ├── eye3.png │ │ ├── eyeDead1.png │ │ ├── eyeDead2.png │ │ ├── eyeDead3.png │ │ └── eyeShadow.png │ ├── eye2 │ │ ├── eyeBody.png │ │ └── iris1.png │ ├── shadow.png │ ├── shadowMed.png │ └── skeleton │ │ ├── knife.png │ │ ├── knife2.aseprite │ │ ├── knife2.png │ │ ├── mage.png │ │ └── skeletonStun.png ├── environment │ ├── breakableRock.png │ ├── breakableWall.png │ ├── chestBigClosed.png │ ├── chestBigOpen.png │ ├── chestClosed.png │ ├── chestOpen.png │ ├── lockedDoor.png │ ├── tree-old.png │ ├── tree.png │ ├── tree2.png │ ├── wave.aseprite │ └── wave.png ├── icon.png ├── items │ ├── arrow-bundle.png │ ├── arrow-bundle2.png │ ├── arrow.png │ ├── bomb.png │ ├── bombSheet.png │ ├── bombSheet.xcf │ ├── boomerang.png │ ├── bow1.png │ ├── bow2.png │ ├── bowIcon.png │ ├── coin.png │ ├── coin1Sheet.png │ ├── coin2Sheet.png │ ├── coin3Sheet.png │ ├── coinIcon.png │ ├── container.png │ ├── fire-icon.png │ ├── grapple-armed.png │ ├── grapple-chain.png │ ├── grapple-handle.png │ ├── grapple-head.png │ ├── grapple.png │ ├── heart-old.png │ ├── heart.png │ ├── heartAnim.png │ ├── key.png │ ├── lantern.png │ ├── lootShadow.png │ ├── lootShadow2.png │ ├── quiver.png │ ├── sword.png │ └── sword2.png ├── luap-edit.png ├── npc │ └── merchant.png ├── player │ ├── playerShadow.png │ ├── playerSheet-lospec.png │ ├── playerSheet.aseprite │ ├── playerSheet1-old.png │ ├── playerSheet1.png │ ├── playerSheet2.png │ ├── playerSheet3.png │ ├── playerSheet4.png │ └── playerSheetcomfy.png └── ui │ ├── ammoBox.png │ ├── heart-empty.png │ ├── heart-half.png │ ├── heart.png │ ├── itemBox.png │ └── pause │ ├── cursor.png │ ├── equipBox.png │ ├── itemBox.aseprite │ ├── itemPanel.png │ ├── itemPanelFade.png │ ├── itemPanelL.png │ ├── itemPanelR.png │ ├── mouse.aseprite │ ├── mouse.png │ └── wideBox.png └── src ├── debug.lua ├── draw.lua ├── effects ├── blast.lua ├── effect.lua ├── particles │ ├── death.lua │ ├── debris.lua │ ├── particle.lua │ └── particleEvent.lua └── shadows.lua ├── enemies ├── bat.lua ├── enemy.lua ├── eye.lua ├── projectile.lua └── skeleton.lua ├── environment ├── tree.lua └── water.lua ├── items ├── arrow.lua ├── bomb.lua ├── boomerang.lua ├── chest.lua ├── grapple.lua ├── item.lua └── loot.lua ├── levels ├── curtain.lua ├── loadMap.lua ├── npc.lua ├── transition.lua └── wall.lua ├── player.lua ├── spells ├── fireball.lua └── flame.lua ├── startup ├── collisionClasses.lua ├── data.lua ├── gameStart.lua ├── require.lua └── resources.lua ├── ui ├── hud.lua ├── menu.lua └── pause.lua ├── update.lua └── utilities ├── cam.lua ├── destroyAll.lua ├── misc.lua ├── shaders.lua ├── shake.lua ├── triggers.lua └── utils.lua /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Kyle Schaub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/kyleschaub/legend-of-lua/assets/12667521/8ecf9bc1-04c5-4505-95e7-2a5b87df5ce0) 2 | 3 | # Legend of Lua 4 | 5 | This is an open-source Love2D Zelda-like game. 6 | 7 | This project can be run like any other Love2D game. For instructions on this process, see my video on installation and setup: 8 | https://www.youtube.com/watch?v=kpxkQldiNPU 9 | 10 | As of 10/13/2022, all future updates will be applied to a different repo that is not open-source. This is necessary so I can hire artists to create assets and purchase professionally made sprites, sound effects, and music. I am not allowed to re-distribute those types of assets, so unfortunately, they cannot exist in an open-source repo. However, all releases from this private repo will be archived here in the _releases folder. 11 | -------------------------------------------------------------------------------- /_releases/0.0.1/legend-win32-0.0.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.1/legend-win32-0.0.1.zip -------------------------------------------------------------------------------- /_releases/0.0.2/legend-win32-0.0.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.2/legend-win32-0.0.2.zip -------------------------------------------------------------------------------- /_releases/0.0.3/legend-win32-0.0.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.3/legend-win32-0.0.3.zip -------------------------------------------------------------------------------- /_releases/0.0.4/legend-win32-0.0.4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.4/legend-win32-0.0.4.zip -------------------------------------------------------------------------------- /_releases/0.0.5/legend-win32-0.0.5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.5/legend-win32-0.0.5.zip -------------------------------------------------------------------------------- /_releases/0.0.6/legend-win32-0.0.6.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.6/legend-win32-0.0.6.zip -------------------------------------------------------------------------------- /_releases/0.0.7/legend-win32-0.0.7.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.7/legend-win32-0.0.7.zip -------------------------------------------------------------------------------- /_releases/0.0.7/legend-win32-0.0.7a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.7/legend-win32-0.0.7a.zip -------------------------------------------------------------------------------- /_releases/0.0.8/legend-win32-0.0.8.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.8/legend-win32-0.0.8.zip -------------------------------------------------------------------------------- /_releases/0.0.9/legend-win32-0.0.9.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.9/legend-win32-0.0.9.zip -------------------------------------------------------------------------------- /_releases/0.0.9/legend-win32-0.0.9a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/_releases/0.0.9/legend-win32-0.0.9a.zip -------------------------------------------------------------------------------- /conf.lua: -------------------------------------------------------------------------------- 1 | function love.conf(t) 2 | t.window.title = "Legend of Lua" 3 | t.window.highdpi = true 4 | t.window.resizable = true 5 | t.window.icon = "sprites/icon.png" 6 | end -------------------------------------------------------------------------------- /fonts/kenney-pixel-square/Kenney-Pixel-Square.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney-pixel-square/Kenney-Pixel-Square.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Blocks.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Blocks.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Future Narrow.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Future Narrow.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Future.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Future.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney High Square.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney High Square.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney High.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney High.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Mini Square.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Mini Square.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Mini.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Mini.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Pixel Square.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Pixel Square.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Pixel.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Pixel.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Rocket Square.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Rocket Square.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/Fonts/Kenney Rocket.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/kenney_fontpackage/Fonts/Kenney Rocket.ttf -------------------------------------------------------------------------------- /fonts/kenney_fontpackage/License.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Font package (free) 4 | 5 | Created/distributed by Kenney (www.kenney.nl) 6 | 7 | ------------------------------ 8 | 9 | License: (Creative Commons Zero, CC0) 10 | http://creativecommons.org/publicdomain/zero/1.0/ 11 | 12 | This content is free to use in personal, educational and commercial projects. 13 | Support us by crediting (Kenney or www.kenney.nl), this is not mandatory. 14 | 15 | ------------------------------ 16 | 17 | Donate: http://support.kenney.nl 18 | Request: http://request.kenney.nl 19 | Patreon: http://patreon.com/kenney/ 20 | 21 | Follow on Twitter for updates: 22 | @KenneyNL -------------------------------------------------------------------------------- /fonts/vt323/VT323-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/fonts/vt323/VT323-Regular.ttf -------------------------------------------------------------------------------- /libraries/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/.DS_Store -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/LICENSE.md: -------------------------------------------------------------------------------- 1 | # Simple Tiled Implementation 2 | 3 | This code is licensed under the [**MIT/X11 Open Source License**][MIT]. 4 | 5 | Copyright (c) 2019 Landon Manning - LManning17@gmail.com - [LandonManning.com][LM] 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | [MIT]: https://www.opensource.org/licenses/mit-license.html 26 | [LM]: https://LandonManning.com 27 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/README.md: -------------------------------------------------------------------------------- 1 | # Simple Tiled Implementation 2 | 3 | [![Join the chat at https://gitter.im/karai17/Simple-Tiled-Implementation](https://badges.gitter.im/karai17/Simple-Tiled-Implementation.svg)](https://gitter.im/karai17/Simple-Tiled-Implementation?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | If you like STI, consider tossing me a few monies via [**PayPal**][paypal]. 6 | 7 | Simple Tiled Implementation is a [**Tiled**][Tiled] map loader and renderer designed for the *awesome* [**LÖVE**][LOVE] framework. Please read the [**documentation**][dox] to learn how it works, or check out the tutorials included in this repo. 8 | 9 | ## Quick Example 10 | 11 | ```lua 12 | -- This example uses the included Box2D (love.physics) plugin!! 13 | 14 | local sti = require "sti" 15 | 16 | function love.load() 17 | -- Grab window size 18 | windowWidth = love.graphics.getWidth() 19 | windowHeight = love.graphics.getHeight() 20 | 21 | -- Set world meter size (in pixels) 22 | love.physics.setMeter(32) 23 | 24 | -- Load a map exported to Lua from Tiled 25 | map = sti("assets/maps/map01.lua", { "box2d" }) 26 | 27 | -- Prepare physics world with horizontal and vertical gravity 28 | world = love.physics.newWorld(0, 0) 29 | 30 | -- Prepare collision objects 31 | map:box2d_init(world) 32 | 33 | -- Create a Custom Layer 34 | map:addCustomLayer("Sprite Layer", 3) 35 | 36 | -- Add data to Custom Layer 37 | local spriteLayer = map.layers["Sprite Layer"] 38 | spriteLayer.sprites = { 39 | player = { 40 | image = love.graphics.newImage("assets/sprites/player.png"), 41 | x = 64, 42 | y = 64, 43 | r = 0, 44 | } 45 | } 46 | 47 | -- Update callback for Custom Layer 48 | function spriteLayer:update(dt) 49 | for _, sprite in pairs(self.sprites) do 50 | sprite.r = sprite.r + math.rad(90 * dt) 51 | end 52 | end 53 | 54 | -- Draw callback for Custom Layer 55 | function spriteLayer:draw() 56 | for _, sprite in pairs(self.sprites) do 57 | local x = math.floor(sprite.x) 58 | local y = math.floor(sprite.y) 59 | local r = sprite.r 60 | love.graphics.draw(sprite.image, x, y, r) 61 | end 62 | end 63 | end 64 | 65 | function love.update(dt) 66 | map:update(dt) 67 | end 68 | 69 | function love.draw() 70 | -- Draw the map and all objects within 71 | love.graphics.setColor(1, 1, 1) 72 | map:draw() 73 | 74 | -- Draw Collision Map (useful for debugging) 75 | love.graphics.setColor(1, 0, 0) 76 | map:box2d_draw() 77 | 78 | -- Please note that map:draw, map:box2d_draw, and map:bump_draw take 79 | -- translate and scale arguments (tx, ty, sx, sy) for when you want to 80 | -- grow, shrink, or reposition your map on screen. 81 | end 82 | ``` 83 | 84 | ## Requirements 85 | 86 | This library recommends LÖVE 11.x and Tiled 1.2.x. If you are updating from an older version of Tiled, please re-export your Lua map files. 87 | 88 | ## License 89 | 90 | This code is licensed under the [**MIT/X11 Open Source License**][MIT]. Check out the LICENSE file for more information. 91 | 92 | [Tiled]: http://www.mapeditor.org/ 93 | [LOVE]: https://www.love2d.org/ 94 | [dox]: http://karai17.github.io/Simple-Tiled-Implementation/ 95 | [MIT]: http://www.opensource.org/licenses/mit-license.html 96 | [paypal]: https://www.paypal.me/LandonManning 97 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/doc/config.ld: -------------------------------------------------------------------------------- 1 | project = "Simple Tiled Implementation" 2 | title = "STI Documentation" 3 | description = "A simple and fast Tiled map loader and renderer" 4 | sort = true 5 | dir = "." 6 | file = { 7 | "../sti/init.lua", 8 | "../sti/plugins/box2d.lua", 9 | "../sti/plugins/bump.lua" 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/main.lua: -------------------------------------------------------------------------------- 1 | io.stdout:setvbuf("no") 2 | local love = _G.love 3 | local sti = require "sti" 4 | local map, world, tx, ty, points 5 | 6 | function love.load() 7 | -- Load map 8 | map = sti("tests/ortho.lua", { "box2d" }) 9 | --map = sti("tests/ortho-inf.lua", { "box2d" }) 10 | --map = sti("tests/iso.lua", { "box2d" }) 11 | --map = sti("tests/stag.lua", { "box2d" }) 12 | --map = sti("tests/hex.lua", { "box2d" }) 13 | --map = sti("tests/objects.lua", { "box2d" }) 14 | 15 | -- Print versions 16 | print("STI: " .. sti._VERSION) 17 | print("Map: " .. map.tiledversion) 18 | 19 | -- Prepare translations 20 | tx, ty = 0, 0 21 | 22 | -- Prepare physics world 23 | love.physics.setMeter(32) 24 | world = love.physics.newWorld(0, 0) 25 | map:box2d_init(world) 26 | 27 | -- Drop points on clicked areas 28 | points = { 29 | mouse = {}, 30 | pixel = {} 31 | } 32 | love.graphics.setPointSize(5) 33 | end 34 | 35 | function love.update(dt) 36 | world:update(dt) 37 | map:update(dt) 38 | 39 | -- Move map 40 | local kd = love.keyboard.isDown 41 | tx = kd("a", "left") and tx - 128 * dt or tx 42 | tx = kd("d", "right") and tx + 128 * dt or tx 43 | ty = kd("w", "up") and ty - 128 * dt or ty 44 | ty = kd("s", "down") and ty + 128 * dt or ty 45 | end 46 | 47 | function love.draw() 48 | -- Draw map 49 | love.graphics.setColor(1, 1, 1) 50 | map:draw(-tx, -ty) 51 | 52 | -- Draw physics objects 53 | love.graphics.setColor(1, 0, 1) 54 | map:box2d_draw(-tx, -ty) 55 | 56 | -- Draw points 57 | love.graphics.translate(-tx, -ty) 58 | 59 | love.graphics.setColor(0, 1, 1) 60 | for _, point in ipairs(points.mouse) do 61 | love.graphics.points(point.x, point.y) 62 | end 63 | 64 | love.graphics.setColor(1, 1, 0) 65 | for _, point in ipairs(points.pixel) do 66 | love.graphics.points(point.x, point.y) 67 | end 68 | end 69 | 70 | function love.mousepressed(x, y, button) 71 | if button == 1 then 72 | x = x + tx 73 | y = y + ty 74 | 75 | local tilex, tiley = map:convertPixelToTile(x, y) 76 | local pixelx, pixely = map:convertTileToPixel(tilex, tiley) 77 | 78 | table.insert(points.pixel, { x=pixelx, y=pixely }) 79 | table.insert(points.mouse, { x=x, y=y }) 80 | 81 | print(x, tilex, pixelx) 82 | print(y, tiley, pixely) 83 | end 84 | end 85 | 86 | function love.resize(w, h) 87 | map:resize(w, h) 88 | end 89 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/spec/map_spec.lua: -------------------------------------------------------------------------------- 1 | package.cpath = package.cpath .. ";/usr/lib/lib?.so;/usr/lib64/lib?.so" 2 | 3 | require "love" 4 | require "love.window" 5 | require "love.graphics" 6 | require "love.image" 7 | require "love.filesystem" 8 | 9 | local function get_low(a) 10 | local m = math.huge 11 | for k,v in pairs(a) do 12 | if k < m then m = k end 13 | end 14 | return a[m] 15 | end 16 | 17 | love.filesystem.init(get_low(arg)) 18 | love.filesystem.setSource(love.filesystem.getWorkingDirectory()) 19 | love.window.setMode(1, 1) 20 | 21 | local sti = require "sti.init" 22 | 23 | describe("STI Map Data:", function() 24 | local function verify_conversion_to_pixel(map, ix, iy, ox, oy) 25 | local x, y = map:convertTileToPixel(ix, iy) 26 | assert.is.equal(x, ox) 27 | assert.is.equal(y, oy) 28 | end 29 | 30 | local function verify_conversion_to_tile(map, ix, iy, ox, oy) 31 | local x, y = map:convertPixelToTile(ix, iy) 32 | assert.is.equal(x, ox) 33 | assert.is.equal(y, oy) 34 | end 35 | 36 | it("converts between ortho and world space", function() 37 | local map = sti("tests/ortho.lua") 38 | 39 | verify_conversion_to_pixel(map, 3, 4, 96, 128) 40 | verify_conversion_to_pixel(map, 3.5, 4.5, 112, 144) 41 | verify_conversion_to_pixel(map, 4, 5, 128, 160) 42 | 43 | verify_conversion_to_tile(map, 96, 128, 3, 4) 44 | verify_conversion_to_tile(map, 112, 144, 3.5, 4.5) 45 | verify_conversion_to_tile(map, 128, 160, 4, 5) 46 | end) 47 | 48 | it("converts between iso and world space", function() 49 | local map = sti("tests/iso.lua") 50 | 51 | verify_conversion_to_pixel(map, 3, 4, 460, 644) 52 | verify_conversion_to_pixel(map, 3.5, 4.5, 460, 736) 53 | verify_conversion_to_pixel(map, 4, 5, 460, 828) 54 | 55 | verify_conversion_to_tile(map, 460, 644, 3, 4) 56 | verify_conversion_to_tile(map, 460, 736, 3.5, 4.5) 57 | verify_conversion_to_tile(map, 460, 828, 4, 5) 58 | end) 59 | 60 | it("converts between stag and world space", function() 61 | local map = sti("tests/stag.lua") 62 | 63 | verify_conversion_to_pixel(map, 3, 4, 552, 460) 64 | verify_conversion_to_pixel(map, 3.5, 4.5, 644, 506) 65 | verify_conversion_to_pixel(map, 4, 5, 736, 552) 66 | 67 | verify_conversion_to_tile(map, 552, 460, 3, 4) 68 | verify_conversion_to_tile(map, 644, 506, 3.5, 4.5) 69 | verify_conversion_to_tile(map, 736, 552, 4, 5) 70 | end) 71 | 72 | it("converts between hex and world space", function() 73 | local map = sti("tests/hex.lua") 74 | 75 | verify_conversion_to_pixel(map, 3, 4, 96, 128) 76 | verify_conversion_to_pixel(map, 3.5, 4.5, 112, 144) 77 | verify_conversion_to_pixel(map, 4, 5, 128, 160) 78 | 79 | verify_conversion_to_tile(map, 96, 128, 3, 4) 80 | verify_conversion_to_tile(map, 112, 144, 3.5, 4.5) 81 | verify_conversion_to_tile(map, 128, 160, 4, 5) 82 | end) 83 | end) -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/sti/graphics.lua: -------------------------------------------------------------------------------- 1 | local lg = _G.love.graphics 2 | local graphics = { isCreated = lg and true or false } 3 | 4 | function graphics.newSpriteBatch(...) 5 | if graphics.isCreated then 6 | return lg.newSpriteBatch(...) 7 | end 8 | end 9 | 10 | function graphics.newCanvas(...) 11 | if graphics.isCreated then 12 | return lg.newCanvas(...) 13 | end 14 | end 15 | 16 | function graphics.newImage(...) 17 | if graphics.isCreated then 18 | return lg.newImage(...) 19 | end 20 | end 21 | 22 | function graphics.newQuad(...) 23 | if graphics.isCreated then 24 | return lg.newQuad(...) 25 | end 26 | end 27 | 28 | function graphics.getCanvas(...) 29 | if graphics.isCreated then 30 | return lg.getCanvas(...) 31 | end 32 | end 33 | 34 | function graphics.setCanvas(...) 35 | if graphics.isCreated then 36 | return lg.setCanvas(...) 37 | end 38 | end 39 | 40 | function graphics.clear(...) 41 | if graphics.isCreated then 42 | return lg.clear(...) 43 | end 44 | end 45 | 46 | function graphics.push(...) 47 | if graphics.isCreated then 48 | return lg.push(...) 49 | end 50 | end 51 | 52 | function graphics.origin(...) 53 | if graphics.isCreated then 54 | return lg.origin(...) 55 | end 56 | end 57 | 58 | function graphics.scale(...) 59 | if graphics.isCreated then 60 | return lg.scale(...) 61 | end 62 | end 63 | 64 | function graphics.translate(...) 65 | if graphics.isCreated then 66 | return lg.translate(...) 67 | end 68 | end 69 | 70 | function graphics.pop(...) 71 | if graphics.isCreated then 72 | return lg.pop(...) 73 | end 74 | end 75 | 76 | function graphics.draw(...) 77 | if graphics.isCreated then 78 | return lg.draw(...) 79 | end 80 | end 81 | 82 | function graphics.rectangle(...) 83 | if graphics.isCreated then 84 | return lg.rectangle(...) 85 | end 86 | end 87 | 88 | function graphics.getColor(...) 89 | if graphics.isCreated then 90 | return lg.getColor(...) 91 | end 92 | end 93 | 94 | function graphics.setColor(...) 95 | if graphics.isCreated then 96 | return lg.setColor(...) 97 | end 98 | end 99 | 100 | function graphics.line(...) 101 | if graphics.isCreated then 102 | return lg.line(...) 103 | end 104 | end 105 | 106 | function graphics.polygon(...) 107 | if graphics.isCreated then 108 | return lg.polygon(...) 109 | end 110 | end 111 | 112 | function graphics.points(...) 113 | if graphics.isCreated then 114 | return lg.points(...) 115 | end 116 | end 117 | 118 | function graphics.getWidth() 119 | if graphics.isCreated then 120 | return lg.getWidth() 121 | end 122 | return 0 123 | end 124 | 125 | function graphics.getHeight() 126 | if graphics.isCreated then 127 | return lg.getHeight() 128 | end 129 | return 0 130 | end 131 | 132 | return graphics 133 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/hex.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = "1.1", 3 | luaversion = "5.1", 4 | tiledversion = "0.17.2", 5 | orientation = "hexagonal", 6 | renderorder = "right-down", 7 | width = 32, 8 | height = 20, 9 | tilewidth = 32, 10 | tileheight = 32, 11 | nextobjectid = 3, 12 | hexsidelength = 18, 13 | staggeraxis = "x", 14 | staggerindex = "odd", 15 | properties = {}, 16 | tilesets = { 17 | { 18 | name = "hex1", 19 | firstgid = 1, 20 | tilewidth = 32, 21 | tileheight = 32, 22 | spacing = 0, 23 | margin = 0, 24 | image = "hex1.png", 25 | imagewidth = 96, 26 | imageheight = 32, 27 | tileoffset = { 28 | x = 0, 29 | y = 0 30 | }, 31 | properties = {}, 32 | terrains = {}, 33 | tilecount = 3, 34 | tiles = {} 35 | } 36 | }, 37 | layers = { 38 | { 39 | type = "tilelayer", 40 | name = "Grid", 41 | x = 0, 42 | y = 0, 43 | width = 32, 44 | height = 20, 45 | visible = true, 46 | opacity = 1, 47 | offsetx = 0, 48 | offsety = 0, 49 | properties = {}, 50 | encoding = "lua", 51 | data = { 52 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 53 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 54 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 55 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 56 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 57 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 58 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 59 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 60 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 61 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 62 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 63 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 64 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 65 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 66 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 67 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 68 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 69 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 70 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 71 | 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2 72 | } 73 | }, 74 | { 75 | type = "objectgroup", 76 | name = "Objects", 77 | visible = true, 78 | opacity = 1, 79 | offsetx = 0, 80 | offsety = 0, 81 | draworder = "topdown", 82 | properties = { 83 | ["collidable"] = true 84 | }, 85 | objects = { 86 | { 87 | id = 1, 88 | name = "", 89 | type = "", 90 | shape = "rectangle", 91 | x = 57, 92 | y = 32, 93 | width = 75, 94 | height = 96, 95 | rotation = 0, 96 | visible = true, 97 | properties = {} 98 | }, 99 | { 100 | id = 2, 101 | name = "", 102 | type = "", 103 | shape = "rectangle", 104 | x = 250, 105 | y = 48, 106 | width = 71.5, 107 | height = 76, 108 | rotation = 63.5, 109 | visible = true, 110 | properties = {} 111 | } 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/images/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tests/images/grid.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/images/hale_may_320.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tests/images/hale_may_320.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/images/hex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tests/images/hex1.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/images/iso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tests/images/iso.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/iso.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = "1.1", 3 | luaversion = "5.1", 4 | tiledversion = "0.17.2", 5 | orientation = "isometric", 6 | renderorder = "right-down", 7 | width = 6, 8 | height = 6, 9 | tilewidth = 184, 10 | tileheight = 184, 11 | nextobjectid = 7, 12 | properties = {}, 13 | tilesets = { 14 | { 15 | name = "iso", 16 | firstgid = 1, 17 | tilewidth = 184, 18 | tileheight = 184, 19 | spacing = 0, 20 | margin = 0, 21 | image = "iso.png", 22 | imagewidth = 184, 23 | imageheight = 184, 24 | tileoffset = { 25 | x = 0, 26 | y = 0 27 | }, 28 | properties = {}, 29 | terrains = {}, 30 | tilecount = 1, 31 | tiles = {} 32 | } 33 | }, 34 | layers = { 35 | { 36 | type = "tilelayer", 37 | name = "Grid", 38 | x = 0, 39 | y = 0, 40 | width = 6, 41 | height = 6, 42 | visible = true, 43 | opacity = 1, 44 | offsetx = 0, 45 | offsety = 0, 46 | properties = {}, 47 | encoding = "lua", 48 | data = { 49 | 1, 1, 1, 1, 1, 1, 50 | 1, 1, 1, 1, 1, 1, 51 | 1, 1, 1, 1, 1, 1, 52 | 1, 1, 1, 1, 1, 1, 53 | 1, 1, 1, 1, 1, 1, 54 | 1, 1, 1, 1, 1, 1 55 | } 56 | }, 57 | { 58 | type = "objectgroup", 59 | name = "Objects", 60 | visible = true, 61 | opacity = 1, 62 | offsetx = 0, 63 | offsety = 0, 64 | draworder = "topdown", 65 | properties = { 66 | ["collidable"] = true 67 | }, 68 | objects = { 69 | { 70 | id = 1, 71 | name = "", 72 | type = "", 73 | shape = "rectangle", 74 | x = 184, 75 | y = 368, 76 | width = 184, 77 | height = 184, 78 | rotation = 0, 79 | visible = true, 80 | properties = {} 81 | }, 82 | { 83 | id = 2, 84 | name = "", 85 | type = "", 86 | shape = "rectangle", 87 | x = 644, 88 | y = 277, 89 | width = 260, 90 | height = 260, 91 | rotation = 45, 92 | visible = true, 93 | properties = {} 94 | }, 95 | { 96 | id = 3, 97 | name = "", 98 | type = "", 99 | shape = "polygon", 100 | x = 410, 101 | y = 910, 102 | width = 0, 103 | height = 0, 104 | rotation = 0, 105 | visible = true, 106 | polygon = { 107 | { x = -41.9565, y = 10 }, 108 | { x = 141.996, y = 10.0616 }, 109 | { x = -42.0254, y = -173.96 } 110 | }, 111 | properties = {} 112 | }, 113 | { 114 | id = 4, 115 | name = "", 116 | type = "", 117 | shape = "polygon", 118 | x = 681, 119 | y = 851, 120 | width = 0, 121 | height = 0, 122 | rotation = 45, 123 | visible = true, 124 | polygon = { 125 | { x = -41.9565, y = 10 }, 126 | { x = 141.996, y = 10.0616 }, 127 | { x = -42.0254, y = -173.96 } 128 | }, 129 | properties = {} 130 | }, 131 | { 132 | id = 5, 133 | name = "", 134 | type = "", 135 | shape = "polyline", 136 | x = 828, 137 | y = 828, 138 | width = 0, 139 | height = 0, 140 | rotation = 0, 141 | visible = true, 142 | polyline = { 143 | { x = 0, y = 0 }, 144 | { x = 92.0312, y = -91.9688 }, 145 | { x = 275.969, y = -91.9688 }, 146 | { x = 276, y = 92 } 147 | }, 148 | properties = {} 149 | }, 150 | { 151 | id = 6, 152 | name = "", 153 | type = "", 154 | shape = "polyline", 155 | x = 790, 156 | y = 108, 157 | width = 0, 158 | height = 0, 159 | rotation = 45, 160 | visible = true, 161 | polyline = { 162 | { x = 0, y = 0 }, 163 | { x = 92.0312, y = -91.9688 }, 164 | { x = 275.969, y = -91.9688 }, 165 | { x = 276, y = 92 } 166 | }, 167 | properties = {} 168 | } 169 | } 170 | } 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/ortho.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = "1.2", 3 | luaversion = "5.1", 4 | tiledversion = "1.2.2", 5 | orientation = "orthogonal", 6 | renderorder = "right-down", 7 | width = 24, 8 | height = 12, 9 | tilewidth = 32, 10 | tileheight = 32, 11 | nextlayerid = 10, 12 | nextobjectid = 39, 13 | properties = {}, 14 | tilesets = { 15 | { 16 | name = "grid", 17 | firstgid = 1, 18 | filename = "tsx/grid.tsx", 19 | tilewidth = 32, 20 | tileheight = 32, 21 | spacing = 0, 22 | margin = 0, 23 | columns = 32, 24 | image = "images/grid.png", 25 | imagewidth = 1024, 26 | imageheight = 1024, 27 | tileoffset = { 28 | x = 0, 29 | y = 0 30 | }, 31 | grid = { 32 | orientation = "orthogonal", 33 | width = 32, 34 | height = 32 35 | }, 36 | properties = {}, 37 | terrains = {}, 38 | tilecount = 1024, 39 | tiles = {} 40 | }, 41 | { 42 | name = "may", 43 | firstgid = 1025, 44 | filename = "tsx/may.tsx", 45 | tilewidth = 32, 46 | tileheight = 32, 47 | spacing = 0, 48 | margin = 0, 49 | columns = 10, 50 | image = "images/hale_may_320.png", 51 | imagewidth = 320, 52 | imageheight = 320, 53 | tileoffset = { 54 | x = 0, 55 | y = 0 56 | }, 57 | grid = { 58 | orientation = "orthogonal", 59 | width = 32, 60 | height = 32 61 | }, 62 | properties = {}, 63 | terrains = {}, 64 | tilecount = 100, 65 | tiles = {} 66 | } 67 | }, 68 | layers = { 69 | { 70 | type = "tilelayer", 71 | id = 8, 72 | name = "Tile Layer 1", 73 | x = 0, 74 | y = 0, 75 | width = 24, 76 | height = 12, 77 | visible = true, 78 | opacity = 1, 79 | offsetx = 0, 80 | offsety = 0, 81 | properties = {}, 82 | encoding = "lua", 83 | data = { 84 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 85 | 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 86 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 87 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 88 | 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 89 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 90 | 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 91 | 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 92 | 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 93 | 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 94 | 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 95 | 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376 96 | } 97 | }, 98 | { 99 | type = "group", 100 | id = 9, 101 | name = "Group 1", 102 | visible = true, 103 | opacity = 1, 104 | offsetx = 0, 105 | offsety = 0, 106 | properties = {}, 107 | layers = { 108 | { 109 | type = "imagelayer", 110 | id = 4, 111 | name = "Image Layer 1", 112 | visible = true, 113 | opacity = 1, 114 | offsetx = 32, 115 | offsety = 32, 116 | image = "images/hale_may_320.png", 117 | properties = {} 118 | }, 119 | { 120 | type = "objectgroup", 121 | id = 6, 122 | name = "Object Layer 1", 123 | visible = true, 124 | opacity = 1, 125 | offsetx = 0, 126 | offsety = 0, 127 | draworder = "topdown", 128 | properties = {}, 129 | objects = { 130 | { 131 | id = 37, 132 | name = "", 133 | type = "", 134 | shape = "ellipse", 135 | x = 416, 136 | y = 32, 137 | width = 320, 138 | height = 320, 139 | rotation = 0, 140 | visible = true, 141 | properties = {} 142 | } 143 | } 144 | } 145 | } 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/stag.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = "1.1", 3 | luaversion = "5.1", 4 | tiledversion = "0.17.2", 5 | orientation = "staggered", 6 | renderorder = "right-down", 7 | width = 5, 8 | height = 10, 9 | tilewidth = 184, 10 | tileheight = 184, 11 | nextobjectid = 3, 12 | staggeraxis = "y", 13 | staggerindex = "odd", 14 | properties = {}, 15 | tilesets = { 16 | { 17 | name = "iso", 18 | firstgid = 1, 19 | tilewidth = 184, 20 | tileheight = 184, 21 | spacing = 0, 22 | margin = 0, 23 | image = "iso.png", 24 | imagewidth = 184, 25 | imageheight = 184, 26 | tileoffset = { 27 | x = 0, 28 | y = 0 29 | }, 30 | properties = {}, 31 | terrains = {}, 32 | tilecount = 1, 33 | tiles = {} 34 | } 35 | }, 36 | layers = { 37 | { 38 | type = "tilelayer", 39 | name = "Grid", 40 | x = 0, 41 | y = 0, 42 | width = 5, 43 | height = 10, 44 | visible = true, 45 | opacity = 1, 46 | offsetx = 0, 47 | offsety = 0, 48 | properties = {}, 49 | encoding = "lua", 50 | data = { 51 | 1, 1, 1, 1, 1, 52 | 1, 1, 1, 1, 1, 53 | 1, 1, 1, 1, 1, 54 | 1, 1, 1, 1, 1, 55 | 1, 1, 1, 1, 1, 56 | 1, 1, 1, 1, 1, 57 | 1, 1, 1, 1, 1, 58 | 1, 1, 1, 1, 1, 59 | 1, 1, 1, 1, 1, 60 | 1, 1, 1, 1, 1 61 | } 62 | }, 63 | { 64 | type = "objectgroup", 65 | name = "Objects", 66 | visible = true, 67 | opacity = 1, 68 | offsetx = 0, 69 | offsety = 0, 70 | draworder = "topdown", 71 | properties = { 72 | ["collidable"] = true 73 | }, 74 | objects = { 75 | { 76 | id = 1, 77 | name = "", 78 | type = "", 79 | shape = "rectangle", 80 | x = 184, 81 | y = 184, 82 | width = 184, 83 | height = 92, 84 | rotation = 0, 85 | visible = true, 86 | properties = {} 87 | }, 88 | { 89 | id = 2, 90 | name = "", 91 | type = "", 92 | shape = "rectangle", 93 | x = 460, 94 | y = 0, 95 | width = 130, 96 | height = 130, 97 | rotation = 45, 98 | visible = true, 99 | properties = {} 100 | } 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tmx/hex.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 9 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 10 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 11 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 12 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 13 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 14 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 15 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 16 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 17 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 18 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 19 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 20 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 21 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 22 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 23 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 24 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 25 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 26 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 27 | 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tmx/iso.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1, 9 | 1,1,1,1,1,1, 10 | 1,1,1,1,1,1, 11 | 1,1,1,1,1,1, 12 | 1,1,1,1,1,1, 13 | 1,1,1,1,1,1 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tmx/ortho.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, 8 | 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56, 9 | 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88, 10 | 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120, 11 | 129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152, 12 | 161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184, 13 | 193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216, 14 | 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248, 15 | 257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280, 16 | 289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312, 17 | 321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344, 18 | 353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tmx/stag.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1, 9 | 1,1,1,1,1, 10 | 1,1,1,1,1, 11 | 1,1,1,1,1, 12 | 1,1,1,1,1, 13 | 1,1,1,1,1, 14 | 1,1,1,1,1, 15 | 1,1,1,1,1, 16 | 1,1,1,1,1, 17 | 1,1,1,1,1 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tsx/grid.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tests/tsx/may.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tutorials/img/tiled-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tutorials/img/tiled-01.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tutorials/img/tiled-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tutorials/img/tiled-02.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tutorials/img/tiled-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tutorials/img/tiled-03.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tutorials/img/tiled-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tutorials/img/tiled-04.png -------------------------------------------------------------------------------- /libraries/Simple-Tiled-Implementation/tutorials/img/tiled-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/libraries/Simple-Tiled-Implementation/tutorials/img/tiled-05.png -------------------------------------------------------------------------------- /libraries/anim8/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Enrique García Cota 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /libraries/flux/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 rxi 2 | 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. -------------------------------------------------------------------------------- /libraries/hump/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: precise 2 | sudo: false # Use container-based infrastructure 3 | language: python 4 | 5 | git: 6 | depth: 4 7 | 8 | #Testing with lastest stable version of LUAJIT 9 | env: 10 | - LUA_RUNTIME="luajit" 11 | LUA_VERSION="2.0.5" 12 | #- LUA_RUNTIME="luajit" 13 | # LUA_VERSION="2.1" 14 | 15 | before_install: 16 | - pip install hererocks 17 | - hererocks lua_installations/$LUA_RUNTIME$LUA_VERSION/ --luarocks ^ --$LUA_RUNTIME $LUA_VERSION 18 | - export PATH=$PATH:$PWD/lua_installations/$LUA_RUNTIME$LUA_VERSION/bin 19 | 20 | before_script: 21 | - luarocks install busted 22 | - busted --version 23 | 24 | script: 25 | - busted --output=TAP #default utfTerminal 26 | 27 | #Checks if Luajit and luarocks are already installed 28 | #Comment out to reinstall or if changing versions 29 | cache: 30 | directories: 31 | - $PWD/lua_installations 32 | 33 | # Can add email notification here 34 | #notifications: 35 | #email: 36 | #recipients: 37 | #- email@here.com 38 | #on_failure: always #default always 39 | -------------------------------------------------------------------------------- /libraries/hump/README.md: -------------------------------------------------------------------------------- 1 | hump - Helper Utilities for Massive Progression 2 | =============================================== 3 | 4 | **hump** is a small collection of tools for developing games with LÖVE. 5 | [![Build Status](https://travis-ci.org/vrld/hump.svg?branch=master)](https://travis-ci.org/vrld/hump) 6 | 7 | Contents: 8 | ------------ 9 | 10 | * *gamestate.lua*: Easy gamestate management. 11 | * *timer.lua*: Delayed and time-limited function calls and tweening. 12 | * *vector.lua*: 2D vector math. 13 | * *vector-light.lua*: Lightweight 2D vector math (for optimisation purposes - leads to potentially ugly code). 14 | * *class.lua*: Lightweight object orientation (class or prototype based). 15 | * *signal.lua*: Simple Signal/Slot (aka. Observer) implementation. 16 | * *camera.lua*: Move-, zoom- and rotatable camera with camera locking and movement smoothing. 17 | 18 | Documentation 19 | ============= 20 | 21 | You can find the documentation here: [hump.readthedocs.org](http://hump.readthedocs.org) 22 | 23 | 24 | License 25 | ======= 26 | > Copyright (c) 2010-2018 Matthias Richter 27 | > 28 | > Permission is hereby granted, free of charge, to any person obtaining a copy 29 | > of this software and associated documentation files (the "Software"), to deal 30 | > in the Software without restriction, including without limitation the rights 31 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | > copies of the Software, and to permit persons to whom the Software is 33 | > furnished to do so, subject to the following conditions: 34 | > 35 | > The above copyright notice and this permission notice shall be included in 36 | > all copies or substantial portions of the Software. 37 | > 38 | > Except as contained in this notice, the name(s) of the above copyright holders 39 | > shall not be used in advertising or otherwise to promote the sale, use or 40 | > other dealings in this Software without prior written authorization. 41 | > 42 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 43 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 44 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 45 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 46 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 47 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 48 | > THE SOFTWARE. 49 | -------------------------------------------------------------------------------- /libraries/hump/class.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Copyright (c) 2010-2013 Matthias Richter 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | Except as contained in this notice, the name(s) of the above copyright holders 15 | shall not be used in advertising or otherwise to promote the sale, use or 16 | other dealings in this Software without prior written authorization. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | ]]-- 26 | 27 | local function include_helper(to, from, seen) 28 | if from == nil then 29 | return to 30 | elseif type(from) ~= 'table' then 31 | return from 32 | elseif seen[from] then 33 | return seen[from] 34 | end 35 | 36 | seen[from] = to 37 | for k,v in pairs(from) do 38 | k = include_helper({}, k, seen) -- keys might also be tables 39 | if to[k] == nil then 40 | to[k] = include_helper({}, v, seen) 41 | end 42 | end 43 | return to 44 | end 45 | 46 | -- deeply copies `other' into `class'. keys in `other' that are already 47 | -- defined in `class' are omitted 48 | local function include(class, other) 49 | return include_helper(class, other, {}) 50 | end 51 | 52 | -- returns a deep copy of `other' 53 | local function clone(other) 54 | return setmetatable(include({}, other), getmetatable(other)) 55 | end 56 | 57 | local function new(class) 58 | -- mixins 59 | class = class or {} -- class can be nil 60 | local inc = class.__includes or {} 61 | if getmetatable(inc) then inc = {inc} end 62 | 63 | for _, other in ipairs(inc) do 64 | if type(other) == "string" then 65 | other = _G[other] 66 | end 67 | include(class, other) 68 | end 69 | 70 | -- class implementation 71 | class.__index = class 72 | class.init = class.init or class[1] or function() end 73 | class.include = class.include or include 74 | class.clone = class.clone or clone 75 | 76 | -- constructor call 77 | return setmetatable(class, {__call = function(c, ...) 78 | local o = setmetatable({}, c) 79 | o:init(...) 80 | return o 81 | end}) 82 | end 83 | 84 | -- interface for cross class-system compatibility (see https://github.com/bartbes/Class-Commons). 85 | if class_commons ~= false and not common then 86 | common = {} 87 | function common.class(name, prototype, parent) 88 | return new{__includes = {prototype, parent}} 89 | end 90 | function common.instance(class, ...) 91 | return class(...) 92 | end 93 | end 94 | 95 | 96 | -- the module 97 | return setmetatable({new = new, include = include, clone = clone}, 98 | {__call = function(_,...) return new(...) end}) 99 | -------------------------------------------------------------------------------- /libraries/hump/gamestate.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Copyright (c) 2010-2013 Matthias Richter 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | Except as contained in this notice, the name(s) of the above copyright holders 15 | shall not be used in advertising or otherwise to promote the sale, use or 16 | other dealings in this Software without prior written authorization. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | ]]-- 26 | 27 | local function __NULL__() end 28 | 29 | -- default gamestate produces error on every callback 30 | local state_init = setmetatable({leave = __NULL__}, 31 | {__index = function() error("Gamestate not initialized. Use Gamestate.switch()") end}) 32 | local stack = {state_init} 33 | local initialized_states = setmetatable({}, {__mode = "k"}) 34 | local state_is_dirty = true 35 | 36 | local GS = {} 37 | function GS.new(t) return t or {} end -- constructor - deprecated! 38 | 39 | local function change_state(stack_offset, to, ...) 40 | local pre = stack[#stack] 41 | 42 | -- initialize only on first call 43 | ;(initialized_states[to] or to.init or __NULL__)(to) 44 | initialized_states[to] = __NULL__ 45 | 46 | stack[#stack+stack_offset] = to 47 | state_is_dirty = true 48 | return (to.enter or __NULL__)(to, pre, ...) 49 | end 50 | 51 | function GS.switch(to, ...) 52 | assert(to, "Missing argument: Gamestate to switch to") 53 | assert(to ~= GS, "Can't call switch with colon operator") 54 | ;(stack[#stack].leave or __NULL__)(stack[#stack]) 55 | return change_state(0, to, ...) 56 | end 57 | 58 | function GS.push(to, ...) 59 | assert(to, "Missing argument: Gamestate to switch to") 60 | assert(to ~= GS, "Can't call push with colon operator") 61 | return change_state(1, to, ...) 62 | end 63 | 64 | function GS.pop(...) 65 | assert(#stack > 1, "No more states to pop!") 66 | local pre, to = stack[#stack], stack[#stack-1] 67 | stack[#stack] = nil 68 | ;(pre.leave or __NULL__)(pre) 69 | state_is_dirty = true 70 | return (to.resume or __NULL__)(to, pre, ...) 71 | end 72 | 73 | function GS.current() 74 | return stack[#stack] 75 | end 76 | 77 | -- XXX: don't overwrite love.errorhandler by default: 78 | -- this callback is different than the other callbacks 79 | -- (see http://love2d.org/wiki/love.errorhandler) 80 | -- overwriting thi callback can result in random crashes (issue #95) 81 | local all_callbacks = { 'draw', 'update' } 82 | 83 | -- fetch event callbacks from love.handlers 84 | for k in pairs(love.handlers) do 85 | all_callbacks[#all_callbacks+1] = k 86 | end 87 | 88 | function GS.registerEvents(callbacks) 89 | local registry = {} 90 | callbacks = callbacks or all_callbacks 91 | for _, f in ipairs(callbacks) do 92 | registry[f] = love[f] or __NULL__ 93 | love[f] = function(...) 94 | registry[f](...) 95 | return GS[f](...) 96 | end 97 | end 98 | end 99 | 100 | -- forward any undefined functions 101 | setmetatable(GS, {__index = function(_, func) 102 | -- call function only if at least one 'update' was called beforehand 103 | -- (see issue #46) 104 | if not state_is_dirty or func == 'update' then 105 | state_is_dirty = false 106 | return function(...) 107 | return (stack[#stack][func] or __NULL__)(stack[#stack], ...) 108 | end 109 | end 110 | return __NULL__ 111 | end}) 112 | 113 | return GS 114 | -------------------------------------------------------------------------------- /libraries/hump/hump-0.4-2.rockspec: -------------------------------------------------------------------------------- 1 | package = "hump" 2 | version = "0.4-2" 3 | source = { 4 | url = "git://github.com/vrld/hump" 5 | } 6 | description = { 7 | summary = "Lightweight game development utilities", 8 | detailed = [[Collection of independent components that implement common task needed in games: 9 | - Gamestates that can stack on each other (e.g., for menus) 10 | - Timers and Tweens with thread-like scripting support 11 | - Cameras with camera movement control (locking, smooth follow, etc) 12 | - 2D vector math 13 | - Signals and Slots 14 | - Prototype-based OOP helper 15 | ]], 16 | homepage = "https://hump.readthedocs.io", 17 | license = "MIT", 18 | } 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | build = { 23 | type = "builtin", 24 | modules = { 25 | ["hump.camera"] = "camera.lua", 26 | ["hump.class"] = "class.lua", 27 | ["hump.gamestate"] = "gamestate.lua", 28 | ["hump.signal"] = "signal.lua", 29 | ["hump.timer"] = "timer.lua", 30 | ["hump.vector"] = "vector.lua", 31 | ["hump.vector-light"] = "vector-light.lua" 32 | }, 33 | } 34 | -------------------------------------------------------------------------------- /libraries/hump/signal.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Copyright (c) 2012-2013 Matthias Richter 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | Except as contained in this notice, the name(s) of the above copyright holders 15 | shall not be used in advertising or otherwise to promote the sale, use or 16 | other dealings in this Software without prior written authorization. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | ]]-- 26 | 27 | local Registry = {} 28 | Registry.__index = function(self, key) 29 | return Registry[key] or (function() 30 | local t = {} 31 | rawset(self, key, t) 32 | return t 33 | end)() 34 | end 35 | 36 | function Registry:register(s, f) 37 | self[s][f] = f 38 | return f 39 | end 40 | 41 | function Registry:emit(s, ...) 42 | for f in pairs(self[s]) do 43 | f(...) 44 | end 45 | end 46 | 47 | function Registry:remove(s, ...) 48 | local f = {...} 49 | for i = 1,select('#', ...) do 50 | self[s][f[i]] = nil 51 | end 52 | end 53 | 54 | function Registry:clear(...) 55 | local s = {...} 56 | for i = 1,select('#', ...) do 57 | self[s[i]] = {} 58 | end 59 | end 60 | 61 | function Registry:emitPattern(p, ...) 62 | for s in pairs(self) do 63 | if s:match(p) then self:emit(s, ...) end 64 | end 65 | end 66 | 67 | function Registry:registerPattern(p, f) 68 | for s in pairs(self) do 69 | if s:match(p) then self:register(s, f) end 70 | end 71 | return f 72 | end 73 | 74 | function Registry:removePattern(p, ...) 75 | for s in pairs(self) do 76 | if s:match(p) then self:remove(s, ...) end 77 | end 78 | end 79 | 80 | function Registry:clearPattern(p) 81 | for s in pairs(self) do 82 | if s:match(p) then self[s] = {} end 83 | end 84 | end 85 | 86 | -- instancing 87 | function Registry.new() 88 | return setmetatable({}, Registry) 89 | end 90 | 91 | -- default instance 92 | local default = Registry.new() 93 | 94 | -- module forwards calls to default instance 95 | local module = {} 96 | for k in pairs(Registry) do 97 | if k ~= "__index" then 98 | module[k] = function(...) return default[k](default, ...) end 99 | end 100 | end 101 | 102 | return setmetatable(module, {__call = Registry.new}) 103 | -------------------------------------------------------------------------------- /libraries/hump/spec/timer_spec.lua: -------------------------------------------------------------------------------- 1 | local timer = require 'timer'() 2 | 3 | describe('hump.timer', function() 4 | it('runs a function during a specified time', function() 5 | local delta, remaining 6 | 7 | timer:during(10, function(...) delta, remaining = ... end) 8 | 9 | timer:update(2) 10 | assert.are.equal(delta, 2) 11 | assert.are.equal(8, remaining) 12 | 13 | timer:update(5) 14 | assert.are.equal(delta, 5) 15 | assert.are.equal(3, remaining) 16 | 17 | timer:update(10) 18 | assert.are.equal(delta, 10) 19 | assert.are.equal(0, remaining) 20 | end) 21 | 22 | it('runs a function after a specified time', function() 23 | local finished1 = false 24 | local finished2 = false 25 | 26 | timer:after(3, function(...) finished1 = true end) 27 | timer:after(5, function(...) finished2 = true end) 28 | 29 | timer:update(4) 30 | assert.are.equal(true, finished1) 31 | assert.are.equal(false, finished2) 32 | 33 | timer:update(4) 34 | assert.are.equal(true, finished1) 35 | assert.are.equal(true, finished2) 36 | end) 37 | 38 | it('runs a function every so often', function() 39 | local count = 0 40 | 41 | timer:every(1, function(...) count = count + 1 end) 42 | 43 | timer:update(3) 44 | assert.are.equal(3, count) 45 | 46 | timer:update(7) 47 | assert.are.equal(10, count) 48 | end) 49 | 50 | it('can script timed events', function() 51 | local state 52 | 53 | timer:script(function(wait) 54 | state = 'foo' 55 | wait(1) 56 | state = 'bar' 57 | end) 58 | 59 | assert.are.equal('foo', state) 60 | timer:update(0.5) 61 | assert.are.equal('foo', state) 62 | timer:update(1) 63 | assert.are.equal('bar', state) 64 | end) 65 | 66 | it('cancels and clears timer functions', function() 67 | pending('to be tested...') 68 | end) 69 | 70 | it('tweens', function() 71 | pending('to be tested...') 72 | end) 73 | end) 74 | -------------------------------------------------------------------------------- /libraries/show.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Author: Julio Manuel Fernandez-Diaz 3 | Date: January 12, 2007 4 | (For Lua 5.1) 5 | Modified slightly by RiciLake to avoid the unnecessary table traversal in tablecount() 6 | Formats tables with cycles recursively to any depth. 7 | The output is returned as a string. 8 | References to other tables are shown as values. 9 | Self references are indicated. 10 | The string returned is "Lua code", which can be procesed 11 | (in the case in which indent is composed by spaces or "--"). 12 | Userdata and function keys and values are shown as strings, 13 | which logically are exactly not equivalent to the original code. 14 | This routine can serve for pretty formating tables with 15 | proper indentations, apart from printing them: 16 | print(table.show(t, "t")) -- a typical use 17 | Heavily based on "Saving tables with cycles", PIL2, p. 113. 18 | Arguments: 19 | t is the table. 20 | name is the name of the table (optional) 21 | indent is a first indentation (optional). 22 | --]] 23 | function table.show(t, name, indent) 24 | local cart -- a container 25 | local autoref -- for self references 26 | 27 | --[[ counts the number of elements in a table 28 | local function tablecount(t) 29 | local n = 0 30 | for _, _ in pairs(t) do n = n+1 end 31 | return n 32 | end 33 | ]] 34 | -- (RiciLake) returns true if the table is empty 35 | local function isemptytable(t) return next(t) == nil end 36 | 37 | local function basicSerialize (o) 38 | local so = tostring(o) 39 | if type(o) == "function" then 40 | local info = debug.getinfo(o, "S") 41 | -- info.name is nil because o is not a calling level 42 | if info.what == "C" then 43 | return string.format("%q", so .. ", C function") 44 | else 45 | -- the information is defined through lines 46 | return string.format("%q", so .. ", defined in (" .. 47 | info.linedefined .. "-" .. info.lastlinedefined .. 48 | ")" .. info.source) 49 | end 50 | elseif type(o) == "number" or type(o) == "boolean" then 51 | return so 52 | else 53 | return string.format("%q", so) 54 | end 55 | end 56 | 57 | local function addtocart (value, name, indent, saved, field) 58 | indent = indent or "" 59 | saved = saved or {} 60 | field = field or name 61 | 62 | cart = cart .. indent .. field 63 | 64 | if type(value) ~= "table" then 65 | cart = cart .. " = " .. basicSerialize(value) .. ";\n" 66 | else 67 | if saved[value] then 68 | cart = cart .. " = {}; -- " .. saved[value] 69 | .. " (self reference)\n" 70 | autoref = autoref .. name .. " = " .. saved[value] .. ";\n" 71 | else 72 | saved[value] = name 73 | --if tablecount(value) == 0 then 74 | if isemptytable(value) then 75 | cart = cart .. " = {};\n" 76 | else 77 | cart = cart .. " = {\n" 78 | for k, v in pairs(value) do 79 | k = basicSerialize(k) 80 | local fname = string.format("%s[%s]", name, k) 81 | field = string.format("[%s]", k) 82 | -- three spaces between levels 83 | addtocart(v, fname, indent .. " ", saved, field) 84 | end 85 | cart = cart .. indent .. "};\n" 86 | end 87 | end 88 | end 89 | end 90 | 91 | name = name or "__unnamed__" 92 | if type(t) ~= "table" then 93 | return name .. " = " .. basicSerialize(t) 94 | end 95 | cart, autoref = "", "" 96 | addtocart(t, name, indent) 97 | return cart .. autoref 98 | end -------------------------------------------------------------------------------- /libraries/windfield/mlib/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Davis Claiborne 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgement in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /main.lua: -------------------------------------------------------------------------------- 1 | function love.load() 2 | math.randomseed(os.time()) 3 | 4 | d1 = 0 5 | d2 = 0 6 | colliderToggle = false 7 | 8 | require("src/startup/gameStart") 9 | gameStart() 10 | createNewSave() 11 | 12 | loadMap("menu") 13 | 14 | dj.volume("effect", 1) 15 | 16 | end 17 | 18 | function love.update(dt) 19 | updateAll(dt) 20 | end 21 | 22 | function love.draw() 23 | drawBeforeCamera() 24 | 25 | cam:attach() 26 | drawCamera() 27 | if colliderToggle then 28 | world:draw() 29 | particleWorld:draw() 30 | end 31 | cam:detach() 32 | 33 | drawAfterCamera() 34 | 35 | local debug = require "src/debug" 36 | --debug:d() 37 | --debug:single() 38 | end 39 | 40 | function love.keypressed(key) 41 | if key == 'q' then 42 | --colliderToggle = not (colliderToggle and true); 43 | end 44 | 45 | if key == 'escape' then 46 | if pause.active then 47 | pause:toggle() 48 | else 49 | love.event.quit() 50 | end 51 | end 52 | 53 | if key == 'backspace' then 54 | if fullscreen then 55 | local newWidth = 1920 56 | local newHeight = 1080 57 | local fractionW = love.graphics.getWidth()*0.9 58 | local fractionH = love.graphics.getHeight()*0.9 59 | if fractionW < newWidth then 60 | newWidth = fractionW 61 | end 62 | if fractionH < newHeight then 63 | newHeight = fractionH 64 | end 65 | 66 | setWindowSize(false, newWidth, newHeight) 67 | else 68 | setWindowSize(true) 69 | end 70 | reinitSize() 71 | end 72 | 73 | if key == 'r' then 74 | data.outfit = data.outfit + 1 75 | if data.outfit > 4 then data.outfit = 1 end 76 | sprites.playerSheet = love.graphics.newImage('sprites/player/playerSheet' .. data.outfit .. '.png') 77 | end 78 | 79 | if key == 'lshift' or key == 'rshift' then 80 | --player:interact() 81 | end 82 | 83 | if key == 'return' or key == 'tab' or key == 'e' then 84 | if gamestate == 1 then 85 | pause:toggle() 86 | end 87 | end 88 | 89 | if key == 'space' then 90 | player:roll() 91 | end 92 | 93 | menu:select(key) 94 | end 95 | 96 | function love.keyreleased(key) 97 | if pause.active then return end 98 | if key == 'z' then 99 | useItem('z', true) 100 | elseif key == 'x' then 101 | useItem('x', true) 102 | end 103 | end 104 | 105 | function love.mousepressed( x, y, button ) 106 | if button == 1 then 107 | if pause.active then 108 | pause:equip('left') 109 | else 110 | if love.keyboard.isDown('lshift') then 111 | useItem('altL') 112 | else 113 | useItem('left') 114 | end 115 | end 116 | elseif button == 2 then 117 | if pause.active then 118 | pause:equip('right') 119 | else 120 | if love.keyboard.isDown('lshift') then 121 | useItem('altR') 122 | else 123 | useItem('right') 124 | end 125 | end 126 | end 127 | end 128 | 129 | function love.mousereleased( x, y, button ) 130 | if button == 1 then 131 | if pause.active then 132 | --pause:equip('z') 133 | else 134 | useItem('z', true) 135 | end 136 | elseif button == 2 then 137 | if pause.active then 138 | --pause:equip('x') 139 | else 140 | useItem('x', true) 141 | end 142 | end 143 | end 144 | -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-comfy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-comfy.png -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-edit-lospec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-edit-lospec.png -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-edit.png -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-edit2.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-edit2.aseprite -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-edit2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-edit2.png -------------------------------------------------------------------------------- /maps/_tilesets/Overworld-rebase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/Overworld-rebase.png -------------------------------------------------------------------------------- /maps/_tilesets/cave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/cave.png -------------------------------------------------------------------------------- /maps/_tilesets/inner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/inner.png -------------------------------------------------------------------------------- /maps/_tilesets/overworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/maps/_tilesets/overworld.png -------------------------------------------------------------------------------- /sounds/enemies/enemyDie.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/enemies/enemyDie.wav -------------------------------------------------------------------------------- /sounds/enemies/enemyHurt.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/enemies/enemyHurt.wav -------------------------------------------------------------------------------- /sounds/enemies/projectile.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/enemies/projectile.wav -------------------------------------------------------------------------------- /sounds/items/arrow.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/arrow.wav -------------------------------------------------------------------------------- /sounds/items/boomerang.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/boomerang.wav -------------------------------------------------------------------------------- /sounds/items/chest.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/chest.wav -------------------------------------------------------------------------------- /sounds/items/coin-edit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/coin-edit.wav -------------------------------------------------------------------------------- /sounds/items/coin.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/coin.wav -------------------------------------------------------------------------------- /sounds/items/explosion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/explosion.wav -------------------------------------------------------------------------------- /sounds/items/fire.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/fire.wav -------------------------------------------------------------------------------- /sounds/items/grapple.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/grapple.wav -------------------------------------------------------------------------------- /sounds/items/set.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/set.wav -------------------------------------------------------------------------------- /sounds/items/sword.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/items/sword.wav -------------------------------------------------------------------------------- /sounds/player/playerHurt.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/player/playerHurt.wav -------------------------------------------------------------------------------- /sounds/player/roll.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/player/roll.wav -------------------------------------------------------------------------------- /sounds/ui/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/ui/click.wav -------------------------------------------------------------------------------- /sounds/ui/menu-close.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/ui/menu-close.wav -------------------------------------------------------------------------------- /sounds/ui/menu-open.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/ui/menu-open.wav -------------------------------------------------------------------------------- /sounds/ui/select.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sounds/ui/select.wav -------------------------------------------------------------------------------- /sprites/_edit/arrow.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/arrow.aseprite -------------------------------------------------------------------------------- /sprites/_edit/bat.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/bat.aseprite -------------------------------------------------------------------------------- /sprites/_edit/bat2.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/bat2.aseprite -------------------------------------------------------------------------------- /sprites/_edit/bomb-sheet.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/bomb-sheet.aseprite -------------------------------------------------------------------------------- /sprites/_edit/bomb.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/bomb.aseprite -------------------------------------------------------------------------------- /sprites/_edit/boomerang.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/boomerang.aseprite -------------------------------------------------------------------------------- /sprites/_edit/bow.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/bow.aseprite -------------------------------------------------------------------------------- /sprites/_edit/coin.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/coin.aseprite -------------------------------------------------------------------------------- /sprites/_edit/darkness-wide.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/darkness-wide.xcf -------------------------------------------------------------------------------- /sprites/_edit/eye.ase: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/eye.ase -------------------------------------------------------------------------------- /sprites/_edit/fire-icon.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/fire-icon.aseprite -------------------------------------------------------------------------------- /sprites/_edit/fire.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/fire.aseprite -------------------------------------------------------------------------------- /sprites/_edit/hookshot.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/hookshot.aseprite -------------------------------------------------------------------------------- /sprites/_edit/lantern.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/lantern.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player-bow.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player-bow.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player-idle.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player-idle.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player-roll.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player-roll.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player.png -------------------------------------------------------------------------------- /sprites/_edit/player2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player2.png -------------------------------------------------------------------------------- /sprites/_edit/player3.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player3.aseprite -------------------------------------------------------------------------------- /sprites/_edit/player4.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/player4.aseprite -------------------------------------------------------------------------------- /sprites/_edit/playerSheet.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/playerSheet.aseprite -------------------------------------------------------------------------------- /sprites/_edit/skeleton-knife.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/skeleton-knife.aseprite -------------------------------------------------------------------------------- /sprites/_edit/skeleton-mage.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/skeleton-mage.aseprite -------------------------------------------------------------------------------- /sprites/_edit/skeleton.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/skeleton.aseprite -------------------------------------------------------------------------------- /sprites/_edit/slice.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/slice.aseprite -------------------------------------------------------------------------------- /sprites/_edit/sword.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/sword.aseprite -------------------------------------------------------------------------------- /sprites/_edit/tree.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/tree.aseprite -------------------------------------------------------------------------------- /sprites/_edit/ui.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_edit/ui.aseprite -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/Inner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/Inner.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/NPC_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/NPC_test.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/Overworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/Overworld.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/cave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/cave.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/character.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/character.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/font.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/log.png -------------------------------------------------------------------------------- /sprites/_shelf/gfx/gfx/objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/_shelf/gfx/gfx/objects.png -------------------------------------------------------------------------------- /sprites/effects/blobs/blob.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/blobs/blob.aseprite -------------------------------------------------------------------------------- /sprites/effects/blobs/blob1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/blobs/blob1.png -------------------------------------------------------------------------------- /sprites/effects/blobs/blob2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/blobs/blob2.png -------------------------------------------------------------------------------- /sprites/effects/blobs/blob3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/blobs/blob3.png -------------------------------------------------------------------------------- /sprites/effects/blobs/blob4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/blobs/blob4.png -------------------------------------------------------------------------------- /sprites/effects/darkMagicB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/darkMagicB.png -------------------------------------------------------------------------------- /sprites/effects/darkMagicW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/darkMagicW.png -------------------------------------------------------------------------------- /sprites/effects/darkness-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/darkness-wide.png -------------------------------------------------------------------------------- /sprites/effects/darkness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/darkness.png -------------------------------------------------------------------------------- /sprites/effects/death.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/death.png -------------------------------------------------------------------------------- /sprites/effects/explosion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/explosion.png -------------------------------------------------------------------------------- /sprites/effects/fireball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/fireball.png -------------------------------------------------------------------------------- /sprites/effects/fuseSmoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/fuseSmoke.png -------------------------------------------------------------------------------- /sprites/effects/fuseSmoke2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/fuseSmoke2.png -------------------------------------------------------------------------------- /sprites/effects/rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/rock.png -------------------------------------------------------------------------------- /sprites/effects/scorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/scorch.png -------------------------------------------------------------------------------- /sprites/effects/scorch/raw-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/scorch/raw-triangle.png -------------------------------------------------------------------------------- /sprites/effects/scorch/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/scorch/triangle.png -------------------------------------------------------------------------------- /sprites/effects/scorch2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/scorch2.png -------------------------------------------------------------------------------- /sprites/effects/scorch3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/scorch3.png -------------------------------------------------------------------------------- /sprites/effects/shadows/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/shadows/arrow.png -------------------------------------------------------------------------------- /sprites/effects/shadows/boomerang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/shadows/boomerang.png -------------------------------------------------------------------------------- /sprites/effects/shadows/tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/shadows/tree.png -------------------------------------------------------------------------------- /sprites/effects/slice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/slice.png -------------------------------------------------------------------------------- /sprites/effects/sliceAnim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/effects/sliceAnim.png -------------------------------------------------------------------------------- /sprites/enemies/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/alert.png -------------------------------------------------------------------------------- /sprites/enemies/bat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/bat.png -------------------------------------------------------------------------------- /sprites/enemies/batDead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/batDead.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eye1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eye1.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eye2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eye2.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eye3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eye3.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eyeDead1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eyeDead1.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eyeDead2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eyeDead2.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eyeDead3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eyeDead3.png -------------------------------------------------------------------------------- /sprites/enemies/eye/eyeShadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye/eyeShadow.png -------------------------------------------------------------------------------- /sprites/enemies/eye2/eyeBody.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye2/eyeBody.png -------------------------------------------------------------------------------- /sprites/enemies/eye2/iris1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/eye2/iris1.png -------------------------------------------------------------------------------- /sprites/enemies/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/shadow.png -------------------------------------------------------------------------------- /sprites/enemies/shadowMed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/shadowMed.png -------------------------------------------------------------------------------- /sprites/enemies/skeleton/knife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/skeleton/knife.png -------------------------------------------------------------------------------- /sprites/enemies/skeleton/knife2.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/skeleton/knife2.aseprite -------------------------------------------------------------------------------- /sprites/enemies/skeleton/knife2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/skeleton/knife2.png -------------------------------------------------------------------------------- /sprites/enemies/skeleton/mage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/skeleton/mage.png -------------------------------------------------------------------------------- /sprites/enemies/skeleton/skeletonStun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/enemies/skeleton/skeletonStun.png -------------------------------------------------------------------------------- /sprites/environment/breakableRock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/breakableRock.png -------------------------------------------------------------------------------- /sprites/environment/breakableWall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/breakableWall.png -------------------------------------------------------------------------------- /sprites/environment/chestBigClosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/chestBigClosed.png -------------------------------------------------------------------------------- /sprites/environment/chestBigOpen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/chestBigOpen.png -------------------------------------------------------------------------------- /sprites/environment/chestClosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/chestClosed.png -------------------------------------------------------------------------------- /sprites/environment/chestOpen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/chestOpen.png -------------------------------------------------------------------------------- /sprites/environment/lockedDoor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/lockedDoor.png -------------------------------------------------------------------------------- /sprites/environment/tree-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/tree-old.png -------------------------------------------------------------------------------- /sprites/environment/tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/tree.png -------------------------------------------------------------------------------- /sprites/environment/tree2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/tree2.png -------------------------------------------------------------------------------- /sprites/environment/wave.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/wave.aseprite -------------------------------------------------------------------------------- /sprites/environment/wave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/environment/wave.png -------------------------------------------------------------------------------- /sprites/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/icon.png -------------------------------------------------------------------------------- /sprites/items/arrow-bundle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/arrow-bundle.png -------------------------------------------------------------------------------- /sprites/items/arrow-bundle2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/arrow-bundle2.png -------------------------------------------------------------------------------- /sprites/items/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/arrow.png -------------------------------------------------------------------------------- /sprites/items/bomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bomb.png -------------------------------------------------------------------------------- /sprites/items/bombSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bombSheet.png -------------------------------------------------------------------------------- /sprites/items/bombSheet.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bombSheet.xcf -------------------------------------------------------------------------------- /sprites/items/boomerang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/boomerang.png -------------------------------------------------------------------------------- /sprites/items/bow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bow1.png -------------------------------------------------------------------------------- /sprites/items/bow2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bow2.png -------------------------------------------------------------------------------- /sprites/items/bowIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/bowIcon.png -------------------------------------------------------------------------------- /sprites/items/coin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/coin.png -------------------------------------------------------------------------------- /sprites/items/coin1Sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/coin1Sheet.png -------------------------------------------------------------------------------- /sprites/items/coin2Sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/coin2Sheet.png -------------------------------------------------------------------------------- /sprites/items/coin3Sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/coin3Sheet.png -------------------------------------------------------------------------------- /sprites/items/coinIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/coinIcon.png -------------------------------------------------------------------------------- /sprites/items/container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/container.png -------------------------------------------------------------------------------- /sprites/items/fire-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/fire-icon.png -------------------------------------------------------------------------------- /sprites/items/grapple-armed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/grapple-armed.png -------------------------------------------------------------------------------- /sprites/items/grapple-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/grapple-chain.png -------------------------------------------------------------------------------- /sprites/items/grapple-handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/grapple-handle.png -------------------------------------------------------------------------------- /sprites/items/grapple-head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/grapple-head.png -------------------------------------------------------------------------------- /sprites/items/grapple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/grapple.png -------------------------------------------------------------------------------- /sprites/items/heart-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/heart-old.png -------------------------------------------------------------------------------- /sprites/items/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/heart.png -------------------------------------------------------------------------------- /sprites/items/heartAnim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/heartAnim.png -------------------------------------------------------------------------------- /sprites/items/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/key.png -------------------------------------------------------------------------------- /sprites/items/lantern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/lantern.png -------------------------------------------------------------------------------- /sprites/items/lootShadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/lootShadow.png -------------------------------------------------------------------------------- /sprites/items/lootShadow2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/lootShadow2.png -------------------------------------------------------------------------------- /sprites/items/quiver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/quiver.png -------------------------------------------------------------------------------- /sprites/items/sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/sword.png -------------------------------------------------------------------------------- /sprites/items/sword2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/items/sword2.png -------------------------------------------------------------------------------- /sprites/luap-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/luap-edit.png -------------------------------------------------------------------------------- /sprites/npc/merchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/npc/merchant.png -------------------------------------------------------------------------------- /sprites/player/playerShadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerShadow.png -------------------------------------------------------------------------------- /sprites/player/playerSheet-lospec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet-lospec.png -------------------------------------------------------------------------------- /sprites/player/playerSheet.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet.aseprite -------------------------------------------------------------------------------- /sprites/player/playerSheet1-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet1-old.png -------------------------------------------------------------------------------- /sprites/player/playerSheet1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet1.png -------------------------------------------------------------------------------- /sprites/player/playerSheet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet2.png -------------------------------------------------------------------------------- /sprites/player/playerSheet3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet3.png -------------------------------------------------------------------------------- /sprites/player/playerSheet4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheet4.png -------------------------------------------------------------------------------- /sprites/player/playerSheetcomfy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/player/playerSheetcomfy.png -------------------------------------------------------------------------------- /sprites/ui/ammoBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/ammoBox.png -------------------------------------------------------------------------------- /sprites/ui/heart-empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/heart-empty.png -------------------------------------------------------------------------------- /sprites/ui/heart-half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/heart-half.png -------------------------------------------------------------------------------- /sprites/ui/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/heart.png -------------------------------------------------------------------------------- /sprites/ui/itemBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/itemBox.png -------------------------------------------------------------------------------- /sprites/ui/pause/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/cursor.png -------------------------------------------------------------------------------- /sprites/ui/pause/equipBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/equipBox.png -------------------------------------------------------------------------------- /sprites/ui/pause/itemBox.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/itemBox.aseprite -------------------------------------------------------------------------------- /sprites/ui/pause/itemPanel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/itemPanel.png -------------------------------------------------------------------------------- /sprites/ui/pause/itemPanelFade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/itemPanelFade.png -------------------------------------------------------------------------------- /sprites/ui/pause/itemPanelL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/itemPanelL.png -------------------------------------------------------------------------------- /sprites/ui/pause/itemPanelR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/itemPanelR.png -------------------------------------------------------------------------------- /sprites/ui/pause/mouse.aseprite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/mouse.aseprite -------------------------------------------------------------------------------- /sprites/ui/pause/mouse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/mouse.png -------------------------------------------------------------------------------- /sprites/ui/pause/wideBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/challacade/legend-of-lua/37d0365135e2f3e288d1ab730f5d6dcbb479eaf2/sprites/ui/pause/wideBox.png -------------------------------------------------------------------------------- /src/debug.lua: -------------------------------------------------------------------------------- 1 | -- This file contains several functions for displaying debug data 2 | 3 | local debug = {} 4 | debug.lineX1 = 0 5 | debug.lineY1 = 0 6 | debug.lineX2 = 1 7 | debug.lineY2 = 1 8 | 9 | function debug:d() 10 | 11 | love.graphics.setColor(0, 0, 0, 0.7) 12 | love.graphics.rectangle("fill", 16, 16, 840, 220) 13 | 14 | love.graphics.setColor(1, 1, 1, 1) 15 | love.graphics.setFont(fonts.debug) 16 | love.graphics.print("d1: " .. d1, 50, 32) 17 | love.graphics.print("d2: " .. d2, 50, 118) 18 | 19 | end 20 | 21 | function debug:single() 22 | 23 | love.graphics.setColor(0, 0, 0, 0.7) 24 | love.graphics.rectangle("fill", 16, 16, 1120, 165) 25 | 26 | love.graphics.setColor(1, 1, 1, 1) 27 | love.graphics.setFont(fonts.debug) 28 | love.graphics.print("data.bombCount: " .. data.bombCount, 40, 22) 29 | 30 | end 31 | 32 | function debug:singleSmall() 33 | 34 | love.graphics.setColor(0, 0, 0, 0.7) 35 | love.graphics.rectangle("fill", 16, 16, 580, 120) 36 | 37 | love.graphics.setColor(1, 1, 1, 1) 38 | love.graphics.setFont(fonts.debugSmall) 39 | love.graphics.print(d1, 40, 22) 40 | 41 | end 42 | 43 | function debug:playerPosition() 44 | 45 | love.graphics.setColor(0, 0, 0, 0.7) 46 | love.graphics.rectangle("fill", 16, 16, 660, 220) 47 | 48 | local px = player:getX() 49 | local py = player:getY() 50 | 51 | if px >= 0 then 52 | px = " " .. px 53 | end 54 | 55 | if py >= 0 then 56 | py = " " .. py 57 | end 58 | 59 | love.graphics.setColor(1, 1, 1, 1) 60 | love.graphics.setFont(fonts.debug) 61 | love.graphics.print("player.x: " .. px, 50, 32) 62 | love.graphics.print("player.y: " .. py, 50, 118) 63 | 64 | end 65 | 66 | function debug:ammoCount() 67 | love.graphics.setColor(0, 0, 0, 0.7) 68 | love.graphics.rectangle("fill", 16, 16, love.graphics:getWidth()-32, 240) 69 | 70 | love.graphics.setColor(1, 1, 1, 1) 71 | love.graphics.setFont(fonts.debug) 72 | love.graphics.print("bombCount: " .. data.bombCount, 50, 32) 73 | 74 | end 75 | 76 | function debug:drawLine() 77 | if d1 == "Detected" then return end 78 | love.graphics.setColor(0,0,1,0.75) 79 | love.graphics.setLineWidth(2) 80 | love.graphics.line(debug.lineX1, debug.lineY1, debug.lineX2, debug.lineY2) 81 | end 82 | 83 | return debug -------------------------------------------------------------------------------- /src/draw.lua: -------------------------------------------------------------------------------- 1 | function drawBeforeCamera() 2 | menu:draw() 3 | end 4 | 5 | function drawCamera() 6 | 7 | if gamestate == 0 then return end 8 | setWhite() 9 | 10 | if gameMap.layers["Background"] then 11 | gameMap:drawLayer(gameMap.layers["Background"]) 12 | end 13 | 14 | if gameMap.layers["Base"] then 15 | gameMap:drawLayer(gameMap.layers["Base"]) 16 | end 17 | 18 | if gameMap.layers["Objects"] then 19 | gameMap:drawLayer(gameMap.layers["Objects"]) 20 | end 21 | 22 | if gameMap.layers["Objects2"] then 23 | gameMap:drawLayer(gameMap.layers["Objects2"]) 24 | end 25 | 26 | if gameMap.layers["Test"] then 27 | --gameMap:drawLayer(gameMap.layers["Test"]) 28 | end 29 | 30 | drawShadows() 31 | walls:draw() 32 | effects:draw(-1) -- two layers of effects 33 | chests:draw(-1) 34 | bombs:draw() 35 | boomerang:draw() 36 | loots:draw() 37 | arrows:draw(-1) 38 | fireballs:draw(-1) 39 | grapple:draw(-1) 40 | effects:draw(0) 41 | trees:draw(-1) 42 | player:draw() 43 | chests:draw(1) 44 | arrows:draw(1) 45 | fireballs:draw(1) 46 | grapple:draw(1) 47 | npcs:draw() 48 | enemies:draw() 49 | effects:drawDarkMagic() 50 | blasts:draw() 51 | projectiles:draw() 52 | effects:draw(1) 53 | particles:draw() 54 | trees:draw(1) 55 | 56 | if gameMap.dark then 57 | --love.graphics.setShader(shaders.trueLight) 58 | --love.graphics.rectangle("fill", -10, -10, 10000, 10000) 59 | --love.graphics.setShader() 60 | love.graphics.draw(sprites.effects.darkness, player:getX(), player:getY(), nil, nil, nil, sprites.effects.darkness:getWidth()/2, sprites.effects.darkness:getHeight()/2) 61 | end 62 | 63 | end 64 | 65 | function drawAfterCamera() 66 | curtain:draw() 67 | if gamestate == 0 then return end 68 | drawHUD() 69 | pause:draw() 70 | end -------------------------------------------------------------------------------- /src/effects/blast.lua: -------------------------------------------------------------------------------- 1 | blasts = {} 2 | 3 | function spawnBlast(x, y, size, color, time) 4 | blast = {} 5 | blast.x = x 6 | blast.y = y 7 | blast.color = color 8 | blast.radius = 1 9 | blast.max_radius = size 10 | blast.time = time 11 | blast.timer = 0.25 12 | blast.timer2 = time + 1 13 | blast.dead = false 14 | blast.alpha = 255 15 | blast.state = 0 16 | 17 | function blast:update(dt, i) 18 | self.timer2 = self.timer2 - dt 19 | if self.timer2 < 0 then 20 | self.dead = true 21 | end 22 | 23 | if self.state == 0 then 24 | local max = self.max_radius 25 | flux.to(self, self.time, { radius = max }) 26 | flux.to(self, self.time, { alpha = 0 }):ease("quadin") 27 | self.state = 1 28 | end 29 | end 30 | table.insert(blasts, blast) 31 | end 32 | 33 | function blasts:update(dt) 34 | for i,w in ipairs(blasts) do 35 | w:update(dt, i) 36 | end 37 | 38 | local i = table.getn(blasts) 39 | while i > 0 do 40 | if blasts[i].dead == true then 41 | table.remove(blasts, i) 42 | end 43 | i = i - 1 44 | end 45 | end 46 | 47 | function blasts:draw() 48 | for _,b in ipairs(blasts) do 49 | love.graphics.setColor(1, 1, 1, b.alpha/255) 50 | love.graphics.circle("fill", b.x, b.y, b.radius) 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /src/effects/particles/death.lua: -------------------------------------------------------------------------------- 1 | local function deathInit(particle, x, y, args) 2 | 3 | particle.physics = particleWorld:newCircleCollider(x, y, 4) 4 | particle.physics:setFixedRotation(true) 5 | particle.physics:setCollisionClass("Particle") 6 | particle.physics.parent = particle 7 | 8 | particle.sprite = sprites.effects.death 9 | particle.timer = 3 10 | particle.alpha = 1 11 | particle.scaleX = 1 12 | 13 | if args.scl then particle.scaleX = args.scl end 14 | 15 | local mag = 80 + math.random()*80 16 | particle.physics:setLinearVelocity(((args.dir):normalized()*mag):unpack()) 17 | 18 | function particle:update(dt) 19 | self.scaleX = self.scaleX - dt*1.5 20 | if self.scaleX <= 0 then 21 | self.alpha = 0 22 | end 23 | end 24 | 25 | function particle:draw() 26 | love.graphics.setColor(1,1,1,self.alpha) 27 | local px, py = self.physics:getPosition() 28 | love.graphics.draw(self.sprite, px, py, nil, self.scaleX, nil, self.sprite:getWidth()/2, self.sprite:getHeight()/2) 29 | setWhite() 30 | end 31 | 32 | return particle 33 | 34 | end 35 | 36 | return deathInit -------------------------------------------------------------------------------- /src/effects/particles/debris.lua: -------------------------------------------------------------------------------- 1 | local function debrisInit(particle, x, y, args) 2 | 3 | particle.physics = particleWorld:newCircleCollider(x, y, 4) 4 | particle.physics:setFixedRotation(true) 5 | particle.physics:setCollisionClass("Particle") 6 | particle.physics.parent = particle 7 | 8 | particle.sprite = sprites.effects.rock 9 | particle.rot = math.random() * 3.14 10 | particle.rotSpeed = math.random() * 0.1 + 0.01 11 | 12 | particle.timer = 3 13 | particle.alpha = 1 14 | 15 | if args then 16 | if args == 1 then 17 | particle.physics:setLinearVelocity(-80, -150) 18 | elseif args == 2 then 19 | particle.physics:setLinearVelocity(80, -150) 20 | elseif args == 3 then 21 | particle.physics:setLinearVelocity(-120, -60) 22 | elseif args == 4 then 23 | particle.physics:setLinearVelocity(120, -60) 24 | end 25 | end 26 | 27 | function particle:update(dt) 28 | self.rot = self.rot + self.rotSpeed 29 | --self.alpha = self.alpha - dt 30 | end 31 | 32 | function particle:draw() 33 | love.graphics.setColor(1,1,1,self.alpha) 34 | local px, py = self.physics:getPosition() 35 | love.graphics.draw(self.sprite, px, py, self.rot, nil, nil, self.sprite:getWidth()/2, self.sprite:getHeight()/2) 36 | setWhite() 37 | end 38 | 39 | return particle 40 | 41 | end 42 | 43 | return debrisInit -------------------------------------------------------------------------------- /src/effects/particles/particle.lua: -------------------------------------------------------------------------------- 1 | particles = {} 2 | 3 | function spawnParticle(type, x, y, args) 4 | 5 | local particle = {} 6 | particle.type = type 7 | particle.args = args 8 | particle.tag = "" -- used for finding related particles 9 | 10 | -- Function that sets the properties of the new particle 11 | local init = require("src/effects/particles/" .. type) 12 | particle = init(particle, x, y, args) 13 | 14 | -- This update function is the same for all particles, regardless of type 15 | function particle:genericUpdate(dt) 16 | if self.timer > 0 then 17 | self.timer = self.timer - dt 18 | else 19 | self.dead = true 20 | self.timer = 0 21 | end 22 | end 23 | 24 | table.insert(particles, particle) 25 | 26 | end 27 | 28 | function particles:update(dt) 29 | 30 | -- Calls update functions on all particles 31 | for i,p in ipairs(self) do 32 | p:update(dt) 33 | p:genericUpdate(dt) 34 | end 35 | 36 | -- Iterate through all particles in reverse to remove the dead ones 37 | for i=#particles,1,-1 do 38 | if particles[i].dead then 39 | if particles[i].tween then 40 | particles[i].tween:stop() 41 | end 42 | if particles[i].physics then 43 | particles[i].physics:destroy() 44 | end 45 | table.remove(particles, i) 46 | end 47 | end 48 | 49 | end 50 | 51 | function particles:draw() 52 | 53 | -- Calls draw functions on all particles 54 | for i,p in ipairs(self) do 55 | p:draw() 56 | end 57 | 58 | end 59 | -------------------------------------------------------------------------------- /src/effects/particles/particleEvent.lua: -------------------------------------------------------------------------------- 1 | function particleEvent(type, x, y, arg) 2 | 3 | if type == "rockBreak" then 4 | spawnParticle("debris", x, y, 1) 5 | spawnParticle("debris", x, y, 2) 6 | spawnParticle("debris", x, y, 3) 7 | spawnParticle("debris", x, y, 4) 8 | end 9 | 10 | if type == "death" then 11 | --spawnParticle("death", x, y, {dir = vector(-1, 1)}) 12 | --spawnParticle("death", x, y, {dir = vector(-1, -1)}) 13 | --spawnParticle("death", x, y, {dir = vector(1, 1)}) 14 | --spawnParticle("death", x, y, {dir = vector(1, -1)}) 15 | 16 | --[[for i=1,14 do 17 | local angle = 0 - (i/14 * math.pi) 18 | local newDir = vector(1, 0):rotated(angle) 19 | effects:spawn("damage", x, y, {dir = newDir}) 20 | end]] 21 | 22 | --[[for i=1,40 do 23 | local angle = 0 - (i/41 * math.pi) 24 | local newDir = vector(1, 0):rotated(angle) 25 | spawnParticle("death", x, y, {dir = newDir}) 26 | end]] 27 | 28 | spawnBlast(x, y, 20, "white", 0.2) 29 | for i=1,20 do 30 | local angle = math.pi/-6 - (i/21 * math.pi/1.5) 31 | local newDir = vector(1, 0):rotated(angle) 32 | spawnParticle("death", x, y, {dir = newDir}) 33 | end 34 | shake:start(0.1, 1, 0.02) 35 | end 36 | 37 | if type == "playerHit" then 38 | --spawnBlast(x, y, 20, "white", 0.2) 39 | for i=1,14 do 40 | local angle = math.pi/-6 - (i/21 * math.pi/1.5) 41 | local newDir = vector(1, 0):rotated(angle) 42 | spawnParticle("death", x, y, {dir = newDir, scl = 0.6}) 43 | end 44 | end 45 | 46 | end -------------------------------------------------------------------------------- /src/effects/shadows.lua: -------------------------------------------------------------------------------- 1 | function drawShadows() 2 | 3 | local spr = sprites.effects.treeShadow 4 | for _,t in ipairs(trees) do 5 | love.graphics.draw(spr, t.x + t.width/2, t.y+8, nil, nil, nil, spr:getWidth()/2, spr:getHeight()/2) 6 | end 7 | 8 | spr = sprites.effects.boomerangShadow 9 | if boomerang.state > 0 then 10 | love.graphics.draw(spr, boomerang.x, boomerang.y+6, nil, 0.8, nil, spr:getWidth()/2, spr:getHeight()/2) 11 | end 12 | 13 | spr = sprites.effects.arrowShadow 14 | for _,a in ipairs(arrows) do 15 | love.graphics.draw(spr, a.x, a.y+5, a.rot, nil, nil, spr:getWidth()/2, spr:getHeight()/2) 16 | end 17 | 18 | spr = sprites.effects.boomerangShadow 19 | for _,f in ipairs(fireballs) do 20 | love.graphics.draw(spr, f.x, f.y+6, nil, 0.8, nil, spr:getWidth()/2, spr:getHeight()/2) 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /src/enemies/bat.lua: -------------------------------------------------------------------------------- 1 | local function batInit(enemy, x, y, args) 2 | enemy.physics = world:newBSGRectangleCollider(x, y, 11, 9, 1) 3 | enemy.physics:setCollisionClass('Enemy') 4 | enemy.physics:setFixedRotation(true) 5 | enemy.physics:setMass(1) 6 | enemy.physics:setLinearDamping(2) 7 | enemy.physics.parent = enemy 8 | 9 | enemy.form = 1 10 | enemy.sprite = sprites.enemies.bat 11 | 12 | if args and args.form ~= nil then 13 | enemy.form = args.form 14 | end 15 | 16 | enemy.health = 1 17 | enemy.speed = 0 18 | enemy.maxSpeed = 80 19 | enemy.magnitude = 450 20 | enemy.dir = vector(0, 1) 21 | enemy.viewDistance = 100 22 | 23 | enemy.grid = anim8.newGrid(16, 16, enemy.sprite:getWidth(), enemy.sprite:getHeight()) 24 | enemy.anim = anim8.newAnimation(enemy.grid('1-2', 1), 0.15) 25 | 26 | enemy.floatTime = 0.5 27 | enemy.floatY = 0 28 | enemy.floatMax = 1.5 29 | 30 | enemy.scaleX = 1 31 | if math.random() < 0.5 then enemy.scaleX = -1 end 32 | 33 | enemy:floatUp(enemy.floatMax, true) 34 | 35 | function enemy:update(dt) 36 | enemy:moveLogic(dt) 37 | local px, py = player:getPosition() 38 | local ex, ey = self.physics:getPosition() 39 | self:setScaleX() 40 | end 41 | 42 | function enemy:draw() 43 | setWhite() 44 | local ex, ey = self.physics:getPosition() 45 | love.graphics.draw(sprites.enemies.shadow, ex, ey+10, nil, nil, nil, sprites.enemies.eyeShadow:getWidth()/2, sprites.enemies.eyeShadow:getHeight()/2) 46 | if self.flashTimer > 0 then 47 | love.graphics.setColor(223/255,106/255,106/255,1) 48 | end 49 | if self.dizzyTimer == 0 then 50 | self.anim:draw(self.sprite, ex, ey-self.floatY, nil, self.scaleX, 1, 8, 8) 51 | else 52 | love.graphics.draw(sprites.enemies.batDead, ex, ey+3, nil, self.scaleX, 1, 8, 8) 53 | end 54 | setWhite() 55 | if self.state == 99 then 56 | love.graphics.draw(sprites.enemies.alert, ex, ey-14.5, nil, nil, nil, sprites.enemies.alert:getWidth()/2, sprites.enemies.alert:getHeight()/2) 57 | end 58 | end 59 | 60 | function enemy:die() 61 | local ex, ey = self.physics:getPosition() 62 | local args = {} 63 | args.scaleX = self.scaleX 64 | args.form = self.form 65 | effects:spawn("batDeath", ex, ey+3, args) 66 | end 67 | 68 | return enemy 69 | 70 | end 71 | 72 | return batInit -------------------------------------------------------------------------------- /src/enemies/eye.lua: -------------------------------------------------------------------------------- 1 | local function eyeInit(enemy, x, y, args) 2 | enemy.physics = world:newBSGRectangleCollider(x, y, 12, 16, 3) 3 | enemy.physics:setCollisionClass('Enemy') 4 | enemy.physics:setFixedRotation(true) 5 | enemy.physics:setMass(1) 6 | enemy.physics:setLinearDamping(2) 7 | enemy.physics.parent = enemy 8 | 9 | enemy.form = 1 10 | enemy.sprite = sprites.enemies.eyeBody 11 | enemy.iris = sprites.enemies.iris1 12 | if args and args.form ~= nil then 13 | enemy.form = args.form 14 | end 15 | 16 | enemy.health = 2 17 | enemy.speed = 0 18 | enemy.maxSpeed = 50 19 | enemy.magnitude = 300 20 | enemy.dir = vector(0, 1) 21 | enemy.viewDistance = 100 22 | 23 | if enemy.form == 2 then 24 | enemy.health = 3 25 | enemy.maxSpeed = 80 26 | enemy.magnitude = 450 27 | --enemy.iris = sprites.enemies.iris2 28 | elseif enemy.form == 3 then 29 | enemy.health = 4 30 | enemy.maxSpeed = 100 31 | enemy.magnitude = 500 32 | --enemy.iris = sprites.enemies.iris3 33 | end 34 | 35 | enemy.grid = anim8.newGrid(20, 20, enemy.sprite:getWidth(), enemy.sprite:getHeight()) 36 | enemy.anim = anim8.newAnimation(enemy.grid('1-2', 1), 0.3) 37 | 38 | enemy.floatTime = 0.7 39 | enemy.floatY = 0 40 | enemy.floatMax = 1.5 41 | 42 | enemy:floatUp(enemy.floatMax, true) 43 | 44 | function enemy:update(dt) 45 | enemy:moveLogic(dt) 46 | self:setScaleX() 47 | end 48 | 49 | function enemy:draw() 50 | setWhite() 51 | local ex, ey = self.physics:getPosition() 52 | love.graphics.draw(sprites.enemies.eyeShadow, ex, ey+10, nil, nil, nil, sprites.enemies.eyeShadow:getWidth()/2, sprites.enemies.eyeShadow:getHeight()/2) 53 | if self.flashTimer > 0 then 54 | love.graphics.setColor(223/255,106/255,106/255,1) 55 | end 56 | if self.dizzyTimer == 0 then 57 | local irisOffset = getFromToVector(ex, ey, player:getX(), player:getY()) * 1.2 58 | if self.state >= 1 and self.state < 2 then 59 | irisOffset = self.wanderDir * 1.2 60 | end 61 | local irisX, irisY = irisOffset:unpack() 62 | 63 | self.anim:draw(self.sprite, ex, ey-self.floatY, nil, nil, nil, 10, 10) 64 | love.graphics.draw(self.iris, ex + irisX, ey-self.floatY-1.5+irisY, nil, nil, nil, self.iris:getWidth()/2, self.iris:getHeight()/2) 65 | else 66 | love.graphics.draw(sprites.enemies["eyeDead" .. self.form], ex, ey+3, nil, nil, nil, 10, 10) 67 | end 68 | setWhite() 69 | if self.state == 99 then 70 | love.graphics.draw(sprites.enemies.alert, ex, ey-14.5, nil, nil, nil, sprites.enemies.alert:getWidth()/2, sprites.enemies.alert:getHeight()/2) 71 | end 72 | end 73 | 74 | function enemy:die() 75 | local ex, ey = self.physics:getPosition() 76 | local args = {} 77 | args.form = self.form 78 | effects:spawn("eyeDeath", ex, ey+3, args) 79 | end 80 | 81 | return enemy 82 | 83 | end 84 | 85 | return eyeInit -------------------------------------------------------------------------------- /src/enemies/projectile.lua: -------------------------------------------------------------------------------- 1 | projectiles = {} 2 | 3 | function spawnProjectile(type, x, y) 4 | local projectile = {} 5 | local rad = 5 6 | 7 | if type == "mage" then 8 | dj.play(sounds.enemies.projectile, "static", "effect") 9 | rad = 4 10 | end 11 | 12 | projectile = world:newCircleCollider(x, y, rad) 13 | projectile.type = type 14 | projectile.speed = 100 15 | projectile.dir = getSelfToPlayerVector(x, y) 16 | projectile.timer = 0 17 | 18 | if type == "mage" then 19 | function projectile:update(dt) 20 | self.timer = self.timer - dt 21 | if self.timer < 0 then 22 | self.timer = 0.02 23 | effects:spawn("darkMagicSpec", self:getX(), self:getY()) 24 | end 25 | end 26 | 27 | function projectile:draw() 28 | --love.graphics.setColor(0,0,0,1) 29 | --love.graphics.circle('fill', self:getX(), self:getY(), 4) 30 | end 31 | end 32 | 33 | projectile.dir = projectile.dir * projectile.speed 34 | projectile:setLinearVelocity(projectile.dir:unpack()) 35 | projectile:setCollisionClass("Projectile") 36 | projectile:setFixedRotation(true) 37 | 38 | table.insert(projectiles, projectile) 39 | end 40 | 41 | function projectiles:update(dt) 42 | for _,p in ipairs(projectiles) do 43 | if p.anim then 44 | p.anim:update(dt) 45 | end 46 | if p.update then 47 | p:update(dt) 48 | if p:enter('Wall') then 49 | p.dead = true 50 | end 51 | end 52 | end 53 | 54 | local i = #projectiles 55 | while i > 0 do 56 | if projectiles[i].dead then 57 | projectiles[i]:destroy() 58 | table.remove(projectiles, i) 59 | end 60 | i = i - 1 61 | end 62 | end 63 | 64 | function projectiles:draw() 65 | for _,p in ipairs(projectiles) do 66 | if p.draw then 67 | p:draw() 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /src/enemies/skeleton.lua: -------------------------------------------------------------------------------- 1 | local function skeletonInit(enemy, x, y, args) 2 | enemy.physics = world:newBSGRectangleCollider(x, y, 12, 16, 3) 3 | enemy.physics:setCollisionClass('Enemy') 4 | enemy.physics:setFixedRotation(true) 5 | enemy.physics:setMass(1) 6 | enemy.physics:setLinearDamping(2) 7 | enemy.physics.parent = enemy 8 | 9 | enemy.form = 1 10 | enemy.sprite = sprites.enemies.skeletonKnife 11 | 12 | if args and args.form ~= nil then 13 | enemy.form = args.form 14 | end 15 | 16 | enemy.health = 3 17 | enemy.magnitude = 40 18 | enemy.dir = vector(0, 1) 19 | enemy.viewDistance = 100 20 | 21 | if enemy.form == 2 then -- Mage 22 | enemy.sprite = sprites.enemies.skeletonMage 23 | enemy.chase = false 24 | enemy.projTimer = 0 25 | 26 | function enemy:aggro(dt) 27 | self.projTimer = self.projTimer - dt 28 | if self.projTimer < 0 then 29 | if self.state == 100 then 30 | self.state = 101 31 | self.projTimer = 1.2 32 | enemy.anim = enemy.animations.walk 33 | elseif self.state == 101 then 34 | self.state = 100 35 | self.projTimer = 0.4 36 | enemy.anim = enemy.animations.staff 37 | spawnProjectile('mage', self.physics:getX(), self.physics:getY()) 38 | end 39 | end 40 | 41 | if self.state == 101 then 42 | self.dir = getSelfToPlayerVector(self.physics:getX(), self.physics:getY())*10 -- speed 43 | self.physics:setX(self.physics:getX() + self.dir.x * dt) 44 | self.physics:setY(self.physics:getY() + self.dir.y * dt) 45 | end 46 | end 47 | end 48 | 49 | enemy.grid = anim8.newGrid(20, 24, enemy.sprite:getWidth(), enemy.sprite:getHeight()) 50 | 51 | enemy.animations = {} 52 | enemy.animations.walk = anim8.newAnimation(enemy.grid('1-2', 1), 0.4) 53 | 54 | if enemy.form == 2 then 55 | enemy.animations.staff = anim8.newAnimation(enemy.grid(3, 1), 1) 56 | end 57 | 58 | enemy.anim = enemy.animations.walk 59 | 60 | enemy.scaleX = 1 61 | if math.random() < 0.5 then enemy.scaleX = -1 end 62 | 63 | -- Used to control the walk animation 64 | -- 0: standing still 65 | -- 1: walking 66 | -- 2: running 67 | enemy.moving = 0 68 | 69 | function enemy:update(dt) 70 | enemy:moveLogic(dt, true) -- Stiff movement 71 | local px, py = player:getPosition() 72 | local ex, ey = self.physics:getPosition() 73 | 74 | self:setScaleX() 75 | 76 | if self.state == 1 or self.state == 99 then 77 | self.moving = 0 78 | if self.anim then self.anim:gotoFrame(1) end 79 | elseif self.state == 1.1 then 80 | self.moving = 1 81 | else 82 | if self.form == 2 then 83 | self.moving = 1 84 | else 85 | self.moving = 2 86 | end 87 | end 88 | 89 | end 90 | 91 | function enemy:draw() 92 | setWhite() 93 | local ex, ey = self.physics:getPosition() 94 | local shadow = sprites.enemies.shadowMed 95 | local shadowOff = -0.75 * self.scaleX 96 | love.graphics.draw(shadow, ex + shadowOff, ey+9, nil, nil, nil, shadow:getWidth()/2, shadow:getHeight()/2) 97 | if self.flashTimer > 0 then 98 | love.graphics.setColor(223/255,106/255,106/255,1) 99 | end 100 | if self.dizzyTimer == 0 then 101 | self.anim:draw(self.sprite, ex, ey, nil, self.scaleX, 1, 10, 12) 102 | else 103 | love.graphics.draw(sprites.enemies.skeletonDead, ex - (3*self.scaleX), ey-4, nil, self.scaleX, 1, 8, 8) 104 | end 105 | setWhite() 106 | if self.state == 99 then 107 | love.graphics.draw(sprites.enemies.alert, ex, ey-14.5, nil, nil, nil, sprites.enemies.alert:getWidth()/2, sprites.enemies.alert:getHeight()/2) 108 | end 109 | end 110 | 111 | function enemy:die() 112 | local ex, ey = self.physics:getPosition() 113 | local args = {} 114 | args.scaleX = self.scaleX 115 | args.form = self.form 116 | effects:spawn("batDeath", ex, ey+3, args) 117 | end 118 | 119 | return enemy 120 | 121 | end 122 | 123 | return skeletonInit -------------------------------------------------------------------------------- /src/environment/tree.lua: -------------------------------------------------------------------------------- 1 | trees = {} 2 | 3 | function spawnTree(x, y, type, id) 4 | local tree = {} 5 | tree.x = x 6 | tree.y = y 7 | tree.type = type 8 | tree.id = id 9 | tree.width = 12 10 | tree.height = 10 11 | tree.sprite = sprites.environment.tree 12 | tree.layer = 1 13 | 14 | if type then 15 | tree.sprite = sprites.environment['tree' .. type] 16 | end 17 | 18 | tree.x = tree.x + (16-tree.width)/2 19 | tree.y = tree.y + 2 20 | 21 | -- Wall spawned overtop of the tree, passed tree as parent 22 | spawnWall(tree.x, tree.y, tree.width, tree.height, nil, nil, tree) 23 | 24 | function tree:interact() 25 | 26 | end 27 | 28 | table.insert(trees, tree) 29 | end 30 | 31 | function trees:update(dt) 32 | for _,t in ipairs(trees) do 33 | if t.y + 2 < player:getY() then 34 | --t.layer = -1 35 | t.layer = 1 36 | else 37 | t.layer = 1 38 | end 39 | end 40 | end 41 | 42 | function trees:draw(layer) 43 | for _,t in ipairs(trees) do 44 | if t.layer == layer then 45 | love.graphics.draw(t.sprite, t.x + t.width/2, t.y, nil, nil, nil, t.sprite:getWidth()/2, t.sprite:getHeight()*0.75) 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /src/environment/water.lua: -------------------------------------------------------------------------------- 1 | waters = {} 2 | 3 | function spawnWater(x, y, width, height) 4 | local water = {} 5 | water.x = x 6 | water.y = y 7 | water.width = width 8 | water.height = height 9 | water.timer = math.random(0, 2) + math.random() 10 | 11 | local effectiveW = width-16 12 | local effectiveY = height-16 13 | local effectiveArea = effectiveW * effectiveY 14 | local max = 400/effectiveArea 15 | water.maxTime = max 16 | 17 | -- Wall spawned overtop of the water, passed water as parent 18 | spawnWall(water.x, water.y, water.width, water.height, nil, 'ground', water) 19 | 20 | function water:update(dt) 21 | self.timer = self.timer - dt 22 | if self.timer < 0 then 23 | self.timer = self.maxTime + math.random() 24 | local ex = math.random(0, self.width-16) 25 | local ey = math.random(0, self.height-16) 26 | effects:spawn("wave", self.x + 8 + ex, self.y + 8 + ey) 27 | end 28 | end 29 | 30 | table.insert(waters, water) 31 | end 32 | 33 | function waters:update(dt) 34 | for _,w in ipairs(waters) do 35 | w:update(dt) 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /src/items/arrow.lua: -------------------------------------------------------------------------------- 1 | arrows = {} 2 | 3 | function spawnArrow(x, y) 4 | if data.arrowCount < 1 then 5 | return 6 | end 7 | 8 | --data.arrowCount = data.arrowCount - 1 9 | local direction = toMouseVector(x, y) 10 | 11 | local arrow = {} 12 | arrow.x = x 13 | arrow.y = y 14 | arrow.timer = 4 15 | arrow.dead = false 16 | arrow.dir = direction 17 | arrow.dirVec = direction 18 | arrow.rot = math.atan2(direction.y, direction.x) 19 | arrow.rad = 3 20 | arrow.speed = 230 21 | 22 | function arrow:update(dt) 23 | self.timer = self.timer - dt 24 | if self.timer < 0 then 25 | self.dead = true 26 | end 27 | 28 | --effects:spawn("arrowTrail", self.x, self.y, self.dir) 29 | 30 | self.x = self.x + (self.dirVec.x * self.speed * dt) 31 | self.y = self.y + (self.dirVec.y * self.speed * dt) 32 | 33 | -- Query for walls 34 | local walls = world:queryCircleArea(self.x, self.y, self.rad, {'Wall'}) 35 | if #walls > 0 then self.dead = true end 36 | 37 | -- Query for enemies 38 | local hitEnemies = world:queryCircleArea(self.x, self.y, self.rad, {'Enemy'}) 39 | for _,e in ipairs(hitEnemies) do 40 | e.parent:hit(1, self.dirVec, 0.1) 41 | end 42 | if #hitEnemies > 0 then self.dead = true end 43 | 44 | end 45 | 46 | dj.play(sounds.items.arrow, "static", "effect") 47 | 48 | table.insert(arrows, arrow) 49 | end 50 | 51 | function arrows:update(dt) 52 | for _,b in ipairs(arrows) do 53 | b:update(dt) 54 | end 55 | 56 | local i = #arrows 57 | while i > 0 do 58 | if arrows[i].dead then 59 | table.remove(arrows, i) 60 | end 61 | i = i - 1 62 | end 63 | end 64 | 65 | function arrows:draw(layer) 66 | for _,a in ipairs(arrows) do 67 | if (layer == -1 and a.y < player:getY() or (layer == 1 and a.y >= player:getY())) then 68 | love.graphics.draw(sprites.items.arrow, a.x, a.y, a.rot, nil, nil, sprites.items.arrow:getWidth()/2, sprites.items.arrow:getHeight()/2) 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /src/items/bomb.lua: -------------------------------------------------------------------------------- 1 | bombs = {} 2 | 3 | function spawnBomb() 4 | if data.bombCount < 1 then 5 | --return 6 | end 7 | 8 | --data.bombCount = data.bombCount - 1 9 | 10 | local bomb = {} 11 | bomb.x = player:getX() 12 | bomb.y = player:getY() 13 | bomb.state = 0 -- 0 is just placed, 1 is flashing 14 | bomb.timer = 2 15 | bomb.smokeTimer = 0.03 16 | bomb.dead = false 17 | bomb.explosionRadius = 16 18 | 19 | bomb.grid = anim8.newGrid(12, 12, sprites.items.bombSheet:getWidth(), sprites.items.bombSheet:getHeight()) 20 | bomb.anim1 = anim8.newAnimation(bomb.grid(1, 1), 1) 21 | bomb.anim2 = anim8.newAnimation(bomb.grid('1-2', 1), 0.13) 22 | bomb.anim = bomb.anim1 23 | 24 | player:useSet() 25 | dj.play(sounds.items.set, "static", "effect") 26 | 27 | local offVec = toMouseVector(bomb.x, bomb.y)*14 28 | bomb.x = bomb.x + offVec.x 29 | bomb.y = bomb.y + offVec.y 30 | 31 | function bomb:explode() 32 | effects:spawn("explosion", self.x, self.y) 33 | effects:spawn("scorch", self.x, self.y) 34 | shake:start(0.1, 1.5, 0.03) 35 | self.dead = true 36 | 37 | -- Query for breakable walls 38 | local walls = world:queryCircleArea(self.x, self.y, self.explosionRadius, {'Wall'}) 39 | for _,w in ipairs(walls) do 40 | if w.breakable then 41 | w.dead = true 42 | end 43 | end 44 | 45 | local hitEnemies = world:queryCircleArea(self.x, self.y, self.explosionRadius, {'Enemy'}) 46 | for _,e in ipairs(hitEnemies) do 47 | local dir = getFromToVector(self.x, self.y, e:getX(), e:getY()) 48 | e.parent:hit(3, dir, 0.2) 49 | end 50 | 51 | local hitPlayer = world:queryCircleArea(self.x, self.y, self.explosionRadius, {'Player'}) 52 | if #hitPlayer > 0 then 53 | player:hurt(1, self.x, self.y) 54 | end 55 | 56 | for _,b in ipairs(bombs) do 57 | if distanceBetween(self.x, self.y, b.x, b.y) < (self.explosionRadius + 12) then 58 | b.state = 1 59 | b.timer = 0.1 60 | end 61 | end 62 | end 63 | 64 | function bomb:update(dt) 65 | self.timer = self.timer - dt 66 | if self.timer < 0 then 67 | if self.state == 0 then 68 | self.timer = 1 69 | self.anim = self.anim2 -- start flashing 70 | self.state = 1 71 | elseif self.state == 1 then 72 | self:explode() 73 | end 74 | end 75 | self.smokeTimer = self.smokeTimer - dt 76 | if self.smokeTimer < 0 then 77 | effects:spawn("fuseSmoke", self.x, self.y-6.5) 78 | self.smokeTimer = 0.05 79 | end 80 | self.anim:update(dt) 81 | end 82 | 83 | table.insert(bombs, bomb) 84 | end 85 | 86 | function bombs:update(dt) 87 | for _,b in ipairs(bombs) do 88 | b:update(dt) 89 | end 90 | 91 | local i = #bombs 92 | while i > 0 do 93 | if bombs[i].dead then 94 | table.remove(bombs, i) 95 | end 96 | i = i - 1 97 | end 98 | end 99 | 100 | function bombs:draw() 101 | for _,b in ipairs(bombs) do 102 | b.anim:draw(sprites.items.bombSheet, b.x, b.y, nil, nil, nil, 6, 6) 103 | --love.graphics.draw(sprites.items.bomb, b.x, b.y, nil, nil, nil, 6, 6) 104 | end 105 | end 106 | -------------------------------------------------------------------------------- /src/items/boomerang.lua: -------------------------------------------------------------------------------- 1 | boomerang = {} 2 | boomerang.x = 0 3 | boomerang.y = 0 4 | boomerang.sprite = sprites.items.boomerang 5 | boomerang.rot = 0 6 | boomerang.dir = vector(0, 0) 7 | boomerang.speed = 250 8 | boomerang.baseSpeed = 250 9 | boomerang.timer = 0 10 | boomerang.accel = 340 11 | boomerang.rad = 6 12 | boomerang.soundTimer = 0 13 | 14 | -- 0 = inactive 15 | -- 1 = flying away 16 | -- 2 = returning to player 17 | boomerang.state = 0 18 | 19 | function boomerang:update(dt) 20 | if self.state == 0 then return end 21 | 22 | self.rot = self.rot + 20*dt 23 | 24 | if self.state == 1 then 25 | self.speed = self.speed - self.accel*dt 26 | self.dir = self.dir:normalized() * self.speed 27 | if self.speed < 0 then 28 | self.speed = 1 29 | self.state = 2 30 | end 31 | 32 | -- Query for walls 33 | local walls = world:queryCircleArea(self.x, self.y, self.rad, {'Wall'}) 34 | if #walls > 0 then 35 | self.state = 2 36 | end 37 | 38 | boomerang:lookForEnemies() 39 | elseif self.state == 2 then 40 | self.dir = vector(player:getX() - self.x, player:getY() - self.y):normalized() * self.speed 41 | self.speed = self.speed + self.accel*dt 42 | boomerang:lookForEnemies() 43 | if distanceBetween(player:getX(), player:getY(), self.x, self.y) < 10 then 44 | boomerang:reset() 45 | end 46 | end 47 | 48 | for _,l in ipairs(loots) do 49 | if distanceBetween(l.x, l.y, self.x, self.y) < 10 then 50 | l.boomeranged = true 51 | end 52 | end 53 | 54 | self.x = self.x + self.dir.x * dt 55 | self.y = self.y + self.dir.y * dt 56 | 57 | self.soundTimer = self.soundTimer - dt 58 | if self.soundTimer < 0 then 59 | self.soundTimer = 0.24 60 | --dj.play(sounds.items.boomerang, "static", "effect") 61 | end 62 | end 63 | 64 | function boomerang:lookForEnemies() 65 | local hitEnemies = world:queryCircleArea(self.x, self.y, self.rad, {'Enemy'}) 66 | for _,e in ipairs(hitEnemies) do 67 | if e.parent.dizzyTimer <= 0 or boomerang.state == 1 then 68 | e.parent:hit(0, self.dir, 0.1, 2) 69 | particleEvent("playerHit", e.parent.physics:getX(), e.parent.physics:getY()) 70 | end 71 | end 72 | if #hitEnemies > 0 then self.state = 2 end 73 | end 74 | 75 | function boomerang:draw() 76 | -- don't draw anything if the boomerang is not active 77 | if self.state == 0 then return end 78 | love.graphics.draw(self.sprite, self.x, self.y, self.rot, nil, nil, self.sprite:getWidth()/2, self.sprite:getHeight()/2) 79 | end 80 | 81 | function boomerang:throw(dir) 82 | if self.state > 0 then return end 83 | self.x = player:getX() 84 | self.y = player:getY() 85 | self.state = 1 86 | self.timer = 0.65 87 | self.dir = toMouseVector(self.x, self.y) * self.speed 88 | dj.play(sounds.items.boomerang, "static", "effect") 89 | self.soundTimer = 0.24 90 | 91 | player:useSet() 92 | end 93 | 94 | function boomerang:reset() 95 | self.state = 0 96 | self.speed = self.baseSpeed 97 | end 98 | -------------------------------------------------------------------------------- /src/items/chest.lua: -------------------------------------------------------------------------------- 1 | chests = {} 2 | 3 | function spawnChest(x, y, id, size) 4 | local chest = {} 5 | chest.state = 0 6 | chest.x = x 7 | chest.y = y 8 | chest.id = id 9 | chest.size = "small" 10 | chest.state = 0 11 | chest.layer = -1 12 | if size then chest.size = size end 13 | 14 | -- if the id is in this list, the chest was already opened 15 | if data.chests[id] then 16 | chest.state = 1 17 | end 18 | 19 | if chest.size == "small" then 20 | chest.width = 16 21 | chest.height = 15 22 | elseif chest.size == "big" then 23 | chest.width = 20 24 | chest.height = 15 25 | end 26 | 27 | -- Wall spawned overtop of the chest, passed chest as parent 28 | spawnWall(chest.x, chest.y, chest.width, chest.height, nil, nil, chest) 29 | 30 | if chest.size == "small" then 31 | chest.x = chest.x + 1 32 | chest.y = chest.y - 3 33 | chest.centerX = chest.x + 7 34 | chest.centerY = chest.y + 8 35 | elseif chest.size == "big" then 36 | chest.y = chest.y - 2 37 | chest.centerX = chest.x + 10 38 | chest.centerY = chest.y + 8 39 | end 40 | 41 | function chest:interact() 42 | if self.state == 0 then 43 | self.state = 1 44 | dj.play(sounds.items.chest, "static", "effect") 45 | data.chests[self.id] = true 46 | if self.size == "small" then 47 | chests:spawnSmallLoot(self.centerX, self.centerY, self.id) 48 | elseif self.size == "big" then 49 | player:gotItem(chests:getBigLoot(self.id), true) 50 | end 51 | end 52 | end 53 | 54 | function chest:update(dt) 55 | if distanceBetween(self.x+self.width/2, self.y+self.height/2, player:getX(), player:getY()) < 24 then 56 | self:interact() 57 | end 58 | 59 | if self.y + 2 < player:getY() then 60 | self.layer = -1 61 | else 62 | self.layer = 1 63 | end 64 | end 65 | 66 | table.insert(chests, chest) 67 | end 68 | 69 | function chests:update(dt) 70 | for _,c in ipairs(chests) do 71 | c:update(dt) 72 | end 73 | end 74 | 75 | function chests:draw(layer) 76 | love.graphics.setColor(1,1,1,1) 77 | for _,c in ipairs(chests) do 78 | if c.layer == layer then 79 | if c.state == 0 and c.size == "small" then 80 | love.graphics.draw(sprites.items.chestClosed, c.x, c.y) 81 | elseif c.state == 1 and c.size == "small" then 82 | love.graphics.draw(sprites.items.chestOpen, c.x, c.y) 83 | elseif c.state == 0 and c.size == "big" then 84 | love.graphics.draw(sprites.items.chestBigClosed, c.x, c.y) 85 | elseif c.state == 1 and c.size == "big" then 86 | love.graphics.draw(sprites.items.chestBigOpen, c.x, c.y) 87 | end 88 | end 89 | end 90 | end 91 | 92 | function chests:spawnSmallLoot(x, y, id) 93 | local function getJumpVec(dirX, dirY, speed) 94 | local vecSpeed = 30 95 | if speed then vecSpeed = speed end 96 | return vector(dirX, dirY):normalized() * vecSpeed 97 | end 98 | 99 | if id == 'test1' then 100 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(-1, 0)) 101 | spawnLoot(x, y, "coin1", true, nil, getJumpVec(-1, 1)) 102 | spawnLoot(x, y, "coin1", true, nil, getJumpVec(1, 1)) 103 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(1, 0)) 104 | elseif id == 'test2' then 105 | spawnLoot(x, y, "coin3", true, nil, getJumpVec(-1, 0)) 106 | spawnLoot(x, y, "coin3", true, nil, getJumpVec(1, 0)) 107 | elseif id == 'test3' then 108 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(-1, 0)) 109 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(-1, 1)) 110 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(1, 1)) 111 | spawnLoot(x, y, "coin2", true, nil, getJumpVec(1, 0)) 112 | elseif id == 'testKey' then 113 | spawnLoot(x, y, "key", true, nil, getJumpVec(1, 1)) 114 | end 115 | end 116 | 117 | function chests:getBigLoot(id) 118 | if id == 'test2' then 119 | return sprites.items.boomerang 120 | end 121 | end 122 | -------------------------------------------------------------------------------- /src/items/grapple.lua: -------------------------------------------------------------------------------- 1 | grapple = {} 2 | grapple.x = 0 3 | grapple.y = 0 4 | grapple.handleX = 0 5 | grapple.handleY = 0 6 | grapple.timer = 0 7 | grapple.maxTimer = 0.4 8 | grapple.dirVec = getDirectionVector('down') 9 | grapple.rot = getRotationFromDir('down') 10 | grapple.rad = 3 11 | grapple.speed = 200 12 | grapple.chainCount = 10 13 | 14 | -- 0: inactive 15 | -- 1: away 16 | -- 2: hooked 17 | -- -1: return 18 | grapple.state = 0 19 | 20 | function grapple:shoot(dir) 21 | 22 | grapple.state = 1 23 | grapple.timer = grapple.maxTimer 24 | grapple.dir = dir 25 | grapple.rot = getRotationFromVector(dir) 26 | 27 | grapple.x = player:getX() 28 | grapple.y = player:getY() 29 | 30 | grapple.handleX = grapple.x + dir.x*3 31 | grapple.handleY = grapple.y + dir.y*3 32 | 33 | dj.play(sounds.items.grapple, "static", "effect") 34 | 35 | end 36 | 37 | function grapple:update(dt) 38 | 39 | self.timer = self.timer - dt 40 | if self.timer < 0 then 41 | self.timer = 0 42 | if self.state == 1 then self.state = -1 end 43 | end 44 | 45 | if self.state == 1 or self.state == -1 then 46 | self.x = self.x + (self.dir.x * self.speed * dt) * self.state 47 | self.y = self.y + (self.dir.y * self.speed * dt) * self.state 48 | end 49 | 50 | if self.state == 2 then 51 | self.handleX = self.handleX + (self.dir.x * self.speed * dt) 52 | self.handleY = self.handleY + (self.dir.y * self.speed * dt) 53 | 54 | if distanceBetween(player:getX(), player:getY(), grapple.x, grapple.y) < 12 then 55 | grapple.state = 0 56 | player.state = 0 57 | player:resetAnimation(player.dir) 58 | player:setCollisionClass('Player') 59 | end 60 | end 61 | 62 | if self.state == 1 then 63 | -- Query for walls 64 | local walls = world:queryCircleArea(self.x, self.y, self.rad, {'Wall'}) 65 | if #walls > 0 then 66 | self.state = 2 67 | dj.play(sounds.items.set, "static", "effect") 68 | player.state = 4.2 69 | player:setCollisionClass('Ignore') 70 | end 71 | 72 | -- Query for enemies 73 | local hitEnemies = world:queryCircleArea(self.x, self.y, self.rad, {'Enemy'}) 74 | for _,e in ipairs(hitEnemies) do 75 | if e.parent.hookable then 76 | e.parent.dizzyTimer = 1 77 | e.parent.hookVec = grapple.dir 78 | end 79 | grapple.state = -1 80 | end 81 | 82 | for _,l in ipairs(loots) do 83 | if distanceBetween(l.x, l.y, grapple.x, grapple.y) < 10 then 84 | self.state = -1 85 | l.hookVec = grapple.dir 86 | end 87 | end 88 | end 89 | 90 | end 91 | 92 | function grapple:draw(layer) 93 | if self.state == 0 then return end 94 | 95 | -- Always draw the chains in layer -1 96 | local chainSpr = sprites.items.grappleChain 97 | if layer == -1 then 98 | --[[ 99 | local dist = distanceBetween(grapple.handleX, grapple.handleY, grapple.x, grapple.y) 100 | local interval = dist / grapple.chainCount 101 | for i = 1, grapple.chainCount do 102 | local offX = interval * i * grapple.dir.x 103 | local offY = interval * i * grapple.dir.y 104 | love.graphics.draw(chainSpr, self.handleX + offX, self.handleY + offY, self.rot, nil, nil, chainSpr:getWidth()/2, chainSpr:getHeight()/2) 105 | end 106 | ]] 107 | 108 | --love.graphics.setColor(115/255, 95/255, 75/255) 109 | love.graphics.setColor(26/255,26/255,26/255,1) 110 | love.graphics.setLineWidth(2) 111 | --love.graphics.line(grapple.handleX, grapple.handleY, grapple.x, grapple.y) 112 | love.graphics.setColor(179/255, 147/255, 116/255) 113 | --love.graphics.setColor(115/255, 95/255, 75/255) 114 | love.graphics.setColor(0.1,0.1,0.1,1) 115 | love.graphics.setLineWidth(0.9) 116 | love.graphics.line(grapple.handleX, grapple.handleY, grapple.x, grapple.y) 117 | setWhite() 118 | end 119 | 120 | local hookSpr = sprites.items.grappleHead 121 | if (layer == -1 and self.dir == 'up') or (layer == 1 and self.dir ~= 'up') then 122 | love.graphics.draw(hookSpr, self.x, self.y, self.rot, nil, nil, hookSpr:getWidth()/2, hookSpr:getHeight()/2) 123 | end 124 | end 125 | -------------------------------------------------------------------------------- /src/items/item.lua: -------------------------------------------------------------------------------- 1 | function useItem(key, released) 2 | if data.item[key] == "sword" and released ~= true then 3 | player:swingSword() 4 | elseif data.item[key] == "boomerang" and released ~= true then 5 | player:useBoomerang() 6 | elseif data.item[key] == "bomb" and released ~= true then 7 | player:useBomb() 8 | elseif data.item[key] == "bow" and player.state ~= 0 then 9 | player:useBow() -- adds bow to the buffer 10 | elseif data.item[key] == "grapple" and released ~= true then 11 | player:usegrapple() 12 | elseif data.item[key] == "fire" and released ~= true then 13 | player:useFire() 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /src/levels/curtain.lua: -------------------------------------------------------------------------------- 1 | curtain = {} 2 | 3 | -- 0 = inactive 4 | -- 1 = closing 5 | -- 2 = opening 6 | curtain.state = 0 7 | curtain.alpha = 0 8 | curtain.rad = 0 9 | curtain.type = "circle" 10 | curtain.x = -10 11 | curtain.y = -10 12 | curtain.dirTime = 0.5 13 | 14 | -- Transition information 15 | curtain.destMap = "test" 16 | curtain.destX = 0 17 | curtain.destY = 0 18 | 19 | function curtain:call(destMap, destX, destY, type) 20 | curtain.destMap = destMap 21 | curtain.destX = destX 22 | curtain.destY = destY 23 | curtain.type = "circle" 24 | if type then curtain.type = type end 25 | player.state = 12 26 | curtain.x = -10 27 | curtain.y = -10 28 | curtain.width = love.graphics.getWidth() + 20 29 | curtain.height = love.graphics.getHeight() + 20 30 | curtain:close() 31 | end 32 | 33 | function curtain:getRad() 34 | if love.graphics.getWidth() > love.graphics.getHeight() then 35 | return love.graphics.getWidth()*0.65 36 | else 37 | return love.graphics.getHeight()*0.65 38 | end 39 | end 40 | 41 | function curtain:draw() 42 | if curtain.state == 0 then return end 43 | 44 | local bVal = 16 45 | 46 | if curtain.type == "fade" then 47 | love.graphics.setColor(bVal/255,bVal/255,bVal/255, curtain.alpha) 48 | love.graphics.rectangle("fill", -10, -10, love.graphics.getWidth() + 20, love.graphics.getHeight() + 20) 49 | elseif curtain.type == "left" or curtain.type == "right" or curtain.type == "up" or curtain.type == "down" then 50 | love.graphics.setColor(bVal/255,bVal/255,bVal/255,1) 51 | love.graphics.rectangle("fill", curtain.x, curtain.y, curtain.width, curtain.height) 52 | else -- circle 53 | love.graphics.setColor(bVal/255,bVal/255,bVal/255,1) 54 | love.graphics.circle("fill", love.graphics.getWidth()/2, love.graphics.getHeight()/2, self.rad) 55 | end 56 | end 57 | 58 | function curtain:close() 59 | self.state = 1 60 | 61 | if curtain.type == "fade" then 62 | flux.to(self, 0.4, {alpha = 1}):ease("linear"):oncomplete(function() self:open() end) 63 | elseif curtain.type == "left" then 64 | curtain.x = -1 * curtain.width - 10 65 | curtain.y = -10 66 | flux.to(self, curtain.dirTime, {x = -10}):ease("quadout"):oncomplete(function() self:open() end) 67 | elseif curtain.type == "right" then 68 | curtain.x = curtain.width + 10 69 | curtain.y = -10 70 | flux.to(self, curtain.dirTime, {x = -10}):ease("quadout"):oncomplete(function() self:open() end) 71 | elseif curtain.type == "down" then 72 | curtain.x = -10 73 | curtain.y = curtain.height + 10 74 | flux.to(self, curtain.dirTime, {y = -10}):ease("quadout"):oncomplete(function() self:open() end) 75 | elseif curtain.type == "up" then 76 | curtain.x = -10 77 | curtain.y = -1 * curtain.height - 10 78 | flux.to(self, curtain.dirTime, {y = -10}):ease("quadout"):oncomplete(function() self:open() end) 79 | else -- circle 80 | local destRad = self.getRad() 81 | flux.to(self, 1, {rad = destRad}):ease("quadout"):oncomplete(function() self:open() end) 82 | end 83 | end 84 | 85 | function curtain:open() 86 | self.state = 2 87 | cam.smoother = Camera.smooth.none() 88 | triggerTransition(self.destMap, self.destX, self.destY) 89 | love.graphics.setBackgroundColor(96/255, 174/255, 140/255) 90 | 91 | local onFinish = function() 92 | self.state = 0 93 | player.state = 0 94 | cam.smoother = Camera.smooth.damped(8) 95 | end 96 | 97 | if curtain.type == "fade" then 98 | flux.to(self, 0.4, {alpha = 0}):ease("linear"):oncomplete(onFinish) 99 | elseif curtain.type == "left" then 100 | curtain.x = -10 101 | curtain.y = -10 102 | local dest = curtain.width + 10 103 | flux.to(self, curtain.dirTime, {x = dest}):ease("quadin"):oncomplete(onFinish) 104 | elseif curtain.type == "right" then 105 | curtain.x = -10 106 | curtain.y = -10 107 | local dest = -1 * curtain.width - 10 108 | flux.to(self, curtain.dirTime, {x = dest}):ease("quadin"):oncomplete(onFinish) 109 | elseif curtain.type == "down" then 110 | curtain.x = -10 111 | curtain.y = -10 112 | local dest = -1 * curtain.height - 10 113 | flux.to(self, curtain.dirTime, {y = dest}):ease("quadin"):oncomplete(onFinish) 114 | elseif curtain.type == "up" then 115 | curtain.x = -10 116 | curtain.y = -10 117 | local dest = curtain.height + 10 118 | flux.to(self, curtain.dirTime, {y = dest}):ease("quadin"):oncomplete(onFinish) 119 | else -- circle 120 | flux.to(self, 1, {rad = 0}):ease("quadin"):oncomplete(onFinish) 121 | end 122 | end 123 | -------------------------------------------------------------------------------- /src/levels/loadMap.lua: -------------------------------------------------------------------------------- 1 | function loadMap(mapName, destX, destY) 2 | destroyAll() 3 | 4 | if destX and destY then 5 | player:setPosition(destX, destY) 6 | end 7 | 8 | loadedMap = mapName 9 | gameMap = sti("maps/" .. mapName .. ".lua") 10 | 11 | if gameMap.layers["Walls"] then 12 | for i, obj in pairs(gameMap.layers["Walls"].objects) do 13 | spawnWall(obj.x, obj.y, obj.width, obj.height, obj.name, obj.type) 14 | end 15 | end 16 | 17 | if gameMap.layers["Enemies"] then 18 | for i, obj in pairs(gameMap.layers["Enemies"].objects) do 19 | local args = {} 20 | if obj.properties.form then args.form = obj.properties.form end 21 | spawnEnemy(obj.x, obj.y, obj.name, args) 22 | end 23 | end 24 | 25 | if gameMap.layers["Loot"] then 26 | for i, obj in pairs(gameMap.layers["Loot"].objects) do 27 | spawnLoot(obj.x, obj.y, obj.type, false, obj.properties.price) 28 | end 29 | end 30 | 31 | if gameMap.layers["Chests"] then 32 | for i, obj in pairs(gameMap.layers["Chests"].objects) do 33 | spawnChest(obj.x, obj.y, obj.name, obj.type) 34 | end 35 | end 36 | 37 | if gameMap.layers["NPC"] then 38 | for i, obj in pairs(gameMap.layers["NPC"].objects) do 39 | spawnNPC(obj.name, obj.x, obj.y) 40 | end 41 | end 42 | 43 | if gameMap.layers["Transitions"] then 44 | for i, obj in pairs(gameMap.layers["Transitions"].objects) do 45 | spawnTransition(obj.x, obj.y, obj.width, obj.height, obj.name, obj.properties.destX, obj.properties.destY, obj.type) 46 | end 47 | end 48 | 49 | if gameMap.layers["Triggers"] then 50 | for i, obj in pairs(gameMap.layers["Triggers"].objects) do 51 | spawnTrigger(obj.x, obj.y, obj.name) 52 | end 53 | end 54 | 55 | if gameMap.layers["Trees"] then 56 | for i, obj in pairs(gameMap.layers["Trees"].objects) do 57 | spawnTree(obj.x, obj.y, obj.type, obj.name) 58 | end 59 | end 60 | 61 | if gameMap.layers["Water"] then 62 | for i, obj in pairs(gameMap.layers["Water"].objects) do 63 | spawnWater(obj.x, obj.y, obj.width, obj.height) 64 | end 65 | end 66 | 67 | if gameMap.properties.dark then 68 | gameMap.dark = gameMap.properties.dark 69 | else 70 | gameMap.dark = false 71 | end 72 | 73 | end -------------------------------------------------------------------------------- /src/levels/npc.lua: -------------------------------------------------------------------------------- 1 | npcs = {} 2 | 3 | function spawnNPC(name, x, y) 4 | local npc = {} 5 | npc.name = name 6 | npc.x = x 7 | npc.y = y 8 | npc.sprite = sprites.npc.merchant 9 | 10 | function npc:draw() 11 | love.graphics.draw(self.sprite, self.x, self.y, nil, nil, nil, self.sprite:getWidth()/2, self.sprite:getHeight()/2) 12 | end 13 | 14 | table.insert(npcs, npc) 15 | end 16 | 17 | function npcs:draw() 18 | for _,n in ipairs(npcs) do 19 | n:draw() 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /src/levels/transition.lua: -------------------------------------------------------------------------------- 1 | transitions = {} 2 | 3 | function spawnTransition(x, y, width, height, id, destX, destY, transitionType) 4 | 5 | local transition = world:newRectangleCollider(x, y, width, height, {collision_class = "Transition"}) 6 | transition:setType('static') 7 | 8 | transition.id = id 9 | transition.destX = destX 10 | transition.destY = destY 11 | transition.type = "standard" 12 | 13 | if transitionType then transition.type = transitionType end 14 | 15 | table.insert(transitions, transition) 16 | 17 | end 18 | 19 | function triggerTransition(id, destX, destY) 20 | local newMap = "test" 21 | 22 | if id == "toTestShop" then 23 | newMap = "testShop" 24 | elseif id == "toTest" then 25 | newMap = "test" 26 | elseif id == "toTest2" then 27 | newMap = "test2" 28 | elseif id == "toTest3" then 29 | newMap = "test3" 30 | elseif id == "toTestCave" then 31 | newMap = "testCave" 32 | elseif id == "toTestCave2" then 33 | newMap = "testCave2" 34 | elseif id == "toTest4" then 35 | newMap = "test4" 36 | elseif id == "toPlayerHouse" then 37 | newMap = "playerHouse" 38 | elseif id == "toTest7" then 39 | newMap = "test7" 40 | elseif id == "toDungeon2" then 41 | newMap = "testDungeon2" 42 | elseif id == "toDungeon2-2" then 43 | newMap = "testDungeon2-2" 44 | else 45 | newMap = id 46 | end 47 | 48 | gamestate = 1 49 | player:setPosition(destX, destY) 50 | 51 | loadMap(newMap) 52 | end 53 | -------------------------------------------------------------------------------- /src/levels/wall.lua: -------------------------------------------------------------------------------- 1 | walls = {} 2 | 3 | function spawnWall(x, y, width, height, name, type, parent) 4 | 5 | -- Do not spawn the wall if the name is in data.breakables 6 | if data.breakables[name] then return end 7 | 8 | local wall = world:newRectangleCollider(x, y, width, height, {collision_class = "Wall"}) 9 | wall:setType('static') 10 | wall.dead = false 11 | wall.offY = 0 12 | wall.name = name 13 | wall.parent = parent 14 | wall.type = type 15 | 16 | if name and name:startswith('break') then 17 | wall.breakable = true 18 | 19 | -- an example of a name is 'breakRock1', where Rock tells us the sprite 20 | if name:find("Rock") then 21 | wall.sprite = sprites.environment.breakableRock 22 | function wall:onBreak() 23 | data.breakables[self.name] = true 24 | particleEvent("rockBreak", x+width/2, y+height/2) 25 | end 26 | elseif name:find("Wall") then 27 | wall.sprite = sprites.environment.breakableWall 28 | wall.offY = -8 29 | function wall:onBreak() 30 | data.breakables[self.name] = true 31 | particleEvent("rockBreak", x+width/2, y+height/2) 32 | end 33 | elseif name:find("Door") then 34 | wall.sprite = sprites.environment.lockedDoor 35 | wall.offY = -4 36 | wall.type = "lockedDoor" 37 | 38 | function wall:onBreak() 39 | data.breakables[self.name] = true 40 | shake:start(0.1, 1, 0.03) 41 | end 42 | end 43 | end 44 | 45 | if wall.type then 46 | if wall.type == 'ground' then 47 | wall:setCollisionClass('Ground') 48 | end 49 | end 50 | 51 | table.insert(walls, wall) 52 | 53 | end 54 | 55 | function walls:update(dt) 56 | local i = #walls 57 | while i > 0 do 58 | if walls[i].dead then 59 | walls[i]:onBreak() 60 | walls[i]:destroy() 61 | table.remove(walls, i) 62 | end 63 | i = i - 1 64 | end 65 | end 66 | 67 | function walls:draw() 68 | -- most walls are invisible colliders, but some have sprites 69 | for _,w in ipairs(walls) do 70 | if w.sprite then 71 | love.graphics.draw(w.sprite, w:getX(), w:getY() + w.offY, nil, nil, nil, w.sprite:getWidth()/2, w.sprite:getHeight()/2) 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /src/spells/fireball.lua: -------------------------------------------------------------------------------- 1 | fireballs = {} 2 | 3 | function spawnFire(x, y) 4 | local direction = toMouseVector(x, y) 5 | 6 | local fireball = {} 7 | fireball.x = x 8 | fireball.y = y 9 | fireball.timer = 4 10 | fireball.emberTimer = 0.1 11 | fireball.dead = false 12 | fireball.dir = direction 13 | fireball.dirVec = direction 14 | fireball.rot = math.atan2(direction.y, direction.x) 15 | fireball.rad = 3 16 | fireball.speed = 160 17 | 18 | function fireball:update(dt) 19 | self.timer = self.timer - dt 20 | if self.timer < 0 then 21 | self.dead = true 22 | end 23 | 24 | self.emberTimer = self.emberTimer - dt 25 | if self.emberTimer < 0 then 26 | local emberScale = 0.85 27 | effects:spawn("fireballSmoke", self.x, self.y, {scale = 0.8}) 28 | effects:spawn("ember", self.x, self.y, {scale = emberScale}) 29 | effects:spawn("ember", self.x, self.y, {scale = emberScale}) 30 | effects:spawn("ember", self.x, self.y, {scale = emberScale}) 31 | effects:spawn("ember", self.x, self.y, {scale = emberScale}) 32 | self.emberTimer = 0.005 33 | end 34 | 35 | --effects:spawn("arrowTrail", self.x, self.y, self.dir) 36 | 37 | self.x = self.x + (self.dirVec.x * self.speed * dt) 38 | self.y = self.y + (self.dirVec.y * self.speed * dt) 39 | 40 | -- Query for walls 41 | local walls = world:queryCircleArea(self.x, self.y, self.rad, {'Wall'}) 42 | if #walls > 0 then self.dead = true end 43 | 44 | -- Query for enemies 45 | local hitEnemies = world:queryCircleArea(self.x, self.y, self.rad, {'Enemy'}) 46 | for _,e in ipairs(hitEnemies) do 47 | e.parent:hit(1, self.dirVec, 0.1) 48 | end 49 | if #hitEnemies > 0 then self.dead = true end 50 | 51 | end 52 | 53 | table.insert(fireballs, fireball) 54 | end 55 | 56 | function fireballs:update(dt) 57 | for _,b in ipairs(fireballs) do 58 | b:update(dt) 59 | end 60 | 61 | local i = #fireballs 62 | while i > 0 do 63 | if fireballs[i].dead then 64 | table.remove(fireballs, i) 65 | end 66 | i = i - 1 67 | end 68 | end 69 | 70 | function fireballs:draw(layer) 71 | for _,a in ipairs(fireballs) do 72 | if (layer == -1 and a.y < player:getY() or (layer == 1 and a.y >= player:getY())) then 73 | love.graphics.draw(sprites.effects.fireball, a.x, a.y, a.rot, 0.8, nil, sprites.effects.fireball:getWidth()/2, sprites.effects.fireball:getHeight()/2) 74 | end 75 | end 76 | end 77 | -------------------------------------------------------------------------------- /src/startup/collisionClasses.lua: -------------------------------------------------------------------------------- 1 | function createCollisionClasses() 2 | world:addCollisionClass('Ignore', {ignores = {'Ignore'}}) 3 | world:addCollisionClass('Ground', {ignores = {'Ignore'}}) 4 | world:addCollisionClass('Player', {ignores = {'Ignore'}}) 5 | world:addCollisionClass('Wall', {ignores = {'Ignore'}}) 6 | world:addCollisionClass('Transition', {ignores = {'Ignore'}}) 7 | world:addCollisionClass('Enemy', {ignores = {'Ignore', 'Player'}}) 8 | world:addCollisionClass('Projectile', {ignores = {'Ignore', 'Enemy', 'Player', 'Ground', 'Transition'}}) 9 | 10 | particleWorld:addCollisionClass('Particle', {ignores = {'Particle'}}) 11 | end -------------------------------------------------------------------------------- /src/startup/data.lua: -------------------------------------------------------------------------------- 1 | function createNewSave(fileNumber) 2 | 3 | -- This represents the save data 4 | data = {} 5 | data.saveCount = 0 -- times the game was saved 6 | data.progress = 0 -- milestone tracker 7 | data.playerX = 0 -- player's X position 8 | data.playerY = 0 -- player's Y position 9 | data.maxHealth = 4 -- maximum number of hearts 10 | data.money = 0 -- amount of currency 11 | data.keys = 0 -- number of keys 12 | data.map = "" -- currently loaded map 13 | data.outfit = 1 -- which cloak is equipped 14 | 15 | if fileNumber == nil then fileNumber = 1 end 16 | data.fileNumber = fileNumber -- which file are we using 17 | 18 | -- Currently, can equip an item to Z and X 19 | data.item = {} 20 | data.item.left = "sword" 21 | data.item.right = "bow" 22 | data.item.altL = "fire" 23 | data.item.altR = "fire" 24 | 25 | -- keep track of certain stackable items 26 | data.arrowCount = 25 27 | data.maxArrowCount = 30 28 | data.bombCount = 10 29 | data.maxBombCount = 20 30 | 31 | -- table that keeps track of breakables that have been destroyed 32 | data.breakables = {} 33 | 34 | -- table that keeps track of chests that have been opened 35 | data.chests = {} 36 | end 37 | 38 | function saveGame() 39 | data.saveCount = data.saveCount + 1 40 | data.playerX = player:getX() 41 | data.playerY = player:getY() 42 | data.map = loadedMap 43 | 44 | if data.fileNumber == 1 then 45 | love.filesystem.write("file1.lua", table.show(data, "data")) 46 | elseif data.fileNumber == 2 then 47 | love.filesystem.write("file2.lua", table.show(data, "data")) 48 | elseif data.fileNumber == 3 then 49 | love.filesystem.write("file3.lua", table.show(data, "data")) 50 | end 51 | end 52 | 53 | function loadGame(fileNumber) 54 | if fileNumber == 1 then 55 | if love.filesystem.getInfo("file1.lua") ~= nil then 56 | local data = love.filesystem.load("file1.lua") 57 | data() 58 | else 59 | startFresh(1) 60 | return "No data found for save file #1" 61 | end 62 | elseif fileNumber == 2 then 63 | if love.filesystem.getInfo("file2.lua") ~= nil then 64 | local data = love.filesystem.load("file2.lua") 65 | data() 66 | else 67 | startFresh(2) 68 | return "No data found for save file #2" 69 | end 70 | elseif fileNumber == 3 then 71 | if love.filesystem.getInfo("file3.lua") ~= nil then 72 | local data = love.filesystem.load("file3.lua") 73 | data() 74 | else 75 | startFresh(3) 76 | return "No data found for save file #3" 77 | end 78 | end 79 | 80 | --loadMap(data.map, data.playerX, data.playerY) 81 | player.direction = "down" 82 | --player.state = 0 83 | --gamestate = 1 84 | end 85 | 86 | function startFresh(fileNumber) 87 | createNewSave(fileNumber) 88 | data.map = "test" 89 | data.playerX = 276 90 | data.playerY = 164 91 | player.state = 0 92 | end 93 | -------------------------------------------------------------------------------- /src/startup/gameStart.lua: -------------------------------------------------------------------------------- 1 | function gameStart() 2 | 3 | math.randomseed(os.time()) 4 | love.graphics.setBackgroundColor(26/255, 26/255, 26/255) 5 | 6 | -- Initialize all global variables for the game 7 | initGlobals() 8 | 9 | -- Make pixels scale! 10 | love.graphics.setDefaultFilter("nearest", "nearest") 11 | 12 | -- 3 parameters: fullscreen, width, height 13 | -- width and height are ignored if fullscreen is true 14 | fullscreen = true 15 | testWindow = false 16 | vertical = false 17 | setWindowSize(fullscreen, 1920, 1080) 18 | 19 | if vertical then 20 | fullscreen = false 21 | testWindow = true 22 | setWindowSize(fullscreen, 1360, 1920) 23 | end 24 | 25 | -- The game's graphics scale up, this method finds the right ratio 26 | setScale() 27 | 28 | vector = require "libraries/hump/vector" 29 | flux = require "libraries/flux/flux" 30 | require "libraries/tesound" 31 | require("libraries/show") 32 | 33 | anim8 = require("libraries/anim8/anim8") 34 | sti = require("libraries/Simple-Tiled-Implementation/sti") 35 | 36 | local windfield = require("libraries/windfield") 37 | world = windfield.newWorld(0, 0, false) 38 | world:setQueryDebugDrawing(true) 39 | 40 | -- This second world is for particles, and has downward gravity 41 | particleWorld = windfield.newWorld(0, 250, false) 42 | particleWorld:setQueryDebugDrawing(true) 43 | 44 | require("src/startup/require") 45 | requireAll() 46 | 47 | end 48 | 49 | function setWindowSize(full, width, height) 50 | if full then 51 | fullscreen = true 52 | love.window.setFullscreen(true) 53 | windowWidth = love.graphics.getWidth() 54 | windowHeight = love.graphics.getHeight() 55 | else 56 | fullscreen = false 57 | if width == nil or height == nil then 58 | windowWidth = 1920 59 | windowHeight = 1080 60 | else 61 | windowWidth = width 62 | windowHeight = height 63 | end 64 | love.window.setMode( windowWidth, windowHeight, {resizable = not testWindow} ) 65 | end 66 | end 67 | 68 | function initGlobals() 69 | data = {} -- save data, will be loaded after game begins 70 | 71 | -- game state 72 | -- 0: main menu 73 | -- 1: gameplay 74 | gamestate = 0 75 | globalStun = 0 76 | end 77 | 78 | function setScale(input) 79 | scale = (7.3 / 1200) * windowHeight 80 | 81 | if vertical then 82 | scale = (7 / 1200) * windowHeight 83 | end 84 | 85 | if cam then 86 | cam:zoomTo(scale) 87 | end 88 | end 89 | 90 | function checkWindowSize() 91 | local width = love.graphics.getWidth() 92 | local height = love.graphics.getHeight() 93 | if width ~= windowWidth or height ~= windowHeight then 94 | reinitSize() 95 | end 96 | end 97 | 98 | function reinitSize() 99 | -- Reinitialize everything 100 | windowWidth = love.graphics.getWidth() 101 | windowHeight = love.graphics.getHeight() 102 | setScale() 103 | pause:init() 104 | initFonts() 105 | end 106 | -------------------------------------------------------------------------------- /src/startup/require.lua: -------------------------------------------------------------------------------- 1 | function requireAll() 2 | 3 | require("src/startup/collisionClasses") 4 | createCollisionClasses() 5 | 6 | -- Load assets, resources, data 7 | require("src/startup/resources") 8 | require("src/startup/data") 9 | 10 | require("src/utilities/cam") 11 | require("src/utilities/destroyAll") 12 | require("src/utilities/misc") 13 | require("src/utilities/shaders") 14 | require("src/utilities/shake") 15 | require("src/utilities/triggers") 16 | require("src/utilities/utils") 17 | 18 | require("src/player") 19 | require("src/update") 20 | require("src/draw") 21 | 22 | require("src/effects/blast") 23 | require("src/effects/effect") 24 | require("src/effects/shadows") 25 | require("src/effects/particles/particle") 26 | require("src/effects/particles/particleEvent") 27 | 28 | require("src/enemies/projectile") 29 | require("src/enemies/enemy") 30 | 31 | require("src/environment/tree") 32 | require("src/environment/water") 33 | 34 | require("src/items/item") 35 | require("src/items/loot") 36 | require("src/items/arrow") 37 | require("src/items/bomb") 38 | require("src/items/boomerang") 39 | require("src/items/grapple") 40 | require("src/items/chest") 41 | 42 | require("src/spells/fireball") 43 | require("src/spells/flame") 44 | 45 | require("src/levels/curtain") 46 | require("src/levels/loadMap") 47 | require("src/levels/npc") 48 | require("src/levels/transition") 49 | require("src/levels/wall") 50 | 51 | require("src/ui/hud") 52 | require("src/ui/menu") 53 | require("src/ui/pause") 54 | 55 | end -------------------------------------------------------------------------------- /src/ui/hud.lua: -------------------------------------------------------------------------------- 1 | function drawHUD() 2 | --drawHearts() 3 | --drawItemBox() 4 | --drawMoney() 5 | end 6 | 7 | function drawHearts() 8 | for i = 0, data.maxHealth-1 do 9 | local heartSpr = sprites.hud.emptyHeart 10 | if player.health - i == 0.5 then 11 | heartSpr = sprites.hud.halfHeart 12 | elseif player.health > i then 13 | heartSpr = sprites.hud.heart 14 | end 15 | love.graphics.draw(heartSpr, 6 + (i * 15*scale), 6, nil, scale) 16 | end 17 | end 18 | 19 | function drawMoney() 20 | local mx = love.graphics.getWidth() - 23*scale 21 | local my = love.graphics.getHeight() - 10*scale 22 | local tx = love.graphics.getWidth() - 12*scale 23 | local ty = love.graphics.getHeight() - 11*scale 24 | setWhite() 25 | love.graphics.draw(sprites.hud.coin, mx, my, nil, 1.5*scale) 26 | love.graphics.setFont(fonts.coins) 27 | love.graphics.print(data.money, tx, ty) 28 | end 29 | 30 | function drawItemBox() 31 | -- Below the hearts 32 | --local bx = 6 33 | --local by = 16*scale 34 | 35 | -- Upper-right 36 | local bx = love.graphics.getWidth() - 19*scale 37 | local by = 6 38 | 39 | love.graphics.setColor(0,0,0, 0.35) 40 | love.graphics.rectangle("fill", bx+1, by+1, 16*scale, 16*scale) 41 | setWhite() 42 | love.graphics.draw(sprites.hud.itemBox, bx, by, nil, scale) 43 | 44 | local ammoCount = -1 45 | local maxed = false 46 | if data.item.x == 2 then 47 | ammoCount = data.bombCount 48 | if data.bombCount == data.maxBombCount then 49 | maxed = true 50 | end 51 | elseif data.item.x == 3 then 52 | ammoCount = data.arrowCount 53 | if data.arrowCount == data.maxArrowCount then 54 | maxed = true 55 | end 56 | end 57 | 58 | if ammoCount > -1 then 59 | love.graphics.setColor(0,0,0, 0.35) 60 | love.graphics.rectangle("fill", bx+(3*scale), by+(20*scale), 11*scale, 7*scale) 61 | setWhite() 62 | love.graphics.draw(sprites.hud.ammoBox, bx+(2.5*scale), by+(19*scale), nil, scale) 63 | 64 | love.graphics.setFont(fonts.ammo) 65 | if maxed then love.graphics.setColor(0,1,0,1) end 66 | love.graphics.printf(ammoCount, bx+(4.5*scale), by+(20*scale), 9.5*scale, "center") 67 | --love.graphics.print(ammoCount, bx+(3*scale), by+(20*scale)) 68 | setWhite() 69 | end 70 | 71 | local spr = sprites.items.boomerang 72 | local offX = -1.5 73 | local offY = -1.5 74 | local scaleMod = 1.25 75 | if data.item.x == 1 then -- boomerang 76 | spr = sprites.items.boomerang 77 | elseif data.item.x == 2 then -- bomb 78 | spr = sprites.items.bomb 79 | offX = 2.3 80 | offY = 2.8 81 | scaleMod = 1.1 82 | elseif data.item.x == 3 then -- bow 83 | spr = sprites.items.bowIcon 84 | offX = 4.2 85 | offY = 2.3 86 | scaleMod = 0.17 87 | end 88 | love.graphics.draw(spr, bx + (offX * scale), by + (offY * scale), nil, scale * scaleMod) 89 | end 90 | -------------------------------------------------------------------------------- /src/ui/menu.lua: -------------------------------------------------------------------------------- 1 | menu = {} 2 | 3 | function menu:draw() 4 | if gamestate == 0 then 5 | love.graphics.setFont(fonts.pause1) 6 | love.graphics.setColor(1, 1, 1, 1) 7 | 8 | --love.graphics.printf("1. File #1", love.graphics.getWidth()/2 - 4000, 20 * scale, 8000, "center") 9 | --love.graphics.printf("2. File #2", love.graphics.getWidth()/2 - 4000, 30 * scale, 8000, "center") 10 | --love.graphics.printf("3. File #3", love.graphics.getWidth()/2 - 4000, 40 * scale, 8000, "center") 11 | 12 | love.graphics.printf("Press BackSpace to toggle fullscreen.", love.graphics.getWidth()/2 - 4000, 10 * scale, 8000, "center") 13 | love.graphics.printf("Press Esc to close the game.", love.graphics.getWidth()/2 - 4000, 22 * scale, 8000, "center") 14 | love.graphics.printf("Use WASD or Arrow Keys to move.", love.graphics.getWidth()/2 - 4000, 47 * scale, 8000, "center") 15 | love.graphics.printf("Press the Spacebar to roll.", love.graphics.getWidth()/2 - 4000, 59 * scale, 8000, "center") 16 | love.graphics.printf("Press Tab or E to equip items.", love.graphics.getWidth()/2 - 4000, 71 * scale, 8000, "center") 17 | love.graphics.printf("Use the mouse to aim and attack.", love.graphics.getWidth()/2 - 4000, 83 * scale, 8000, "center") 18 | love.graphics.printf("Press the Spacebar to start!", love.graphics.getWidth()/2 - 4000, 111 * scale, 8000, "center") 19 | end 20 | end 21 | 22 | function menu:select(key) 23 | if gamestate == 0 then 24 | if key ~= "space" then return end 25 | 26 | startFresh(1) 27 | 28 | if data.map and string.len(data.map) > 0 then 29 | curtain:call(data.map, data.playerX, data.playerY, "fade") 30 | end 31 | 32 | return 33 | 34 | end 35 | 36 | -- Testing destinations (be sure to remove!) 37 | --[[ 38 | if key == "1" then 39 | loadMap("test") 40 | elseif key == "2" then 41 | loadMap("test5") 42 | elseif key == "3" then 43 | loadMap("test2") 44 | elseif key == "4" then 45 | loadMap("testDungeon2", 408, 494) 46 | end 47 | ]] 48 | end 49 | -------------------------------------------------------------------------------- /src/update.lua: -------------------------------------------------------------------------------- 1 | function updateAll(dt) 2 | 3 | --if pause.active == false then 4 | updateGame(dt) 5 | --end 6 | 7 | pause:update(dt) 8 | dj.cleanup() 9 | if gameMap then gameMap:update(dt) end 10 | checkWindowSize() 11 | 12 | end 13 | 14 | function updateGame(dt) 15 | miscUpdate(dt) 16 | if globalStun > 0 then return end 17 | 18 | flux.update(dt) 19 | 20 | player:update(dt) 21 | world:update(dt) 22 | walls:update(dt) 23 | blasts:update(dt) 24 | effects:update(dt) 25 | waters:update(dt) 26 | chests:update(dt) 27 | arrows:update(dt) 28 | bombs:update(dt) 29 | boomerang:update(dt) 30 | grapple:update(dt) 31 | fireballs:update(dt) 32 | flames:update(dt) 33 | loots:update(dt) 34 | enemies:update(dt) 35 | enemies:destroyDead() 36 | projectiles:update(dt) 37 | trees:update(dt) 38 | 39 | cam:update(dt) 40 | shake:update(dt) 41 | shaders:update(dt) 42 | triggers:update(dt) 43 | particles:update(dt) 44 | particleWorld:update(dt) 45 | end 46 | -------------------------------------------------------------------------------- /src/utilities/cam.lua: -------------------------------------------------------------------------------- 1 | Camera = require "libraries/hump/camera" 2 | cam = Camera(0, 0, scale) 3 | cam.smoother = Camera.smooth.damped(8) 4 | 5 | function cam:update(dt) 6 | 7 | local camX, camY = player:getPosition() 8 | 9 | -- This section prevents the camera from viewing outside the background 10 | -- First, get width/height of the game window, divided by the game scale 11 | local w = love.graphics.getWidth() / scale 12 | local h = love.graphics.getHeight() / scale 13 | 14 | -- Get width/height of background 15 | local mapW = gameMap.width * gameMap.tilewidth 16 | local mapH = gameMap.height * gameMap.tileheight 17 | 18 | -- Left border 19 | if camX < w/2 then 20 | camX = w/2 21 | end 22 | 23 | -- Right border 24 | if camY < h/2 then 25 | camY = h/2 26 | end 27 | 28 | -- Right border 29 | if camX > (mapW - w/2) then 30 | camX = (mapW - w/2) 31 | end 32 | -- Bottom border 33 | if camY > (mapH - h/2) then 34 | camY = (mapH - h/2) 35 | end 36 | 37 | cam:lockPosition(camX, camY) 38 | 39 | -- cam.x and cam.y keep track of where the camera is located 40 | -- the lookAt value may be moved if a screenshake is happening, so these 41 | -- values know where the camera should be, regardless of lookAt 42 | cam.x, cam.y = cam:position() 43 | 44 | end 45 | -------------------------------------------------------------------------------- /src/utilities/destroyAll.lua: -------------------------------------------------------------------------------- 1 | function destroyAll() 2 | colliderTableDestroy(walls) 3 | colliderTableDestroy(transitions) 4 | 5 | removeTable(loots) 6 | removeTable(effects) 7 | removeTable(npcs) 8 | removeTable(chests) 9 | removeTable(triggers) 10 | removeTable(trees) 11 | removeTable(waters) 12 | removeTable(arrows) 13 | removeTable(bombs) 14 | 15 | -- Remove enemies 16 | for i=#enemies,1,-1 do 17 | if enemies[i].physics ~= nil then 18 | enemies[i].physics:destroy() 19 | end 20 | table.remove(enemies, i) 21 | end 22 | 23 | boomerang:reset() 24 | end 25 | 26 | -- Used for tables of colliders 27 | function colliderTableDestroy(tableList) 28 | local i = #tableList 29 | while i > 0 do 30 | if tableList[i] ~= nil then 31 | tableList[i]:destroy() 32 | end 33 | table.remove(tableList, i) 34 | i = i - 1 35 | end 36 | end 37 | 38 | -- Used for tables of standard non-collider tables 39 | function removeTable(tableList) 40 | local i = #tableList 41 | while i > 0 do 42 | table.remove(tableList, i) 43 | i = i - 1 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /src/utilities/misc.lua: -------------------------------------------------------------------------------- 1 | function miscUpdate(dt) 2 | if globalStun > 0 then 3 | globalStun = globalStun - dt 4 | end 5 | 6 | if globalStun < 0 then 7 | globalStun = 0 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /src/utilities/shaders.lua: -------------------------------------------------------------------------------- 1 | shaders = {} 2 | 3 | -- NOTE: These shaders are written using GLSL for Love2D 4 | 5 | -- Hole-punch light source 6 | shaders.simpleLight = love.graphics.newShader[[ 7 | extern number playerX = 0; 8 | extern number playerY = 0; 9 | 10 | number radius = 400; 11 | vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) { 12 | number distance = pow(pow(screen_coords.x - playerX, 2) + pow(screen_coords.y - playerY, 2), 0.5); 13 | if (distance < radius) { 14 | return vec4(0, 0, 0, 0); 15 | } 16 | else { 17 | return vec4(0, 0, 0, 1); 18 | } 19 | } 20 | ]] 21 | 22 | -- Faded light source 23 | shaders.trueLight = love.graphics.newShader[[ 24 | extern number playerX = 0; 25 | extern number playerY = 0; 26 | 27 | number radius = 900; 28 | vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) { 29 | number distance = pow(pow(screen_coords.x - playerX, 2) + pow(screen_coords.y - playerY, 2), 0.5); 30 | number alpha = distance / radius; 31 | return vec4(0, 0, 0, alpha); 32 | } 33 | ]] 34 | 35 | -- White damage flash 36 | shaders.whiteout = love.graphics.newShader[[ 37 | vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) { 38 | vec4 pixel = Texel(texture, texture_coords); 39 | if (pixel.a == 1) { 40 | return vec4(1, 1, 1, 1); 41 | } else { 42 | return vec4(0, 0, 0, 0); 43 | } 44 | } 45 | ]] 46 | 47 | function shaders:update(dt) 48 | if gameMap.dark then 49 | local px, py = player:getPosition() 50 | 51 | -- Get width/height of background 52 | local mapW = gameMap.width * gameMap.tilewidth 53 | local mapH = gameMap.height * gameMap.tileheight 54 | 55 | local lightX = (windowWidth/2) 56 | local lightY = (windowHeight/2) 57 | 58 | -- Left border 59 | if cam.x < windowWidth/2 then 60 | lightX = px * scale 61 | end 62 | 63 | -- Top border 64 | if cam.y < windowHeight/2 then 65 | lightY = py * scale 66 | end 67 | 68 | -- Right border 69 | if cam.x > (mapW - windowWidth/2) then 70 | lightX = (px - cam.x) * scale + (windowWidth/2) 71 | end 72 | 73 | -- Bottom border 74 | if cam.y > (mapH - windowHeight/2) then 75 | lightY = (py - cam.y) * scale + (windowHeight/2) 76 | end 77 | 78 | shaders.simpleLight:send("playerX", lightX) 79 | shaders.simpleLight:send("playerY", lightY) 80 | shaders.trueLight:send("playerX", lightX) 81 | shaders.trueLight:send("playerY", lightY) 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /src/utilities/shake.lua: -------------------------------------------------------------------------------- 1 | -- This file handles all things related to screenshake 2 | 3 | shake = {} 4 | 5 | shake.time = 0 -- Timer keeping track of shake duration 6 | shake.fade = true -- Whether or not the shake intensity fades out 7 | shake.fadeSpeed = 0 -- How fast the fade is 8 | shake.intensity = 0 -- Intensity of the shake (in pixels) 9 | shake.speed = 0 -- Duration between camera movements (in seconds) 10 | shake.speedTimer = 0 -- Counts down from speed in real time to change shake dir 11 | shake.dir = 1 -- Tracks if the camera will shift left or right 12 | 13 | function shake:start(t, i, s, f, f_speed) 14 | shake.time = t 15 | shake.intensity = i 16 | shake.speed = s 17 | shake.speedTimer = s 18 | shake.fade = f or true 19 | shake.fadeSpeed = f_speed or 10 20 | 21 | shake.count = 0 22 | shake.dir = 1 23 | end 24 | 25 | function shake:stop() 26 | shake.time = t 27 | shake.intensity = i 28 | shake.speed = s 29 | shake.fade = f or true 30 | shake.fadeSpeed = f_speed or 10 31 | end 32 | 33 | -- be sure to call after cam:update() 34 | function shake:update(dt) 35 | 36 | shake.time = updateTimer(shake.time, dt) 37 | 38 | if shake.time > 0 or (shake.fade and shake.intensity > 0) then 39 | 40 | -- offsets the camera based on the shake's intensity and direction 41 | cam:lookAt(cam.x + (shake.intensity * shake.dir), cam.y) 42 | 43 | if shake.speedTimer <= 0 then 44 | -- When the timer hits zero, change the direction of the camera offset 45 | shake.dir = shake.dir * -1 46 | shake.speedTimer = shake.speed 47 | else 48 | shake.speedTimer = updateTimer(shake.speedTimer, dt) 49 | end 50 | 51 | -- After shake time is up, start fading the intensity 52 | if shake.time <= 0 and shake.fade and shake.intensity > 0 then 53 | shake.intensity = shake.intensity - (dt * shake.fadeSpeed) 54 | end 55 | 56 | else 57 | cam:lookAt(cam.x, cam.y) 58 | end 59 | 60 | end 61 | -------------------------------------------------------------------------------- /src/utilities/triggers.lua: -------------------------------------------------------------------------------- 1 | triggers = {} 2 | 3 | function spawnTrigger(x, y, id) 4 | local trigger = {} 5 | trigger.x = x 6 | trigger.y = y 7 | trigger.id = id 8 | trigger.rad = 1 9 | trigger.dead = false 10 | 11 | if id == "batTrigger" then 12 | trigger.rad = 50 13 | 14 | function trigger:activate() 15 | effects:spawn("batEntrance", trigger.x, trigger.y) 16 | end 17 | end 18 | 19 | function trigger:update(dt) 20 | if distanceBetween(self.x, self.y, player:getX(), player:getY()) < self.rad and self.dead == false then 21 | self.dead = true 22 | self.activate() 23 | end 24 | end 25 | 26 | table.insert(triggers, trigger) 27 | end 28 | 29 | function triggers:update(dt) 30 | for _,t in ipairs(triggers) do 31 | t:update(dt) 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /src/utilities/utils.lua: -------------------------------------------------------------------------------- 1 | -- Returns the radian equivalent for a given direction string 2 | function getRadianRotation(direction) 3 | 4 | if direction == "right" then 5 | return 0 6 | elseif direction == "left" then 7 | return math.pi 8 | elseif direction == "up" then 9 | return (math.pi/2)*3 10 | elseif direction == "down" then 11 | return math.pi/2 12 | else 13 | return 0 14 | end 15 | 16 | end 17 | 18 | 19 | -- Returns the radian equivalent for a given direction string 20 | function getDirectionVector(direction) 21 | 22 | if direction == "right" then 23 | return vector(1, 0) 24 | elseif direction == "left" then 25 | return vector(-1, 0) 26 | elseif direction == "up" then 27 | return vector(0, -1) 28 | elseif direction == "down" then 29 | return vector(0, 1) 30 | else 31 | return vector(1, 0) 32 | end 33 | 34 | end 35 | 36 | -- Returns the rotation needed for a given direction 37 | function getRotationFromDir(direction) 38 | 39 | if direction == "right" then 40 | return 0 41 | elseif direction == "left" then 42 | return math.pi 43 | elseif direction == "up" then 44 | return math.pi/-2 45 | elseif direction == "down" then 46 | return math.pi/2 47 | else 48 | return 0 49 | end 50 | 51 | end 52 | 53 | function getRotationFromVector(vec) 54 | return math.atan2(vec.y, vec.x) 55 | end 56 | 57 | function distanceBetween(x1, y1, x2, y2) 58 | return math.sqrt( (x2 - x1)^2 + (y2 - y1)^2 ) 59 | end 60 | 61 | function getPlayerToSelfVector(x, y) 62 | return vector(x - player:getX(), y - player:getY()):normalized() 63 | end 64 | 65 | function getSelfToPlayerVector(x, y) 66 | return vector(player:getX() - x, player:getY() - y):normalized() 67 | end 68 | 69 | function getFromToVector(fromX, fromY, toX, toY) 70 | return vector(toX - fromX, toY - fromY):normalized() 71 | end 72 | 73 | function toMouseVector(px, py) 74 | local mx, my = cam:mousePosition() 75 | return vector.new(mx-px, my-py):normalized() 76 | end 77 | 78 | function setWhite() 79 | love.graphics.setColor(1, 1, 1, 1) 80 | end 81 | 82 | function midpoint(x1, y1, x2, y2) 83 | local p = {} 84 | p.x = (x1+x2)/2; 85 | p.y = (y1+y2)/2; 86 | return p; 87 | end 88 | 89 | function updateTimer(v, dt) 90 | if v > 0 then 91 | v = v - dt 92 | elseif v < 0 then 93 | v = 0 94 | end 95 | return v 96 | end 97 | 98 | function getPerfectY(destY) 99 | local tileNum = math.floor(destY / 16) 100 | return (tileNum * 16) + 8.7 101 | end 102 | 103 | function secondsToTime(sec) 104 | local minutes = math.floor(sec/60) 105 | local seconds = math.floor(sec%60) 106 | if seconds < 10 then seconds = "0" .. seconds end 107 | return minutes .. ":" .. seconds 108 | end 109 | 110 | function dirToInt(dir) 111 | if dir == "up" then 112 | return -1 113 | elseif dir == "down" then 114 | return 1 115 | elseif dir == "right" then 116 | return 1 117 | elseif dir == "left" then 118 | return -1 119 | else 120 | return dir 121 | end 122 | end 123 | 124 | -- 'startswith' courtesy of StackOverflow 125 | -- https://stackoverflow.com/questions/22831701/lua-read-beginning-of-a-string 126 | string.startswith = function(self, str) 127 | return self:find('^' .. str) ~= nil 128 | end 129 | --------------------------------------------------------------------------------