musicplayer

This commit is contained in:
PossiblyAxolotl 2022-06-28 17:30:32 -06:00
parent 28fffa834e
commit e51fd4d1c4
9 changed files with 87 additions and 171 deletions

View file

@ -332,9 +332,15 @@ function editUpdate()
if editor == "main" and math.floor( tileIndex ) == 2 then
playdate.graphics.setLineWidth(2)
gfx.drawLine(b.start.x+8,b.start.y+8,b.ends.x+8,b.ends.y+8)
gfx.drawText(b.speed,b.start.x+8 - (gfx.getTextSize(b.speed)/2),b.start.y)
end
end
for saw = 1, #spins, 1 do
local spin = spins[saw]
imgSaw[2]:draw(spin.x,spin.y)
end
for power = 1, #powers, 1 do
imgSquare:draw(powers[power].x,powers[power].y)
end

View file

@ -58,11 +58,18 @@ menuButton, error = menu:addMenuItem("game menu", function()
removeMap()
killBlades()
end
if mode ~= "music" then
totalEnergy = 0
showEnergy = false
energy = 0
mainMenuCreation()
createMenu(mainmenu)
else
song:stop()
paused = false
playbackRate = 1.0
createMenu(songlist)
end
end)
playdate.ui.crankIndicator:start()

View file

@ -201,6 +201,10 @@ function menuButtonPress(name, index)
mode = "game"
elseif name == "EXTRAS" then
if menu == "musicbox" then
song:load("sfx/song1")
song:play(0)
end
local m = {}
--barpos = 160
--logopos = -112
@ -263,6 +267,7 @@ function menuButtonPress(name, index)
logopos = -112
barpos = 160
mode = "music"
songTitle = songlist[index]
song:stop()
song:load("sfx/song"..index - 1)
song:play(0)

View file

@ -1,23 +1,80 @@
local paused = false
local playbackRate = 1.0
paused = false
playbackRate = 1.0
local timeRate = true
songTitle = "AAA"
local imgDither = playdate.graphics.image.new("gfx/dither")
local imgCover = playdate.graphics.image.new("gfx/cover1bit")
assert(imgDither)
assert(imgCover)
function updateBox()
playdate.graphics.clear()
local change, aChange = playdate.getCrankChange()
if paused then
if change<0 then change = 0 end
song:setRate(change*0.03)
if not playdate.isCrankDocked() then
playdate.graphics.drawText(math.floor((change*0.03)*100).."%", 200 - playdate.graphics.getTextSize(math.floor((change*0.03)*100).."%")/ 2,210)
end
else
playbackRate += change*0.001
if playbackRate < 0.2 then playbackRate = 0.2 end
playbackRate += change*0.0005
if playbackRate < 0.2 then playbackRate = 0.2 elseif playbackRate > 3 then playbackRate = 3 end
if not playdate.isCrankDocked() or math.floor(playbackRate*100) ~= 100 then
playdate.graphics.drawText(math.floor(playbackRate * 100).."%", 200 - playdate.graphics.getTextSize(math.floor(playbackRate * 100).."%")/ 2,210)
end
song:setRate(playbackRate)
end
if playdate.buttonJustPressed(playdate.kButtonA) then
if paused == true then paused = false else paused = true end
if paused == true then
paused = false
else
paused = true
end
playbackRate = 1.0
end
if playdate.buttonJustPressed(playdate.kButtonB) or playdate.buttonJustPressed(playdate.kButtonLeft) then
if paused then playdate.graphics.setPattern(imgDither) end
playdate.graphics.setLineWidth(10)
playdate.graphics.drawLine(0,235,(song:getOffset()/song:getLength())*400,235)
playdate.graphics.setColor(playdate.graphics.kColorWhite)
playdate.graphics.setLineWidth(2)
playdate.graphics.drawLine(0,19,400,19)
local time = playdate.getTime()
if timeRate == true then
local prefix = ""
if time.hour > 12 then prefix = " PM" end
playdate.graphics.drawText((time.hour % 12)..":"..time.minute..prefix,0,0)
else
playdate.graphics.drawText(time.hour..":"..time.minute,0,0)
end
playdate.graphics.drawText(math.ceil(playdate.getBatteryPercentage()).."%",400-playdate.graphics.getTextSize(math.ceil(playdate.getBatteryPercentage()).."%"),0)
imgCover:draw(200-67,30)
playdate.graphics.drawText(songTitle, 200 - playdate.graphics.getTextSize(songTitle)/2,180)
if math.floor(song:getOffset()) < math.floor(song:getLength()) then playdate.graphics.drawText(math.floor(song:getOffset()*100)/100,1,210) else playdate.graphics.drawText(math.floor(song:getLength()),1,210) end
playdate.graphics.drawText(math.floor(song:getLength()).."S",370,210)
if playdate.buttonJustPressed(playdate.kButtonUp) then
if timeRate == true then timeRate = false else timeRate = true end
end
if playdate.buttonJustPressed(playdate.kButtonLeft) then
song:setOffset(0)
end
if playdate.buttonJustPressed(playdate.kButtonB) then
paused = false
playbackRate = 1.0
createMenu(songlist)
song:stop()
end

