adds options for random and custom mychars

This commit is contained in:
duncathan 2021-07-26 21:03:50 -06:00
parent bbfa4e5661
commit d76b811fda
6 changed files with 39 additions and 4 deletions

BIN
src/assets/icon/Custom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
src/assets/icon/Random.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View file

@ -349,8 +349,12 @@ end
function C:_copyMyChar()
local path = self:_getWritePath() .. '/MyChar.bmp'
if self.mychar then
local data = lf.read(self.mychar)
U.writeFile(path, data)
else
U.eraseFile(path)
end
end
function C:_generateHash()

View file

@ -112,6 +112,21 @@ function C:loadMyChar(mychar)
mc.value = "override"
end
function C.numToMyChar(num)
local mychars = {
"assets/myChar/Quote.bmp",
"assets/myChar/Curly.bmp",
"assets/myChar/Sue.bmp",
"assets/myChar/Toroko.bmp",
"assets/myChar/King.bmp",
"assets/myChar/Chaco.bmp",
"assets/myChar/Kanpachi.bmp",
"assets/myChar/Misery.bmp",
"assets/myChar/Frog.bmp",
}
return mychars[num]
end
function C:loadSpawn(spawn)
if spawn == "Start Point" or spawn == 0 then
settings.spawn.index = 1
@ -196,7 +211,11 @@ layout.go:onPress(function()
Randomizer.obj = settings.objective.value
Randomizer.puppy = settings.puppy.value
if music.mychar.value == "random" then
Randomizer.mychar = Screen.numToMyChar(love.math.random(9))
else
Randomizer.mychar = music.mychar.value
end
Randomizer.worldGraph.spawn = settings.spawn.value
Randomizer.worldGraph.seqbreak = settings.seqbreak.value

View file

@ -50,7 +50,9 @@ return { style = 'dialog',
{ text = " Chaco", value = "assets/myChar/Chaco.bmp", icon = "assets/icon/Chaco.png" },
{ text = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" },
{ text = " Misery", value = "assets/myChar/Misery.bmp", icon = "assets/icon/Misery.png" },
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" }
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" },
{ text = " Random", value = "random", icon = "assets/icon/Random.png", status = "Choose a random sprite each time you randomize." },
{ text = " Custom", value = false, icon = "assets/icon/Custom.png", status = "Use your own mychar.bmp! Place it in the main data folder." },
},
{ type = 'sash' },
{ type = 'status', wrap = true, height = false, },

View file

@ -15,4 +15,14 @@ function U.writeFile(path, data)
file:close()
end
function U.eraseFile(path)
logDebug('erasing file: ' .. path)
local file, err = io.open(path, 'r')
if file ~= nil then
io.close(file)
os.remove(path)
end
end
return U