diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..88b52fb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "Lua.workspace.library": [ + "${addons}/love2d/module/library" + ], + "Lua.runtime.version": "LuaJIT", + "Lua.runtime.special": { + "love.filesystem.load": "loadfile" + }, + "Lua.workspace.checkThirdParty": false +} diff --git a/make_love_file.ps1 b/make_love_file.ps1 new file mode 100644 index 0000000..9d1b460 --- /dev/null +++ b/make_love_file.ps1 @@ -0,0 +1,4 @@ +#!/usr/bin/env pwsh +Set-Location -Path $PSScriptRoot +Set-Location -Path .\pacpac +Compress-Archive -Path * -DestinationPath ..\pacpac.love -Force diff --git a/make_love_file.sh b/make_love_file.sh index d56b96c..32a6d8b 100755 --- a/make_love_file.sh +++ b/make_love_file.sh @@ -1,8 +1,4 @@ #!/bin/bash -# -# Hehe. -# - -cd "$( dirname "${BASH_SOURCE[0]}" )" -cd pacpac -zip -r ../pacpac.love * +cd "$( dirname "${BASH_SOURCE[0]}" )" || exit +cd pacpac || exit +zip -r ../pacpac.love ./* diff --git a/pacpac.love b/pacpac.love index 95da857..613f547 100644 Binary files a/pacpac.love and b/pacpac.love differ diff --git a/pacpac/main.lua b/pacpac/main.lua index b2f1fb7..d29d414 100644 --- a/pacpac/main.lua +++ b/pacpac/main.lua @@ -117,10 +117,10 @@ end -- This is a workaround for an infrequent but annoying audio bug where clips -- simply stop playing and need to be recreated as new objects. function PacSource:play() - if self.src:isPaused() or self.src:isStopped() then + if not self.src:isPlaying() then self.src:play() end - if self.src:isPaused() then + if not self.src:isPlaying() then -- Here is the workaround. Theoretically, this block should never happen. -- But it does. local is_looping = self.src:isLooping() @@ -131,13 +131,13 @@ function PacSource:play() end function PacSource:pause() - if not self.src:isPaused() and not self.src:isStopped() then + if self.src:isPlaying() then self.src:pause() end end function PacSource:setLooping(should_loop) self.src:setLooping(should_loop) end -function PacSource:isPaused() return self.src:isPaused() end +function PacSource:isPaused() return not self.src:isPlaying() end function PacSource:setVolume(volume) self.src:setVolume(volume) end function PacSource:stop() self.src:stop() end function PacSource:rewind() self.src:rewind() end @@ -788,7 +788,7 @@ function draw_controls() end function load_hi_score() - if not love.filesystem.exists('hi_score') then + if love.filesystem.getInfo('hi_score') == nil then hi_score = 1000 return end diff --git a/readme.md b/readme.md index 4ff4720..590bf7a 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ There are 3 mazes to play through. This is thrice as many as the original pac-man :) You need the [löve](http://love2d.org) game engine to play. The current code is written for löve -v0.9.2. +v11.5. The original code was written in under 24 hours as a challenge. My wife didn't believe I could make a pac-man-like game in a day. @@ -18,7 +18,7 @@ Here's a fun [first 24-hour evolution of the game in screenshots](http://tylerne ## How to install and run -1. Download and install [löve](http://love2d.org). (Current code has been tested with löve v0.9.2.) +1. Download and install [löve](http://love2d.org). (Current code has been tested with löve v11.5.) 2. Download and unzip the [zipfile of this repo](https://github.com/tylerneylon/pacpac/archive/master.zip). 3. Double-click the file `pacpac.love`. Alternatively, in OS X and Ubuntu, type `love pacpac.love` from the command line - which assumes @@ -128,4 +128,4 @@ This game uses the font 8bitoperator created by [CC-BY-SA](http://creativecommons.org/licenses/by-sa/2.0/) license. Thanks to [jonfk](https://github.com/jonfk) for upgrading the code -for löve v0.9.2. +for löve v11.5.