BIN
Source/gfx/cover1bit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
Source/gfx/dither.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

View file

@ -1,79 +0,0 @@
--metrics={"baseline":13,"xHeight":1,"capHeight":1,"pairs":{},"left":[],"right":[]}
datalen=2208
data=iVBORw0KGgoAAAANSUhEUgAAAD8AAABICAYAAABBeC2mAAAGPUlEQVR4Xs1c0ZLcMAjr/f9Htxdf7MOyBLKTnek9bdcxRiBASXb69ef372/4/BU+94/Xuvq+X4Pryma0hXbjHmY3s4luR3+WfX3x7/ff2Pj11b6eNl7r6vvh4bxP2Wzf37b+gN1pD7Gb2lyQ//pD910AF2cacrIRwE/7rj0CVPNJrTHwPTDAxOy8hiOCd3xxwN++88zfDGkHIxDHGQP8xE4RGEy6YteUiAl8d4RQPBpb6rqXDGNGRd1qnTFQlNnoTcp/3DfAB6pjBtPMR3phnxCZnyjKHHUYQ5im/JTl4oBHSrc4Ya/YrE+VpdM+gv6oZr3QfkSsoiCsN4bgn6IpmRRppgS1nQlCxzGbZukcvB3I5u7pTJ6YDeXSggJMwutHbMKC0iGDZWjTAb9kN/kiEyzqrF5GCmBcx2BnNrN9bc0VOU4AcCLYgiSbEj9e/riJZZZNgmxfX6ONi3TgCvwASpTbcPxk7T648nMSUUDvpYl2m5VR1jwwEGi8srk4KtQY1ROYbRXQ0EcY+Em/TxQNlKnATxlHEBgll77mZFhUXDzPEUej5qduw29iaMYzgFGKOlq71/UpeJC+mSwema9uGLJ6d+eupbUB/JTIn373ezeI1+Ka6BUTk9/o9iwA9FbVoP2NaZ5oxr6lbLHbMza9NeeZKGEzn5ZZaE4922qeP5nzS/9ywO+AaAG/EVTKEM+O+1Sj7TbbRAnUboyBIJaCq6I9FS6Khkg1oxkuYzHRGMtkSahtCa6dmYzXjuhDs1kyD4DKgFbdvttjo5XNfdUoJaCbQs4kQDCZCKoyndkaawr8BTxbQ0zUGZ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+5,3 @@ bundleID=com.PossiblyAxolotl.RocketBytes
version=DEV
buildNumber=1
imagePath=launcher
contentWarning=This game requires extremely precise and quick movement of the crank.