Updated game files

This commit is contained in:
Ryan Ward 2018-06-09 15:05:46 -04:00
parent bbb2953c21
commit 5db72114c7
88 changed files with 3502 additions and 315 deletions

View File

@ -1,5 +1,19 @@
local function HSL(h, s, l, a)
if s<=0 then return l,l,l,a end
h, s, l = h/256*6, s/255, l/255
local c = (1-math.abs(2*l-1))*s
local x = (1-math.abs(h%2-1))*c
local m,r,b,g = (l-.5*c), 0,0,0
if h < 1 then r,b,g = c,x,0
elseif h < 2 then r,b,g = x,c,0
elseif h < 3 then r,b,g = 0,c,x
elseif h < 4 then r,b,g = 0,x,c
elseif h < 5 then r,b,g = x,0,c
else r,b,g = c,0,x
end return (r+m)*255,(g+m)*255,(b+m)*255,a
end
Color={ Color={
new=function(r,g,b) new=function(r,b,g)
mt = { mt = {
__add = function (c1,c2) __add = function (c1,c2)
return Color.new(c1[1]+c2[1],c1[2]+c2[2],c1[2]+c2[2]) return Color.new(c1[1]+c2[1],c1[2]+c2[2],c1[2]+c2[2])
@ -29,7 +43,7 @@ new=function(r,g,b)
__lt = Color.LT, __lt = Color.LT,
__le = Color.LE, __le = Color.LE,
} }
local temp = {r,g,b,255} local temp = {r/255,b/255,g/255,1}
setmetatable(temp, mt) setmetatable(temp, mt)
return temp return temp
end, end,
@ -57,14 +71,13 @@ Darken=function(color,v)
currentR=color[1] currentR=color[1]
currentG=color[2] currentG=color[2]
currentB=color[3] currentB=color[3]
return Color.new(currentR * (1 - v),currentG * (1 - v),currentB * (1 - v)) return Color.new((currentR*255) * (1 - v),(currentG*255) * (1 - v),(currentB*255) * (1 - v))
end, end,
Lighten=function(color,v) Lighten=function(color,v)
currentR=color[1] currentR=color[1]
currentG=color[2] currentG=color[2]
currentB=color[3] currentB=color[3]
return Color.new(currentR*255 + (255 - (currentR*255)) * v,currentG*255 + (255 - (currentG*255)) * v,currentB*255 + (255 - (currentB*255)) * v)
return Color.new(currentR + (255 - currentR) * v,currentG + (255 - currentG) * v,currentB + (255 - currentB) * v)
end end
} }
Color.IndexColor("Black",20,20,20) Color.IndexColor("Black",20,20,20)

View File

View File

@ -177,6 +177,13 @@ function gui:newBase(tp,name, x, y, w, h, sx ,sy ,sw ,sh)
_GuiPro.self=self _GuiPro.self=self
if type(i)=="number" then if type(i)=="number" then
loadstring("_GuiPro.self:"..v)() loadstring("_GuiPro.self:"..v)()
elseif i:match"__self__" then
local ind=i:match"__self__(.+)"
if not self[ind] then self[ind]={} end
loadstring("_GuiPro.self."..ind.."=_GuiPro.self:"..v)()
elseif i:match"__child__" then
local ind,child = i:match"__child__(%S-)_(.+)"
self[ind][child]=v
else else
self[i]=v self[i]=v
end end

View File

@ -0,0 +1,40 @@
function gui:toString() -- oh boy this is gonna be painful lol
multi:newThread("saving data: ",function()
local dat=bin.stream("test.dat",false)
function GetAllChildren2(Object)
local Stuff = {}
function Seek(Items)
for i=1,#Items do
--table.insert(Stuff,Items[i])
for a,v in pairs(Items[i]) do
-- dat:tackE(a.."|"..tostring(v))
print(a.."|"..tostring(v))
-- dat.workingfile:flush()
end
thread.skip()
local NItems = Items[i]:getChildren()
if NItems ~= nil then
Seek(NItems)
end
end
end
local Objs = Object:getChildren()
for i=1,#Objs do
-- table.insert(Stuff,Objs[i])
for a,v in pairs(Objs[i]) do
-- dat:tackE(a.."|"..tostring(v))
print(Objs[i].Type..":"..a.."|"..tostring(v))
-- dat.workingfile:flush()
end
thread.skip()
local Items = Objs[i]:getChildren()
if Items ~= nil then
Seek(Items)
end
end
-- dat:tofile("test.dat")
return Stuff
end
GetAllChildren2(self)
end)
end

View File

@ -27,37 +27,37 @@ function gui:drawC()
self.hovering=true self.hovering=true
if love.mouse.isDown("l") and _GuiPro.hasDrag==false then if love.mouse.isDown("l") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.lclicked=true self.lclicked=true
elseif love.mouse.isDown("r") and _GuiPro.hasDrag==false then elseif love.mouse.isDown("r") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.rclicked=true self.rclicked=true
elseif love.mouse.isDown("m") and _GuiPro.hasDrag==false then elseif love.mouse.isDown("m") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.mclicked=true self.mclicked=true
else else
if string.find(self.Type, "Button") and _GuiPro.hasDrag==false then if string.find(self.Type, "Button") and _GuiPro.hasDrag==false then
love.graphics.setColor(self.Color[1]-5, self.Color[2]-5, self.Color[3]-5,self.Visibility*254) love.graphics.setColor(self.Color[1]-5, self.Color[2]-5, self.Color[3]-5,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.rclicked=false self.rclicked=false
self.lclicked=false self.lclicked=false
self.mclicked=false self.mclicked=false
end end
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
self.hovering=false self.hovering=false
self.rclicked=false self.rclicked=false
self.lclicked=false self.lclicked=false
@ -71,7 +71,7 @@ function gui:drawC()
love.graphics.setStencilTest("notequal",0) love.graphics.setStencilTest("notequal",0)
end end
love.graphics.circle("fill",x,y,r,s) love.graphics.circle("fill",x,y,r,s)
love.graphics.setColor(self.BorderColor[1], self.BorderColor[2], self.BorderColor[3],self.Visibility*254) love.graphics.setColor(self.BorderColor[1], self.BorderColor[2], self.BorderColor[3],self.Visibility)
for b=0,self.BorderSize-1 do for b=0,self.BorderSize-1 do
love.graphics.circle("line",x,y,r+b,s) love.graphics.circle("line",x,y,r+b,s)
end end
@ -80,7 +80,7 @@ function gui:drawC()
if self.AutoScaleText then if self.AutoScaleText then
self.FontSize=math.floor(self.height/1.45833) self.FontSize=math.floor(self.height/1.45833)
end end
love.graphics.setColor(self.TextColor[1],self.TextColor[2],self.TextColor[3],self.TextVisibility*254) love.graphics.setColor(self.TextColor[1],self.TextColor[2],self.TextColor[3],self.TextVisibility)
love.graphics.setFont(self.Font) love.graphics.setFont(self.Font)
love.graphics.printf(self.text, x-(r/2)+(self.XTween), y-(r/2)+self.Tween, r, self.TextFormat) love.graphics.printf(self.text, x-(r/2)+(self.XTween), y-(r/2)+self.Tween, r, self.TextFormat)
end end

View File

@ -27,37 +27,37 @@ function gui:drawR()
self.hovering=true self.hovering=true
if love.mouse.isDown("l") or self:touchable("r") and _GuiPro.hasDrag==false then if love.mouse.isDown("l") or self:touchable("r") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.lclicked=true self.lclicked=true
elseif love.mouse.isDown("r") or self:touchable("r") and _GuiPro.hasDrag==false then elseif love.mouse.isDown("r") or self:touchable("r") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.rclicked=true self.rclicked=true
elseif love.mouse.isDown("m") or self:touchable("r") and _GuiPro.hasDrag==false then elseif love.mouse.isDown("m") or self:touchable("r") and _GuiPro.hasDrag==false then
if string.find(self.Type, "Button") then if string.find(self.Type, "Button") then
love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility*254) love.graphics.setColor(self.Color[1]-10, self.Color[2]-10, self.Color[3]-10,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.mclicked=true self.mclicked=true
else else
if string.find(self.Type, "Button") or self:touchable("r") and _GuiPro.hasDrag==false then if string.find(self.Type, "Button") or self:touchable("r") and _GuiPro.hasDrag==false then
love.graphics.setColor(self.Color[1]-5, self.Color[2]-5, self.Color[3]-5,self.Visibility*254) love.graphics.setColor(self.Color[1]-5, self.Color[2]-5, self.Color[3]-5,self.Visibility)
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
end end
self.rclicked=false self.rclicked=false
self.lclicked=false self.lclicked=false
self.mclicked=false self.mclicked=false
end end
else else
love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility*254) love.graphics.setColor(self.Color[1],self.Color[2],self.Color[3],self.Visibility)
self.hovering=false self.hovering=false
self.rclicked=false self.rclicked=false
self.lclicked=false self.lclicked=false
@ -71,6 +71,7 @@ function gui:drawR()
love.graphics.stencil(self.stfunc, "replace", 1) love.graphics.stencil(self.stfunc, "replace", 1)
love.graphics.setStencilTest("greater", 0) love.graphics.setStencilTest("greater", 0)
end end
love.graphics.rectangle("fill", self.x, self.y, self.width, self.height,(self.rx or 1)*self.DPI,(self.ry or 1)*self.DPI,(self.segments or 1)*self.DPI) love.graphics.rectangle("fill", self.x, self.y, self.width, self.height,(self.rx or 1)*self.DPI,(self.ry or 1)*self.DPI,(self.segments or 1)*self.DPI)
if string.find(self.Type, "Image") then if string.find(self.Type, "Image") then
self:ImageRule() self:ImageRule()
@ -81,7 +82,7 @@ function gui:drawR()
if self:hasRoundness() then if self:hasRoundness() then
love.graphics.setStencilTest() love.graphics.setStencilTest()
end end
love.graphics.setColor(self.BorderColor[1], self.BorderColor[2], self.BorderColor[3],self.Visibility*254) love.graphics.setColor(self.BorderColor[1], self.BorderColor[2], self.BorderColor[3],self.Visibility)
for b=0,self.BorderSize-1 do for b=0,self.BorderSize-1 do
love.graphics.rectangle("line", self.x-(b/2), self.y-(b/2), self.width+b, self.height+b,(self.rx or 1)*self.DPI,(self.ry or 1)*self.DPI,(self.segments or 1)*self.DPI) love.graphics.rectangle("line", self.x-(b/2), self.y-(b/2), self.width+b, self.height+b,(self.rx or 1)*self.DPI,(self.ry or 1)*self.DPI,(self.segments or 1)*self.DPI)
end end
@ -90,10 +91,16 @@ function gui:drawR()
if self.AutoScaleText then if self.AutoScaleText then
self.FontSize=math.floor(self.height/1.45833) self.FontSize=math.floor(self.height/1.45833)
end end
love.graphics.setColor(self.TextColor[1],self.TextColor[2],self.TextColor[3],self.TextVisibility*254) love.graphics.setColor(self.TextColor[1],self.TextColor[2],self.TextColor[3],self.TextVisibility)
if self.Font==_defaultfont then if self.Font==_defaultfont then
love.graphics.setFont(self.Font) love.graphics.setFont(self.Font)
love.graphics.printf(self.text, self.x+2+(self.XTween*self.DPI)+((self.marginL or 0)*self.DPI or self.XTween*self.DPI), self.y+(self.FontHeight/2)+self.Tween*self.DPI, self.width+(0 or (self.marginR or 0)*self.DPI), self.TextFormat) love.graphics.printf(
self.text,
(self.x+2+(self.marginL or 0) or self.XTween)*self.DPI,
(self.y+math.floor((self.FontHeight-self.FontSize)/2)+self.Tween)*self.DPI,
(self.width+(0 or (self.marginR or 0)))*self.DPI,
self.TextFormat,
self.TextRotation)
else else
if type(self.Font)=="string" then if type(self.Font)=="string" then
self.Font=love.graphics.newFont(self.Font,self.FontSize) self.Font=love.graphics.newFont(self.Font,self.FontSize)
@ -105,7 +112,13 @@ function gui:drawR()
self.FontSize=tonumber(self.FontSize) self.FontSize=tonumber(self.FontSize)
love.graphics.setNewFont(self.FontSize) love.graphics.setNewFont(self.FontSize)
end end
love.graphics.printf(self.text, self.x+2+((self.marginL or 0)*self.DPI or self.XTween*self.DPI), self.y+math.floor((self.FontHeight-self.FontSize)/2)+self.Tween*self.DPI, self.width+(0 or (self.marginR or 0)*self.DPI), self.TextFormat) love.graphics.printf(
self.text,
(self.x+2+(self.marginL or 0) or self.XTween)*self.DPI,
(self.y+math.floor((self.FontHeight-self.FontSize)/2)+self.Tween)*self.DPI,
(self.width+(0 or (self.marginR or 0)))*self.DPI,
self.TextFormat,
self.TextRotation)
end end
end end
end end

View File

@ -1,10 +1,10 @@
function gui:SetImage(i) function gui:SetImage(i)
if type(i)=="string" then if type(i)=="string" or tostring(i):find("ImageData") then
self.Image=love.graphics.newImage(i) self.Image=love.graphics.newImage(i)
else else
self.Image=i self.Image=i
end end
if self.Image~=nil then if self.Image then
self.ImageHeigth=self.Image:getHeight() self.ImageHeigth=self.Image:getHeight()
self.ImageWidth=self.Image:getWidth() self.ImageWidth=self.Image:getWidth()
self.Quad=love.graphics.newQuad(0,0,self.width,self.height,self.ImageWidth,self.ImageHeigth) self.Quad=love.graphics.newQuad(0,0,self.width,self.height,self.ImageWidth,self.ImageHeigth)

View File

@ -1,7 +1,7 @@
function gui:newImageButton(i,name, x, y, w, h, sx ,sy ,sw ,sh) function gui:newImageButton(i,name, x, y, w, h, sx ,sy ,sw ,sh)
x,y,w,h,sx,sy,sw,sh=filter(name, x, y, w, h, sx ,sy ,sw ,sh) x,y,w,h,sx,sy,sw,sh=filter(name, x, y, w, h, sx ,sy ,sw ,sh)
local c=self:newBase("ImageButton",name, x, y, w, h, sx ,sy ,sw ,sh) local c=self:newBase("ImageButton",name, x, y, w, h, sx ,sy ,sw ,sh)
if type(i)=="string" then if type(i)=="string" or type(i):find("ImageData") then
c.Image=love.graphics.newImage(i) c.Image=love.graphics.newImage(i)
else else
c.Image=i c.Image=i

View File

@ -1,7 +1,7 @@
function gui:newImageLabel(i,name, x, y, w, h, sx ,sy ,sw ,sh) function gui:newImageLabel(i,name, x, y, w, h, sx ,sy ,sw ,sh)
x,y,w,h,sx,sy,sw,sh=filter(name, x, y, w, h, sx ,sy ,sw ,sh) x,y,w,h,sx,sy,sw,sh=filter(name, x, y, w, h, sx ,sy ,sw ,sh)
local c=self:newBase("ImageLabel",name, x, y, w, h, sx ,sy ,sw ,sh) local c=self:newBase("ImageLabel",name, x, y, w, h, sx ,sy ,sw ,sh)
if type(i)=="string" then if type(i)=="string" or type(i):find("ImageData") then
c.Image=love.graphics.newImage(i) c.Image=love.graphics.newImage(i)
else else
c.Image=i c.Image=i
@ -9,7 +9,7 @@ function gui:newImageLabel(i,name, x, y, w, h, sx ,sy ,sw ,sh)
c.Visibility=0 c.Visibility=0
c.ImageVisibility=1 c.ImageVisibility=1
c.rotation=0 c.rotation=0
if c.Image~=nil then if c.Image then
c.ImageHeigth=c.Image:getHeight() c.ImageHeigth=c.Image:getHeight()
c.ImageWidth=c.Image:getWidth() c.ImageWidth=c.Image:getWidth()
c.Quad=love.graphics.newQuad(0,0,w,h,c.ImageWidth,c.ImageHeigth) c.Quad=love.graphics.newQuad(0,0,w,h,c.ImageWidth,c.ImageHeigth)

View File

@ -1,7 +1,7 @@
function _GuiPro.gradient(colors) function _GuiPro.gradient(colors)
local direction = colors.direction or "horizontal" local direction = colors.direction or "horizontal"
colors.direction=nil colors.direction=nil
trans = colors.trans or 255 trans = colors.trans or 1
trans=math.floor(trans) trans=math.floor(trans)
if direction == "horizontal" then if direction == "horizontal" then
direction = true direction = true
@ -10,7 +10,7 @@ function _GuiPro.gradient(colors)
else else
error("Invalid direction '" .. tostring(direction) "' for gradient. Horizontal or vertical expected.") error("Invalid direction '" .. tostring(direction) "' for gradient. Horizontal or vertical expected.")
end end
local result = love.image.newImageData(direction and 1 or #colors, direction and #colors or 1) local result = love.image.newImageData(direction and 1 or #colors, direction and #colors or 1,"rgba32f")
for __i, color in ipairs(colors) do for __i, color in ipairs(colors) do
local x, y local x, y
if direction then if direction then

View File

@ -1,4 +1,4 @@
function gui:Center() function gui:center()
local x,y=self:getFullSize() self:centerX()
self:SetDualDim(-math.floor(x/2),-math.floor(y/2),nil,nil,.5,.5) self:centerY()
end end

View File

@ -6,4 +6,5 @@ function gui:Destroy()
table.remove(self.Parent.Children,cc) table.remove(self.Parent.Children,cc)
end end
end end
self.Destroyed = true
end end

View File

@ -2,9 +2,9 @@ function gui:getFullSize()
local maxx,maxy=-math.huge,-math.huge local maxx,maxy=-math.huge,-math.huge
local temp = self:GetAllChildren() local temp = self:GetAllChildren()
for i=1,#temp do for i=1,#temp do
if temp[i].width>maxx then if temp[i].width+temp[i].offset.pos.x>maxx then
maxx=temp[i].width+temp[i].offset.pos.x maxx=temp[i].width+temp[i].offset.pos.x
elseif temp[i].height>maxy then elseif temp[i].height+temp[i].offset.pos.y>maxy then
maxy=temp[i].height+temp[i].offset.pos.y maxy=temp[i].height+temp[i].offset.pos.y
end end
end end

View File

@ -1,4 +1,4 @@
if love.filesystem.exists("CheckBoxes.png") then if love.filesystem.getInfo("CheckBoxes.png") then
_GuiPro.UC=gui:getTile("CheckBoxes.png",0,0,16,16) _GuiPro.UC=gui:getTile("CheckBoxes.png",0,0,16,16)
_GuiPro.C=gui:getTile("CheckBoxes.png",16,0,16,16) _GuiPro.C=gui:getTile("CheckBoxes.png",16,0,16,16)
_GuiPro.UCH=gui:getTile("CheckBoxes.png",0,16,16,16) _GuiPro.UCH=gui:getTile("CheckBoxes.png",0,16,16,16)

View File

@ -1,3 +1,7 @@
function gui:setNewFont(FontSize) function gui:setNewFont(FontSize,filename)
if filename then
self.Font = love.graphics.newFont(filename, tonumber(FontSize))
else
self.Font=love.graphics.setNewFont(tonumber(FontSize)) self.Font=love.graphics.setNewFont(tonumber(FontSize))
end
end end

View File

@ -59,6 +59,9 @@ function gui:newTextBox(t,name, x, y, w, h, sx ,sy ,sw ,sh)
table.insert(self.funcE,func) table.insert(self.funcE,func)
end end
c:OnClicked(function(b,self) c:OnClicked(function(b,self)
self:focus()
end)
function c:focus()
for cc=1,#self.funcF do for cc=1,#self.funcF do
self.funcF[cc](self) self.funcF[cc](self)
end end
@ -74,7 +77,7 @@ function gui:newTextBox(t,name, x, y, w, h, sx ,sy ,sw ,sh)
end end
self.Active=true self.Active=true
end end
end) end
c:OnClicked(function(b,self,x,y) c:OnClicked(function(b,self,x,y)
local dwidth, wrappedtext = _defaultfont:getWrap(self.text:sub(1,self.cursor[1]), self.width) local dwidth, wrappedtext = _defaultfont:getWrap(self.text:sub(1,self.cursor[1]), self.width)
local height = _defaultfont:getHeight() local height = _defaultfont:getHeight()
@ -144,7 +147,7 @@ function gui:newTextBox(t,name, x, y, w, h, sx ,sy ,sw ,sh)
self.ttext=self.ttext.."\n" self.ttext=self.ttext.."\n"
self.cooldown2=true self.cooldown2=true
c.Alarm2:Reset() c.Alarm2:Reset()
elseif (love.keyboard.isDown("return") or love.keyboard.isDown("enter") or love.keyboard.isDown("kpenter")) and self.Active and self.Enter and not(love.keyboard.isDown("lshift") or love.keyboard.isDown("rshift")) then elseif (love.keyboard.isDown("return") or love.keyboard.isDown("kpenter")) and self.Active and self.Enter and not(love.keyboard.isDown("lshift") or love.keyboard.isDown("rshift")) then
if self.LoseFocusOnEnter then if self.LoseFocusOnEnter then
self.Active=false self.Active=false
else else

View File

@ -0,0 +1,5 @@
function gui:widthToTextSize(n)
if self.Font then
self:setDualDim(nil,nil,self.Font:getWidth(self.text)+(n or 4),nil,nil,nil,0)
end
end

View File

@ -1,5 +1,4 @@
utf8 = require("utf8") utf8 = require("utf8")
_defaultfont = love.graphics.getFont()
gui = {} gui = {}
gui.__index = gui gui.__index = gui
gui.TB={} gui.TB={}
@ -7,11 +6,12 @@ gui.Version="VERSION" -- Is it really ready for release?
_GuiPro={GBoost=true,hasDrag=false,DragItem={},Children={},Visible=true,count=0,x=0,y=0,height=0,width=0,update=function(self) local things=GetAllChildren2(self) UpdateThings(things) end,draw=function(self) local things=GetAllChildren(self) DrawThings(things) end,getChildren=function(self) return self.Children end} _GuiPro={GBoost=true,hasDrag=false,DragItem={},Children={},Visible=true,count=0,x=0,y=0,height=0,width=0,update=function(self) local things=GetAllChildren2(self) UpdateThings(things) end,draw=function(self) local things=GetAllChildren(self) DrawThings(things) end,getChildren=function(self) return self.Children end}
_GuiPro.Clips={} _GuiPro.Clips={}
_GuiPro.rotate=0 _GuiPro.rotate=0
_defaultfont = love.graphics.setNewFont(12)
setmetatable(_GuiPro, gui) setmetatable(_GuiPro, gui)
function gui:LoadInterface(file) function gui:LoadInterface(file)
local add=".int" local add=".int"
if string.find(file,".",1,true) then add="" end if string.find(file,".",1,true) then add="" end
if love.filesystem.exists(file..add) then if love.filesystem.getInfo(file..add) then
a,b=pcall(love.filesystem.load(file..add)) a,b=pcall(love.filesystem.load(file..add))
if a then if a then
--print("Loaded: "..file) --print("Loaded: "..file)
@ -43,7 +43,6 @@ gui.LoadAll("GuiManager/Text")
gui.LoadAll("GuiManager/Drawing") gui.LoadAll("GuiManager/Drawing")
multi.boost=2 multi.boost=2
-- End of Load -- End of Load
gui:respectHierarchy() gui:respectHierarchy()
_GuiPro.width,_GuiPro.height=love.graphics.getDimensions() _GuiPro.width,_GuiPro.height=love.graphics.getDimensions()

View File

@ -1,11 +1,12 @@
audio = {} audio = {}
audio.__index = audio audio.__index = audio
function audio:new(f,t) function audio:new(f,t)
t=t or "stream"
local obj={} local obj={}
setmetatable(obj, audio) setmetatable(obj, audio)
obj.source=love.audio.newSource(f,t) obj.source=love.audio.newSource(f,t)
obj.f=f obj.f=f
obj.t=t or "stream" obj.t=t
obj.endEvent=multi:newLoop() obj.endEvent=multi:newLoop()
obj.endEvent.Pare=obj obj.endEvent.Pare=obj
obj.wasPlaying=false obj.wasPlaying=false
@ -13,7 +14,7 @@ function audio:new(f,t)
obj.func2={} obj.func2={}
obj.func3={} obj.func3={}
obj.func4={} obj.func4={}
obj.endEvent:OnLoop(function(time,loop) obj.endEvent:OnLoop(function(loop,time)
if not(loop.Pare:isPlaying()) and loop.Pare.wasPlaying==true and not(loop.Pare:isPaused()) then if not(loop.Pare:isPlaying()) and loop.Pare.wasPlaying==true and not(loop.Pare:isPaused()) then
for i=1,#loop.Pare.func do for i=1,#loop.Pare.func do
loop.Pare:stop() loop.Pare:stop()
@ -59,7 +60,7 @@ function audio:pause()
self.source:pause() self.source:pause()
end end
function audio:resume() function audio:resume()
self.source:resume() self.source:play()
end end
function audio:rewind() function audio:rewind()
self.source:rewind() self.source:rewind()
@ -105,7 +106,7 @@ function audio:isPlaying()
return self.source:isPlaying() return self.source:isPlaying()
end end
function audio:isPaused() function audio:isPaused()
return self.source:isPaused() return not self.source:isPlaying()
end end
function audio:isStopped() function audio:isStopped()
return self.source:isStopped() return self.source:isStopped()

591
game/_main.lua Normal file
View File

@ -0,0 +1,591 @@
--package.path="/?/init.lua;"..package.path
require("Libs/Library")
--~ require("Libs/Utils")
require("bin")
--~ require("multi.compat.love2d") -- for use with the love2d engine
GLOBAL,sThread=require("multi.integration.loveManager").init()
require("parseManager")
require("GuiManager")
require("Libs/AudioManager")
gui.LoadAll("Interface")
jQueue=multi:newSystemThreadedJobQueue(4)
jQueue:registerJob("LoadImage",function(path)
local dat = love.image.newImageData(path)
return dat
end)
jQueue:start()
function form(link,x,y,w,h,sx,sy,sw,sh)
local x,y,w,h,sx,sy,sw,sh=(link:varExists(x) or tonumber(x)),(link:varExists(y) or tonumber(y)),(link:varExists(w) or tonumber(w)),(link:varExists(h) or tonumber(h)),(link:varExists(sx) or tonumber(sx)),(link:varExists(sy) or tonumber(sy)),(link:varExists(sw) or tonumber(sw)),(link:varExists(sh) or tonumber(sh))
return x,y,w,h,sx,sy,sw,sh
end
math.randomseed(os.time())
actornum=0
animnum=0
rand=randomGen:new(0)
class_BG=audio:new("audio/Class.wav")
aqua_BG=audio:new("audio/Aqua.mp3")
park_BG=audio:new("audio/Park.mp3")
school_BG=audio:new("audio/School.mp3")
store_BG=audio:new("audio/Store.mp3")
house_BG=audio:new("audio/House.mp3")
credits_BG=audio:new("audio/Game Credits.mp3")
class_BG:setLooping(true)
aqua_BG:setLooping(true)
park_BG:setLooping(true)
school_BG:setLooping(true)
store_BG:setLooping(true)
house_BG:setLooping(true)
credits_BG:setLooping(true)
parseManager:define{
getInput=function(self,msg)
inputBox.message.text=msg
inputBox.Visible=true
inputBox.input:focus()
go.Visible=false
thread.hold(function() return _inputvar~=nil end)
local i=_inputvar
_inputvar=nil
inputBox.Visible=false
go.Visible=true
return i
end,
BGStop=function()
class_BG:stop()
aqua_BG:stop()
park_BG:stop()
school_BG:stop()
store_BG:stop()
house_BG:stop()
credits_BG:stop()
end,
ClassBG=function(b)
if b then
class_BG:play()
else
class_BG:stop()
end
end,
AquaBG=function(b)
if b then
aqua_BG:play()
else
aqua_BG:stop()
end
end,
ParkBG=function(b)
if b then
park_BG:play()
else
park_BG:stop()
end
end,
SchoolBG=function(b)
if b then
school_BG:play()
else
school_BG:stop()
end
end,
StoreBG=function(b)
if b then
store_BG:play()
else
store_BG:stop()
end
end,
HouseBG=function(b)
if b then
house_BG:play()
else
house_BG:stop()
end
end,
CreditsBG=function(b)
if b then
credits_BG:play()
else
credits_BG:stop()
end
end,
loadAudio=function(self,path)
return love.audio.newSource(path)
end,
loadSong=function(self,path)
return love.audio.newSource(path)
end,
playSongLooped=function(self,item)
item:setLooping(true)
item:play()
end,
playAudio=function(self,item,n)
item:play()
if n then
multi:newAlarm(n):OnRing(function()
item:stop()
end)
end
end,
getPeriod=function()
return "."
end,
playSong=function(self,item,n)
item:play()
if n then
multi:newAlarm(n):OnRing(function()
item:stop()
end)
end
end,
sleep=function(self,n)
local num=n
self.handle:hold(num)
end,
fadeSong=function(self,item)
self.handle:Pause()
local handle=self:varExists(item)
local step=multi:newTStep(100,0,-1,.05)
step:OnStep(function(pos,self)
handle:setVolume(pos/100)
end)
while handle:getVolume()~=0 do
multi:lManager()
end
self.handle:Resume()
end,
stopAudio=function(self,item)
item:stop()
end,
stopSong=function(self,item)
if self:varExists(item)==nil then
love.audio.stop()
return
end
item:stop()
end,
pauseAudio=function(self,item)
item:pause()
end,
cls=function(self)
core.chatFrame.textHolder.text=""
end,
BG=function(self,path)
core:SetImage(path)
currentBG = path
end,
SHOW=function(self,item)
self:varExists(item).Visible=true
end,
HIDE=function(self,item)
self:varExists(item).Visible=false
end,
createObject=function(self,x,y,w,h,sx,sy,sw,sh)
actornum=actornum+1
local x,y,w,h,sx,sy,sw,sh=form(self,x,y,w,h,sx,sy,sw,sh)
local obj=workspace:newItem("",nil,"Actor "..actornum, x, y, w, h, sx ,sy ,sw ,sh)
if obj.DPI>=2 then
obj.DPI=obj.DPI-1
end
print("OBJECT: "..tostring(obj))
return obj
end,
makeObject=function(self,link,x,y,w,h,sx,sy,sw,sh)
actornum=actornum+1
local x,y,w,h,sx,sy,sw,sh=form(self,x,y,w,h,sx,sy,sw,sh)
local obj= link:newItem("",nil,"Actor "..actornum, x, y, w, h, sx ,sy ,sw ,sh)
if obj.DPI>=2 then
obj.DPI=obj.DPI-1
end
return obj
end,
createAnimation=function(self,file,delay,x,y,w,h,sx,sy,sw,sh)
local file,delay=(self:varExists(file) or file),(tonumber(self:varExists(delay)) or tonumber(delay))
animnum=animnum+1
local x,y,w,h,sx,sy,sw,sh=form(self,x,y,w,h,sx,sy,sw,sh)
local anim = workspace:newAnim(file,delay, x, y, w, h, sx ,sy ,sw ,sh)
anim:OnAnimEnd(function(link)
link:Reset()
link:Resume()
end)
if anim.DPI>=2 then
anim.DPI=anim.DPI-1
end
return anim
end,
stopAnimation=function(self,item)
item:Pause()
end,
resumeAnimation=function(self,item)
item:Resume()
end,
resetAnimation=function(self,item)
item:Reset()
end,
setImage=function(self,item,path)
smartPrint(item)
item:SetImage(path)
end,
setText=function(self,item,text)
if type(item)=="string" then
print(actor)
self:pushError("item must be a gui object!")
end
item.text=text
end,
JUMPPLAY=function(self,to,handle)
self.methods.playSong(self,handle)
self.methods.JUMP(self,to)
end,
setPosition=function(self,item,x,y,w,h,sx,sy,sw,sh)
local x,y,w,h,sx,sy,sw,sh=form(self,x,y,w,h,sx,sy,sw,sh)
item:SetDualDim(x,y,w,h,sx,sy,sw,sh)
end,
makeDraggable=function(self,item,db)
item.Draggable=true
if db then
item.dragbut=db
end
end,
randomInt=function(self,a,b)
return math.random(a,b)
end,
listRemove=function(self,list,ind)
return table.remove(list,ind)
end,
getLength=function(self,list)
return #list
end,
centerX=function(self,item)
item:centerX()
end,
centerY=function(self,item)
item:centerY()
end,
centerXY=function(self,item)
item:centerX()
item:centerY()
end,
setVar=function(self,v,t) if t=="n" then return tonumber(v) else return v end end,
destroy=function(self,item)
item:Destroy()
end,
loadImage=function(self,path)
--
end,
getQuote=function()
return "'"
end,
newThread=function(blocklink,block)
multi:newThread(block.." [Thread]",function()
local ThreadTest=parseManager:load(blocklink.chunks[block].path)
ThreadTest.mainENV=blocklink.mainENV
ThreadTest.handle=loop
ThreadTest:define{
sleep=function(self,n)
thread.sleep(n)
end
}
local t=ThreadTest:next(block)
while true do
if t.Type=="text" then
print(t.text)
t=ThreadTest:next()
else
t=ThreadTest:next()
end
end
end)
end,
Menu = function(self,b)
core.menu.Visible=b
menu_BG:play()
menu_BG:setVolume(0)
multi:newThread("FadeIn",function()
for i=1,100 do
thread.sleep(.1)
menu_BG:setVolume(i/100)
end
end)
thread.hold(function() return core.menu.Visible==false end)
end,
GameStore = function(self,b)
core.game.Visible=b
core.game.store.Visible=b
core.chatFrame.textHolder.text=""
Progress(cho)
thread.hold(function() return core.game.store.Visible==false end)
return STORE_CORRECT
end
}
standardRef = {
[[OnEnter(function(self)
if not igmenu.Visible then
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(32,"fonts/Angeline.ttf")]],
[[setRoundness(10,10,360)]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = -38,
Color=Color.Black
}
choiceRef = {
[[OnEnter(function(self)
if not igmenu.Visible then
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(28,"fonts/zekton rg.ttf")]],
[[setRoundness(10,10,360)]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = 8,
Color=Color.Black
}
MenuRef = {
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(76,"fonts/Angeline.ttf")]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = -90,
Visibility = .85,
BorderSize = 0,
Color=Color.Black
}
bin.setBitsInterface(infinabits)
--FileSystem Setup
menuready = true
love.filesystem.setIdentity("Froggy Field Day")
love.filesystem.createDirectory("SavedData")
--gui.enableAutoWindowScaling(true)
core=gui:newImageLabel("images/classroom.jpg",0,0,0,0,0,0,1,1)--gui:newFullImageLabel("fire.jpg","BG")
top=gui:newFullFrame()
top.Visibility = 0
workspace=core:newFullFrame()
workspace.Visibility=0
core.menubutton = workspace:newTextLabel("Menu",10,10,100,50)
core.menubutton:OnEnter(function(self)
self:addDominance()
menu_sound:play()
end)
core.menubutton:OnExit(function(self)
self:removeDominance()
end)
core.menubutton:OnReleased(function(b,self)
menuready = false
top:addDominance()
igmenu.Visible = true
end)
core.game=core:newFullFrame()
core.game.Visibility=0
core.chatFrame=core:newFrame("chatFrame",20,-140,-40,120,0,1,1)
core.chatFrame:setRoundness(10,10,360)
core.chatFrame.BorderSize=4
core.chatFrame.textHolder=core.chatFrame:newTextLabel("","",5,5,-10,-10,0,0,1,1)
core.chatFrame.textHolder.Visibility=0
core.chatFrame.textHolder.text=""
core.chatFrame.textHolder.TextFormat="left"
core.chatFrame.textHolder:setNewFont(20,"fonts/zekton rg.ttf")
core.chatFrame.textHolder.namepiece = core.chatFrame.textHolder:newTextLabel("",0,-40,0,30)
core.chatFrame.textHolder.namepiece:setNewFont(20,"fonts/zekton rg.ttf")
core.chatFrame.textHolder.namepiece.Tween = 4
core.chatFrame.textHolder.namepiece:setRoundness(5,5,180)
function initGameWindow()
local childs = core.game:getChildern()
for i = 1,#childs do
childs[i]:Destroy()
end
end
test=parseManager:load("init.txt")
_dump=test:dump()
print(_dump)
bin.new(_dump):tofile("Dump.dat")
test.mainENV["gui"]=workspace
test.mainENV["menu"]=top
go=core.chatFrame.textHolder:newImageButton("images/arrow.png",-25,-25,20,20,1,1)
go:OnReleased(function(b,self)
if not igmenu.Visible then
button_pressed = true
end
end)
core:OnReleased(function(b,self)
if not igmenu.Visible and core.chatFrame.Visible and b=="l" then
button_pressed = true
elseif not igmenu.Visible and b=="r" then
core.chatFrame.Visible = not core.chatFrame.Visible
if choiceframe and not choiceframe.Destroyed then
choiceframe.Visible = core.chatFrame.Visible
end
end
end)
dialogeHandler=multi:newThreadedLoop("loop",function(self,ti)
t=test:next()
button_pressed = false
enter_pressed = false
auto_progressed = false
if t==nil then love.thread.exit() end
if t.Type=="text" then
local temptag = t.text:match("(.-): ")
if temptag then
test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.text = t.text:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
core.chatFrame.textHolder.text=""
for i in t.text:gmatch(".") do
local held = thread.hold(function() return igmenu.Visible == false end)
if held then
enter_pressed = false
button_pressed = false
auto_progressed = false
end
if Settings.Text_speed==1 then
thread.sleep(.1)
elseif Settings.Text_speed==3 then
thread.sleep(.02)
else
thread.sleep(.05)
end
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
if (button_pressed or auto_progressed) and menuready then enter_pressed = false button_pressed = false core.chatFrame.textHolder.text=t.text break end
end
if Settings.auto_progress and core.chatFrame.textHolder.Visible then
thread.sleep(1)
enter_pressed = true
end
thread.hold(function() return (enter_pressed or button_pressed or auto_progressed) and igmenu.Visible == false end)
elseif t.Type=="choice" then
go.Visible=false
choiceframe=core:newFrame("",0,0,0,0,0,0,.8)
choiceframe.Visibility = 0
core.chatFrame.textHolder.text=""
local temptag = t.prompt:match("(.-): ")
if temptag then
test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.prompt = t.prompt:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
for i in t.prompt:gmatch(".") do
thread.sleep(.05)
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
if enter_pressed or button_pressed or auto_progressed then enter_pressed = false button_pressed = false core.chatFrame.textHolder.text=t.prompt break end
end
local choice
for i=1,#t[1] do
if not choice then
choice=choiceframe:newTextLabel(t[1][i],0,0,0,50,0,0,1)
else
choice=choice:newTextLabel(t[1][i],0,10,0,50,0,1,1)
end
choice.Color = Color.Darken(Color.saddle_brown,.15)
choice.index = i
choice.Visibility = .85
choice:OnReleased(function(b,self)
if not igmenu.Visible and menuready then
choicemade=self.index
end
end)
gui.massMutate(choiceRef,choice)
end
choiceframe:centerX()
y=((#t[1]*60)-10)/2
print(y)
choiceframe:SetDualDim(nil,-(y+60),nil,nil,nil,.5)
thread.hold(function() return choicemade~=nil end)
go.Visible=true
choiceframe:Destroy()
local cm=choicemade
choicemade=nil
t=test:next(nil,cm)
end
end)
test.handle=dialogeHandler
inputBox=core.game:newFrame(0,0,500,160)
inputBox.Visibility=0
inputBox.header=inputBox:newFrame(0,0,8,28,0,0,1)
inputBox.header.Visibility=0
inputBox.header.ClipDescendants=true
inputBox.header.helper=inputBox.header:newFrame("",4,4,-8,40,0,0,1)
inputBox.header.helper.BorderSize=4
inputBox.header.helper:setRoundness(10,20,360)
inputBox.header.helper:ApplyGradient{Color.Brown,Color.Lighten(Color.Brown,.15)}
inputBox.body=inputBox:newFrame("",4,28,0,150,0,0,1)
inputBox.body.BorderSize=4
inputBox.body:ApplyGradient{Color.tan,Color.Lighten(Color.tan,.3)}
inputBox.X=inputBox.header.helper:newTextButton("X","X",-23,4,15,15,1)
inputBox.X:setRoundness(5,5,360)
inputBox.X:ApplyGradient{Color.red,Color.Lighten(Color.red,.2)}
inputBox.X.Tween=-6
inputBox.X.XTween=-2
inputBox.message=inputBox.body:newTextLabel("","Prompt",0,0,0,0,.05,.1,.9,.5)
inputBox.input2=inputBox.body:newTextLabel("","",0,0,0,30,.05,.65,.7)
inputBox.input=inputBox.body:newTextBox("","Enter Text",0,0,0,30,.05,.65,.7)
inputBox.enter=inputBox.body:newTextButton("","GO",0,0,0,30,.8,.65,.15)
inputBox.message.BorderSize=4
inputBox.input2.BorderSize=4
inputBox.enter.BorderSize=4
inputBox.message:setRoundness(5,5,360)
inputBox.input2:setRoundness(5,5,360)
inputBox.input2:ApplyGradient{Color.tan,Color.Lighten(Color.tan,.2)}
inputBox.enter:ApplyGradient{Color.Darken(Color.green,.2),Color.green}
inputBox.enter:setRoundness(5,5,360)
inputBox.enter:OnReleased(function(b,self)
_inputvar=inputBox.input.text
inputBox.Visible=false
end)
inputBox.input:OnEnter(function(self,text)
_inputvar=inputBox.input.text
inputBox.Visible=false
end)
inputBox.input.TextFormat="left"
inputBox.input.XTween=3
inputBox.input.Visibility=0
inputBox.input.ClipDescendants=true
inputBox:centerX()
inputBox:centerY()
inputBox.Visible=false
core.game=core:newFullFrame()
core.menu=core:newFullFrame()
require("minigames")
require("menu")
function love.keyreleased(key)
if key == "space" then
enter_pressed = true
end
end
gui.massMutate(standardRef,core.menubutton)
core.menu.Visible = true
function love.update(dt)
multi:uManager(dt)
end
function love.draw()
multi.dManager()
end

584
game/_menu.lua Normal file
View File

@ -0,0 +1,584 @@
-- love.graphics.captureScreenshot( filename )
-- Save data stuff
igmenu = top:newFrame(0,0,0,0,0,0,.3,.8)
igmenu.Visible = false
igmenu.Visibility = 0
igmenu:center()
igmenu.resume = igmenu:newTextLabel("Resume",0,0,0,0,0,0,1,1/5)
igmenu.save = igmenu:newTextLabel("Save",0,0,0,0,0,(1/5),1,1/5)
igmenu.load = igmenu:newTextLabel("Load",0,0,0,0,0,(2/5),1,1/5)
igmenu.setting = igmenu:newTextLabel("Settings",0,0,0,0,0,(3/5),1,1/5)
igmenu.quit = igmenu:newTextLabel("Quit",0,0,0,0,0,(4/5),1,1/5)
igmenu.resume:OnReleased(function()
igmenu.Visible = false
multi:newAlarm(.1):OnRing(function(alarm)
alarm:Destroy()
menuready = true
end)
top:removeDominance()
end)
igmenu.save:OnReleased(function()
local date = os.date("%m.%d.%y_%I.%M.%S",os.time())
love.filesystem.createDirectory("SavedData/"..date)
local state = test:extractState()
local statedat = bin.new()
state.variables["gui"]=nil
state.variables["menu"]=nil
statedat:addBlock(state)
statedat:addBlock(currentBG,128)
test.mainENV["gui"]=workspace
test.mainENV["menu"]=top
statedat:tofileS("SavedData/"..date.."/savedata.dat")
igmenu.Visible = false
multi:newThread("Saving-Thread",function()
thread.sleep(.1)
love.graphics.newScreenshot():encode("png","SavedData/"..date.."/screen.png")
print("Saving image!")
igmenu.Visible = true
end)
print("data saved")
end)
igmenu.load:OnReleased(function()
core.menu.load:setParent(core.igmenu)
core.menu.load.Visible = true
core.igmenu.Visible = true
core.igmenu:addDominance()
core.menu.load:setDualDim(0,0,0,0,0,0,1,1)
loadSaves()
multi:newEvent(function()
return core.menu.load.Visible==false
end):OnEvent(function(evnt)
core.menu.load:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1)
evnt:Destroy()
end)
end)
igmenu.setting:OnReleased(function()
core.menu.settings:setParent(core.igmenu)
core.menu.settings.Visible = true
core.igmenu.Visible = true
core.igmenu:addDominance()
core.menu.settings:setDualDim(0,0,0,0,0,0,1,1)
multi:newEvent(function()
return core.menu.settings.Visible==false
end):OnEvent(function(evnt)
core.menu.settings:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.settings:setDualDim(0,0,0,0,1/3,0,2/3,1)
evnt:Destroy()
end)
end)
igmenu.quit:OnReleased(function()
core.menu.quit.Visible = true
core.menu.quit:addDominance()
end)
gui.massMutate(MenuRef,igmenu.quit,igmenu.setting,igmenu.load,igmenu.save,igmenu.resume)
menu_sound=audio:new("audio/menu.wav")
menu_BG=audio:new("audio/Menu.mp3")
menu_BG:setLooping(true)
core.menu.Visible = false
local options = core.menu:newFrame(0,0,0,0,0,0,1/3,1)
local lowerBg = core.menu:newImageLabel("images/school.png",0,0,0,0,1/3,0,2/3,1)
local bg = core.menu:newImageLabel("images/2 KIDS1.png",0,0,0,0,1/3,0,2/3,1)
local upperBg = core.menu:newFrame(0,0,0,0,1/3,0,2/3,1)
upperBg.Color = Color.Black
local images = {"Park","aqua","gym","home","store","classroomafterhours"}
play = options:newTextLabel("Play",0,0,0,0,0,0,1,1/4)
load = options:newTextLabel("Load",0,0,0,0,0,1/4,1,1/4)
load:OnReleased(function(b,self)
core.menu.settings.Visible = false
core.menu.load.Visible = true
loadSaves()
end)
local settings = options:newTextLabel("Settings",0,0,0,0,0,2/4,1,1/4)
settings:OnReleased(function(b,self)
core.menu.load.Visible = false
core.menu.settings.Visible = true
end)
local quit = options:newTextLabel("Quit",0,0,0,0,0,3/4,1,1/4)
quit:OnReleased(function(b,self)
core.menu.quit.Visible = true
core.menu.quit:addDominance()
end)
core.menu.load = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1)
core.igmenu = gui:newFrame(0,0,0,0,0,0,1,1)
core.igmenu.Color = Color.Black
core.igmenu.Visible = false
core.menu.load.games = core.menu.load:newFrame(0,0,0,0,0,0,1,1)
core.menu.load.games.Visibility = 0
local Bbar = core.menu.load:newImageLabel("images/wood.png",0,-90,0,90,0,1,1)
local Tbar = core.menu.load:newImageLabel("images/wood.png",0,0,0,90,0,0,1)
Bbar.Color = Color.new(116,99,150)
Tbar.Color = Color.new(116,99,150)
core.menu.load.Visible = false
core.menu.load.Color=Color.new(116,99,150)
core.menu.load.dragFrame=core.menu.load:newImageLabel(nil,0,0,0,0,0,0,1,1)
core.menu.load.down = core.menu.load:newImageButton("images/DownArrow.png",0,-70,100,60,0,1)
core.menu.load.down:centerX()
core.menu.load.down.Color=Color.Darken(Color.Yellow,.15)
core.menu.load.up = core.menu.load:newImageButton("images/UpArrow.png",0,10,100,60)
core.menu.load.up.Visible = false
core.menu.load.up:centerX()
core.menu.load.up.Color=Color.Darken(Color.Yellow,.15)
core.menu.load.back = core.menu.load:newTextLabel("Back",20,-70,100,50,0,1)
core.menu.load.back:setRoundness(5,5,360)
core.menu.load.back:OnReleased(function(self)
core.menu.load.Visible = false
end)
play:OnReleased(function(b,self)
multi:newThread("FadeOut",function()
for i=100,0,-1 do
thread.sleep(.01)
menu_BG:setVolume(i/100)
end
menu_BG:stop()
core.menu.Visible = false
end)
end)
core.menu.load.down:OnReleased(function(b,self)
local c = core.menu.load.games:getChildren()
core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y-100)
core.menu.load.up.Visible = true
if c[#c].y+200<=680 then
self.Visible = false
love.mouse.setCursor(_GuiPro.CursorN)
end
end)
core.menu.load.up:OnReleased(function(b,self)
local c = core.menu.load.games:getChildren()
core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y+100)
core.menu.load.down.Visible = true
if core.menu.load.games.offset.pos.y>=0 then
core.menu.load.games:setDualDim(nil,0)
self.Visible = false
love.mouse.setCursor(_GuiPro.CursorN)
end
end)
gui.massMutate({--fonts/PWRectangular.ttf
[[setNewFont(76,"fonts/Angeline.ttf")]],
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
Tween = -17,
TextColor = Color.Lighten(Color.Yellow,.05),
DefualtColor = Color.Lighten(Color.Yellow,.05),
Color = Color.Black,
},play,settings,load,quit)
core.menu.load.back:setNewFont(36,"fonts/PWRectangular.ttf")
core.menu.load.back.Tween=-4
crossRef = {}
localMax = 0
localcount = 0
jQueue.OnJobCompleted(function(JOBID,n)
print(JOBID,n)
crossRef[JOBID].ImageHolder:SetImage(n,JOBID)
localcount=localcount+1
if localcount==localMax then
crossRef = {}
localMax = 0
localcount = 0
end
end)
function loadSaves()
local files = love.filesystem.getDirectoryItems("savedData")
core.menu.load.games.Children={}
localMax = #files
for i=#files,1,-1 do
local temp = core.menu.load.games:newFrame(0,0,300,200)
temp.ImageHolder = temp:newImageLabel(nil,0,0,0,0,0,0,1,1)
local jobid = jQueue:pushJob("LoadImage","savedData/"..files[i].."/screen.png")
crossRef[jobid]=temp
local txt = temp:newTextLabel(files[i],0,0,0,30,0,0,1)
txt.Color = Color.Black
txt.TextColor = Color.White
local data = bin.load("savedData/"..files[i].."/savedata.dat")
temp.state = data:getBlock("t")
if temp.state.variables.user then
txt.text = temp.state.variables.user..": "..txt.text
end
temp.state.pos = temp.state.pos-1
print(files[i])
temp.BG = (data:getBlock("s",128) or ""):match("(.+)\0")
temp:OnReleased(function(b,self)
menu_BG:stop()
test:injectState(self.state)
local name = self.state.name
if name == "LOBBY" then
class_BG:play()
elseif name == "HOUSE" then
house_BG:play()
elseif name == "SCHOOL" then
school_BG:play()
elseif name == "PARK" then
park_BG:play()
elseif name == "AQUARIUM" then
aqua_BG:play()
elseif name == "STORE" then
store_BG:play()
elseif name == "END" then
credits_BG:play()
end
core:SetImage(self.BG)
core.menu.Visible = false
if igmenu.Visible then
multi:newThread("StateLoading-Thread",function()
thread.sleep(.1)
igmenu.Visible = false
_inputvar = ""
multi:newAlarm(.1):OnRing(function(alarm)
alarm:Destroy()
menuready = true
end)
core.menu.load:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1)
top:removeDominance()
end)
end
end)
end
end
local loadgame = Tbar:newTextLabel("Load",20,20,100,50)
local deletegame = loadgame:newTextLabel("Delete",20,0,150,50,1)
core.menu.load.games:OnUpdate(function(self)
local c = self:getChildren()
for i=1,#c do
local x,y = InGridX(i,core.menu.load.width,200,350,240)
c[i]:setDualDim(x+75,y+100)
end
end)
lowerBg.Visibility=0
core.menu.settings = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1)
core.menu.settings.Color=Color.new(116,99,150)
core.menu.settings.Visible = false
core.menu.settings.back = core.menu.settings:newTextLabel("Back",20,-70,100,50,0,1)
core.menu.settings.back:setRoundness(5,5,360)
core.menu.settings.back:OnReleased(function(self)
core.menu.settings.Visible = false
end)
core.menu.quit = gui:newFrame(0,0,0,0,0,0,1,1)
core.menu.quit.Visible = false
core.menu.quit.Visibility = 0
local qu = core.menu.quit:newFrame(0,0,300,200)
qu:centerX()
qu:centerY()
qu:setRoundness(15,15,360)
qu.Color=Color.Black
qu.BorderColor = Color.Lighten(Color.Yellow,.05)
local msg = qu:newTextLabel("Are You Sure",20,20,-40,60,0,0,1)
local yes = qu:newTextLabel("Yes",20,-80,100,60,0,1)
local no = qu:newTextLabel("No",-120,-80,100,60,1,1)
msg.TextColor = Color.Lighten(Color.Yellow,.05),
msg:setNewFont(48,"fonts/Angeline.ttf")
msg.Visibility = 0
msg.Tween = -68
gui.massMutate({
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(32,"fonts/Angeline.ttf")]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Visibility = 0,
Tween = -25
},yes,no,core.menu.load.back,core.menu.settings.back,loadgame,deletegame)
loadgame.Visibility = 1
loadgame.Color = Color.Black
loadgame:setRoundness(5,5,360)
deletegame.Visibility = 1
deletegame.Color = Color.Black
deletegame:setRoundness(5,5,360)
core.menu.load.back.Visibility = 1
core.menu.load.back.Color = Color.Black
core.menu.settings.back.Visibility = 1
core.menu.settings.back.Color = Color.Black
yes:OnReleased(function(self)
love.event.quit()
end)
no:OnReleased(function(self)
core.menu.quit.Visible = false
core.menu.quit:removeDominance()
end)
multi:newThread("Menu-Background",function()
local count = 1
while true do
thread.hold(function() return core.menu.Visible==true and (core.menu.load.Visible==false) end) -- if the menu is active do this if not wait till it is
lowerBg:SetImage("images/"..images[count]..".png")
for i = 1,1000 do
thread.sleep(.001) -- hehe a bit of a hack
upperBg.Visibility = (1000-i)/1000
end
for i = 1000,1,-1 do
thread.sleep(.001) -- hehe a bit of a hack
upperBg.Visibility = (1000-i)/1000
end
count = count + 1
if count > #images then
count=1
end
end
end)
---------------------------------
--~ settings
evntA = multi:newEvent(function()
return core.menu.settings.Visible==true
end)
evntA:OnEvent(function()
evntB:Reset()
end)
evntB = multi:newEvent(function()
return core.menu.settings.Visible==false
end)
evntB:Pause()
evntB:OnEvent(function()
print("Saving settings!")
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
evntA:Reset()
end)
local title = core.menu.settings:newTextLabel("Settings",0,0,0,100,0,0,1)
title:setNewFont(72,"fonts/Angeline.ttf")
title.Tween = -72
title.Visibility = 0
title.TextColor = Color.Darken(Color.White,.15)
local Volume=core.menu.settings:newFrame(0,0,400,130)
local vol = Volume:newTextLabel("Volume",0,0,200,60)
local mute = Volume:newTextLabel("Mute",0,60,200,60)
local vv = vol.Font:getWidth("Volume")
local slidebar = Volume:newFrame(-200,10,200,60,1)
Volume.Visibility = 0
slidebar.Visibility=0
slidebar.display=slidebar:newTextLabel("100%",0,0,40,20)
slidebar.display:centerX()
slidebar.display.Tween=-3
slidebar.display.Visibility = 0
slidebar.display.TextColor = Color.Darken(Color.White,.15)
slidebar:setNewFont(20,"fonts/Angeline.ttf")
slidebar.left=slidebar:newFrame(0,0,10,0,0,0,0,1)
slidebar.bar=slidebar:newFrame(10,0,-20,10,0,0,1)
slidebar.bar:centerY()
slidebar.bar:OnClicked(function(b,self,x,y,xx,yy)
slidebar.move:setDualDim(x-10)
if slidebar.move.offset.pos.x<0 then
slidebar.move:setDualDim(0)
elseif slidebar.move.offset.pos.x>160 then
slidebar.move:setDualDim(160)
end
love.mouse.setY(slidebar.move.y+10)
end)
slidebar.right=slidebar:newFrame(-10,0,10,0,1,0,0,1)
slidebar.move=slidebar.bar:newFrame(80,0,20,20,0,0,0)
slidebar.move:centerY()
slidebar.move:OnUpdate(function()
slidebar.display.text=math.ceil((slidebar.move.offset.pos.x/160)*100) .."%"
Settings.Volume=math.ceil((slidebar.move.offset.pos.x/160)*100)
love.audio.setVolume(Settings.Volume/100)
end)
Volume.muter=Volume:newImageLabel("images/unchecked.png",-190,80,40,40,1)
Volume.muter:OnReleased(function(b,self)
if Settings.mute then
self:SetImage("images/unchecked.png")
Settings.mute = false
love.audio.resume()
else
self:SetImage("images/checked.png")
Settings.mute = true
love.audio.pause()
end
end)
gui.massMutate({
[[setRoundness(5,5,60)]],
Color=Color.Saddle_brown
},slidebar.move,slidebar.right,slidebar.left)
slidebar.move.Color = Color.Lighten(Color.Saddle_brown,.20)
slidebar.bar.Color=Color.Saddle_brown
local asave=Volume:newTextLabel("Autosave",0,0,200,60,0,1)
asaveC=asave:newImageLabel("images/checked.png",10,15,40,40,1)
asaveC:OnReleased(function(b,self)
if Settings.auto_save then
self:SetImage("images/unchecked.png")
Settings.auto_save = false
else
self:SetImage("images/checked.png")
Settings.auto_save = true
end
end)
local aprogress=asave:newTextLabel("Auto Progress",0,0,300,60,0,1)
aprogressC=aprogress:newImageLabel("images/unchecked.png",10,20,40,40,1)
aprogressC:OnReleased(function(b,self)
if Settings.auto_progress then
self:SetImage("images/unchecked.png")
Settings.auto_progress = false
else
self:SetImage("images/checked.png")
Settings.auto_progress = true
end
end)
local tspeed=aprogress:newTextLabel("Text Speed",0,10,200,60,0,1)
speed = tspeed:newFrame(0,0,500,60,1)
speed.Visibility = 0
S_slow = speed:newTextLabel("Slow",0,0,0,0,0,0,1/3,1)
S_Med = speed:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1)
S_Fast = speed:newTextLabel("Fast",0,0,0,0,2/3,0,1/3,1)
S_slow:OnReleased(function(b,self)
Settings.Text_speed = 1
self.Visibility = 1
S_Med.Visibility = 0
S_Fast.Visibility = 0
end)
S_Med:OnReleased(function(b,self)
Settings.Text_speed = 2
self.Visibility = 1
S_slow.Visibility = 0
S_Fast.Visibility = 0
end)
S_Fast:OnReleased(function(b,self)
Settings.Text_speed = 3
self.Visibility = 1
S_Med.Visibility = 0
S_slow.Visibility = 0
end)
local fontsize=tspeed:newTextLabel("Font Size",0,10,200,60,0,1)
fonts = fontsize:newFrame(0,0,500,60,1)
fonts.Visibility = 0
S_slow2 = fonts:newTextLabel("Small",0,0,0,0,0,0,1/3,1)
S_Med2 = fonts:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1)
S_Fast2 = fonts:newTextLabel("Large",0,0,0,0,2/3,0,1/3,1)
S_slow2:OnReleased(function(b,self)
Settings.Font_Size = 1
self.Visibility = 1
S_Med2.Visibility = 0
S_Fast2.Visibility = 0
core.chatFrame.textHolder:setNewFont(16)
end)
S_Med2:OnReleased(function(b,self)
Settings.Font_Size = 2
self.Visibility = 1
S_slow2.Visibility = 0
S_Fast2.Visibility = 0
core.chatFrame.textHolder:setNewFont(20)
end)
S_Fast2:OnReleased(function(b,self)
Settings.Font_Size = 3
self.Visibility = 1
S_Med2.Visibility = 0
S_slow2.Visibility = 0
core.chatFrame.textHolder:setNewFont(28)
end)
gui.massMutate({
TextColor = Color.Darken(Color.White,.15),
Visibility = 0,
[[setNewFont(48,"fonts/Angeline.ttf")]],
Tween = -30
},vol,mute,asave,aprogress,tspeed,fontsize)
gui.massMutate({
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
[[setRoundness(10,10,360)]],
TextColor = Color.Darken(Color.White,.15),
Visibility = 0,
Color=Color.Saddle_brown,
DefualtColor = Color.Darken(Color.White,.15),
[[setNewFont(24,"fonts/Angeline.ttf")]],
Tween = -7
},S_slow,S_Med,S_Fast,S_slow2,S_Med2,S_Fast2)
S_Med.Visibility = 1
S_Med2.Visibility = 1
loadgame.Visibility = 1
if bin.fileExists("Settings.dat") then
local set = bin.loadS("Settings.dat")
Settings={}
local function LoadSettings()
print("Loading Settings...")
Settings.Volume = set:getBlock("n",1)
Settings.mute = set:getBlock("b")
Settings.auto_save = set:getBlock("b")
Settings.auto_progress = set:getBlock("b")
Settings.Text_speed = set:getBlock("n",1)
Settings.Font_Size = set:getBlock("n",1)
if Settings.Text_speed==1 then
S_slow.Visibility = 1
S_Med.Visibility = 0
elseif Settings.Text_speed==3 then
S_Fast.Visibility = 1
S_Med.Visibility = 0
end
if Settings.Font_Size==1 then
S_slow2.Visibility = 1
S_Med2.Visibility = 0
core.chatFrame.textHolder:setNewFont(16,"fonts/zekton rg.ttf")
elseif Settings.Font_Size==3 then
S_Fast2.Visibility = 1
S_Med2.Visibility = 0
core.chatFrame.textHolder:setNewFont(28,"fonts/zekton rg.ttf")
end
if Settings.auto_progress then
aprogressC:SetImage("images/checked.png")
end
if not Settings.auto_save then
asaveC:SetImage("images/unchecked.png")
end
if Settings.mute then
Volume.muter:SetImage("images/checked.png")
end
slidebar.move:setDualDim((Settings.Volume/100)*160)
love.audio.setVolume(Settings.Volume/100)
print("Success!")
end
status, err = pcall(LoadSettings)
if not status then
Settings={}
print("Setting data is currupt! Restoring defualts!")
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
end
else --
Settings={
Volume = 50,
mute = false,
auto_save = true,
auto_progress = false,
Text_speed = 2,
Font_Size = 2
}
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
end
local x,y = Volume:getFullSize()
Volume:setDualDim(nil,-y,nil,nil,nil,.35)

BIN
game/audio/Aqua.mp3 Normal file

Binary file not shown.

BIN
game/audio/Class.wav Normal file

Binary file not shown.

BIN
game/audio/Game Credits.mp3 Normal file

Binary file not shown.

BIN
game/audio/House.mp3 Normal file

Binary file not shown.

BIN
game/audio/Menu.mp3 Normal file

Binary file not shown.

BIN
game/audio/Park.mp3 Normal file

Binary file not shown.

Binary file not shown.

BIN
game/audio/School.mp3 Normal file

Binary file not shown.

BIN
game/audio/Store.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
game/audio/hmm.mp3 Normal file

Binary file not shown.

BIN
game/audio/menu.wav Normal file

Binary file not shown.

View File

@ -685,12 +685,29 @@ if love then
return temp return temp
end end
function bin.fileExists(name) function bin.fileExists(name)
return love.filesystem.exists(name) return love.filesystem.getInfo(name)
end end
function bin:tofile(filename) function bin:tofile(filename)
if not(filename) or self.Stream then return nil end if not(filename) or self.Stream then return nil end
love.filesystem.write(filename,self.data) love.filesystem.write(filename,self.data)
end end
function bin.loadS(path,s,r)
local path = love.filesystem.getSaveDirectory( ).."\\"..path
if type(path) ~= "string" then error("Path must be a string!") end
local f = io.open(path, 'rb')
local content = f:read('*a')
f:close()
return bin.new(content)
end
function bin:tofileS(filename)
if self.stream then return end
local filename = love.filesystem.getSaveDirectory( ).."\\"..filename
print(#self.data,filename)
if not filename then error("Must include a filename to save as!") end
file = io.open(filename, "wb")
file:write(self.data)
file:close()
end
function bin.stream(file) function bin.stream(file)
return bin.newStreamFileObject(love.filesystem.newFile(file)) return bin.newStreamFileObject(love.filesystem.newFile(file))
end end

View File

@ -1,6 +1,6 @@
function love.conf(t) function love.conf(t)
t.identity = nil -- The name of the save directory (string) t.identity = nil -- The name of the save directory (string)
t.version = "0.10.1" -- The LOVE version this game was made for (string) t.version = "11.1" -- The LOVE version this game was made for (string)
t.console = true -- Attach a console (boolean, Windows only) t.console = true -- Attach a console (boolean, Windows only)
t.window.title = "game" -- The window title (string) t.window.title = "game" -- The window title (string)

BIN
game/fonts/Angeline.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
game/fonts/ashcanbb_reg.ttf Normal file

Binary file not shown.

BIN
game/fonts/digital.otf Normal file

Binary file not shown.

BIN
game/fonts/zekton rg.ttf Normal file

Binary file not shown.

View File

@ -1,12 +1,10 @@
LOAD gamedata/lobby.txt LOAD gamedata/lobby.txt
[CONFIG]{ [CONFIG]{
newThread("THREAD") // Starts a thread that handles events and stuff... Just throw this in and things flow nicely Menu(true)
SND_ELEVATOR_BG=loadAudio("audio/elevator.ogg") //newThread("THREAD") // Starts a thread that handles events and stuff... Just throw this in and things flow nicely
SND_ELEVATOR_OPEN_CLOSE=loadAudio("audio/elevator_open_close.mp3")
SND_ROPE_CRACKING=loadAudio("audio/rope_cracking.mp3")
SND_FOOTSTEPS=loadAudio("audio/footsteps.ogg")
JUMP("LOBBY") // Lets start the game Jumping to block lobby in lobby.txt JUMP("LOBBY") // Lets start the game Jumping to block lobby in lobby.txt
} }
//Internal threads can now be used to handled to manage hooks and events so there is no longer to usse this type of thread handling
[THREAD]{ [THREAD]{
::threadloop:: ::threadloop::
sleep(.001) // No need to put this in, but it is used to help show you whats going on sleep(.001) // No need to put this in, but it is used to help show you whats going on

View File

@ -2,58 +2,731 @@
//SND_ELEVATOR_OPEN_CLOSE //SND_ELEVATOR_OPEN_CLOSE
//SND_ROPE_CRACKING //SND_ROPE_CRACKING
//SND_FOOTSTEPS //SND_FOOTSTEPS
//ENABLE debugging
//Introduction of Game with Story
[LOBBY]{ [LOBBY]{
name=getInput("What is your name: ") ClassBG(true)
"Yo $name$ enjoy the game" played_gameschool = false
BG("images/elevator-lobby.jpg") eastereggSchool = false
"Abby: Oh no I'm running late!" BG("images/classroom.jpg")
"Abby: I hope I make my interview" user=getInput("Enter your name:")
playAudio(SND_ELEVATOR_OPEN_CLOSE) "Ms. Render: Well students, let's end this class day with a story"
"Abby: Great someone just walked out of the elevator" "Froggy's Adventures By John Wisely"
playSong(SND_FOOTSTEPS) "Froggy's Adventures: Once upon a time there was a small pond, deep in the woods."
"Abby: lets hope i make it" "It was filled with fresh water and shaped like a perfect circle."
"Abby: Alright, let me get it this thing" "There were lily pads, grass, and endless bugs to eat."
BG("images/elevator.jpg") "This pond was home to a small frog named Harry."
"Abby: ok 10th floor it is" "He lived in this pond for his whole life and is a very happy frog."
playAudio(SND_ELEVATOR_OPEN_CLOSE) "Everyday is the same for Harry."
playSongLooped(SND_ELEVATOR_BG) "He wakes up at 7:05 AM when the sun is high in the sky and gets ready for the day."
"Abby: Hurry up... I am going to be so late" "He eats some dragonflies that buzz around his home and takes a splash in the water."
"Abby: Wait! What was that?" "Harry leaves his pond at 8:15 to meet his friend Becky."
playAudio(SND_ROPE_CRACKING) "Becky is a woodpecker who lives on a crooked tree deep in the woods."
"That doesn't sound good" "She likes to sing every day and peck at his home."
"Harry finds Becky a little strange but he is happy to be his friend."
"As Harry meets Becky, Becky calls down and says "Hey there Harry, how are you today?""
"Harry replies "I am well, just started my day""
""Could you please eat these worms, they are filling up my holes" asks Becky"
""I would be happy to" says Harry"
"It was 11:24 and just in time for lunch."
"There were worms everywhere and Harry understood Becky's problem"
"Harry hopped from branch to branch, eating every worm in sight"
"When he was done, Becky was smiling from ear to ear and thanked Harry again"
"Harry said goodbye and left to meet his other neighbor at 1:45PM"
"His other neighbor Susan, is just as strange as Becky"
"She is a squirrel who loves to collect nuts that fall from the trees"
"Nuts are really gross to eat, bugs are much tastier"
"While hopping down the path, Harry looks around the area"
"Many twigs have broken from the trees."
"The sun has set halfway across the sky and the clouds are fluffy and white."
"Harry is glad to live in these woods because they never change and are beautiful"
"Its 3:52 and Harry finally reaches Susan, but sees she is upset"
""What is wrong Susan, why are you sad" asks Harry"
""One of my nuts fell down this well, and I can't reach it with my arms" replies Susan"
"Harry looks down the well and spots the nut, it lays on a leaf three feet down."
"After thinking about it, Harry comes up with an idea"
""What if I extend my tongue to catch the nut for you?" suggests Harry"
""That's an amazing idea!" responds Susan"
"Harry puts his head in the well and aims for the leaf."
"He misses the first time but tries again and succeeds."
"Susan jumps for joy and is very happy to have her nut back"
"Thank you so much Harry, you are the best frog in the world!"
""I am happy to help you Susan" replies Harry"
"As Susan runs away to add to her nut collection, Harry realizes how late it is."
"Its already 5:30 and he begins his journey home"
"He hops back to the pond as the sky turns dark"
"Harry dips into the pond and eats a few more flies for dinner,"
"Harry falls asleep at 9:15 with a smile on his face"
"Ms. Render: Well students that is the end of the story. Does anyone have any questions before we end school today?"<
"I have a question!" GOTO("YES")
"Say nothing" GOTO("NO")
>
::YES::
asked_question = true
"Yes $user$"
"$user$: I have a question about the frog, why does the author describe him as happy?"
"Ms. Render: Well it was how Harry was feeling throughout the book. What makes you happy $user$?"
"$user$: I am not sure, the days are just passing time. What is there to be happy or sad about?"
"Ms. Render: That can be the question you research for the essay that is due next week. Why are people happy or sad? You can go to different shops around town and try to figure out what the emotions mean."
GOTO("overhere")
::NO::
asked_question = false
"Ms. Render: No questions? Ok Well Think about what you all can do for your essay"
//You are talking to yourself so do some image thing here to indicate that
"$user$: I could probably do an essay on what there to be happy or sad about?"
"Ms. Render: With that lets end class. Have a nice day everyone."
GOTO("prechoice")
::overhere::
"Ms. Render: With that lets end class. Have a nice day everyone."
"$user$: I don't understand how the frog could be happy"
"I should probably do what Ms. Render said and research emotions"
"I can use my notebook to record everything I find"
::prechoice::
"$user$: I can go to these different places, maybe one will give me a clue on whay I can do..."
::choose:: ::choose::
"What should I do"< "Where should I go?"<
"Cry" JUMP("CRY") "Go to my house" JUMP("HOUSE")
"Call for help" JUMP("HELP") "Go to the school" JUMP("SCHOOL")
"Wait it out" JUMP("WAIT") "Go to the park" JUMP("PARK")
"Go to the aquarium" JUMP("AQUARIUM")
"Go to the store" JUMP("STORE")
> >
} }
[CRY]{ [HOUSE] {
cry=true // used for future decisions BG("images/home.png")
"Abby: crying is nice, but it won't help any" BGStop()
HouseBG(true)
house = true
"You enter the door into your house. You see your mom in the living room and walk towards her."
"Mom: Hello sweetie, how was your day?"
"$user$: It was the same. Ms. Render read an odd book today."
"Mom: What was the book about?"
"$user$: It was about a frog that was happy. But I don't understand how a frog could be happy. I think it will be my essay topic because we are suppose to figure out a situation we don't understand."
"Mom: Well happiness is an emotion and many people experience it. It's a sign that they are feeling good."
"$user$: But a frog isn't a person. How could its emotion change?"
"Mom: They change because of things that happen through the day. It is not only people that have emotions, which is why the story is about a frog."
"$user$: I still don't understand."
"Mom: Hmmm, How about we do something different."
"$user$: What do you mean?"
"Mom: Lets play a little game. I will show you different pictures and you will try to figure out which emotion is being shown."
"$user$: How would this help me?"
"Mom: If you can recognize the different emotions then that would be the first step into understanding a specific emotion."
"$user$: That does make sense. All right let's play."
MINIGAME_HOUSE()
GOTOE("choose") GOTOE("choose")
} }
[HELP]{
help=true // used for future decisions [SCHOOL]{
"Abby: Ok let me press this call button" BG("images/classroomafterhours.png")
BGStop()
SchoolBG(true)
school = true
if eastereggSchool==true then GOTO("school")|GOTO("notschool")
::school::
"$user$: I have already went to the school and did all I could here. I think it is a better Idea to try somewhere else"<
"Go to my house" JUMP("HOUSE")
"Go to the park" JUMP("PARK")
"Go to the aquarium" JUMP("AQUARIUM")
"Go to the store" JUMP("STORE")
>
::notschool::
"You walk into the school and see the hallways empty. It is after school so only the teachers are left. You walk into your classroom and see Ms. Render sitting at her desk."
"$user$: Hello Ms.Render I am back in class."
if played_gameschool==true then GOTO("played")|GOTO("notplayed")
::notplayed::
if asked_question==true then GOTO("asked")|GOTO("notasked")
::asked::
"Ms.Render: Good afternoon $user$, is there something you need? I noticed you had a question about emotions eariler."
"$user$: Yes I did, and I was wondering if you could help me a bit more with this research"
"Ms. Render: Your choice was very interesting and unique. What issue are you having with your reasearch?"
"$user$: Yes I am. I am trying to gather all the information I can about emotions and interacting with people."
"Ms.Render: I think you should go to a few places you have been before and ask people you know how they are feeling. That would give you a range of data to work with and hopefully help you find the solution to your question."
GOTO("continue")
::notasked::
"Ms.Render: Good afternoon $user$, is there something you need."
"$user$: Yes, I have a question about the essay you assigned."
"Ms. Render: What did you choose your report to be about?"
"$user$: After listening to the book I couldn't understand the frog and why he was happy. Because the essay topic requires you to study something you don't understand and research it, I chose to figure out why the frog is happy."
"Ms. Render: That is a very interesting and unique choice. Are you having a problem with the research?"
"$user$: Yes I am. I am trying to gather all the information I can about emotions and interacting with people."
"Ms.Render: I recommend you going to a few places you have been before and asking people you know how they are feeling. That would give you a range of data to work with and find the solution to your question."
::continue::
"$user$: That would give me a lot of information to work with. But I don't know how to respond to people when they say how they are feeling."
"Ms. Render : How about we do some practice. We will go through five rounds. Each round I will show you a a sentence. You will have to complete the sentence that follows. You pass if you complete all the rounds. How does that sound?"
"$user$: That would be helpful. Let's start."
JUMP("SCHOOLGAME")
::played::
"Ms. Render: Hello again $user$, do you need some more assistance?"<
"Yes, I would like to play this game again." JUMP("SCHOOLGAME")
"No, I was wondering if others around me may have the same issue as me?" GOTO("no")
>
::no::
eastereggSchool = true
"Ms. Render: Let me tell you a story about things that I have seen in my years of teaching"
"$user$: Sure, that would be nice."
"Ms. Render: You see as I have taught students for about 30 years now, I've seen students of all kinds."
"Some were very sociable while others were more reserved and to themself."
"And a few of the students who were more quite and to themself did have the same issues that you have."
"They were able to overcome this however by making an extra effort to be around other people and talk with them"
"As they grow up you are able to see a positive change in them and they were sometimes better at reading emotions than the students who seened to be lively and talkative."
"$user$: So what you are saying is that if i keep trying I can learn how to understand emotions as well?"
"Ms. Render: I am saying that with enough effort I believe that anything you put your mind to is possible"
"$user$: Wow thanks this means a lot!"
"..." "..."
"Employee: Hello what is going on?" "I think I feel happy right now..."
"Abby: There is an issue with the elevator! I hear a cracking sound" "Ms. Render: I am sure you do. Good Luck on your project I know that you will do a great job"
"Employee: Hmm... Our sensors say everything is ok" "$user$: Thank you, have a good day"
"Abby: Oh alright... Maybe I am a bit nervous about this interview" "Where to now"<
"Employee: No worries, and good luck" "Go to my house" JUMP("HOUSE")
"Abby: Thanks" "Go to the park" JUMP("PARK")
JUMP("NOTHING") "Go to the aquarium" JUMP("AQUARIUM")
} "Go to the store" JUMP("STORE")
[WAIT]{
wait=true // used for future decisions
"Abby: I am sure its nothing"
JUMP("NOTHING")
}
[NOTHING]{
"RYAN: And it all leads to here eventually"
"What to do try other options"<
"Yes" GOTOE("choose")
"I had enough" QUIT()
> >
} }
[SCHOOLGAME]{
"Ms. Render: Are you ready to get started?"<
"Yes I am ready to play" GOTO("yes")
"Not yet" GOTO("no")
>
::no::
"Ms. Render: Ok that is fine, come to me when you are ready to play"
"$user$: Well until I am ready I should check out some other places"<
"Go to my house" JUMP("HOUSE")
"Go to the park" JUMP("PARK")
"Go to the aquarium" JUMP("AQUARIUM")
"Go to the store" JUMP("STORE")
>
::yes::
c = ","
d = getPeriod()
e = ":"
q = getQuote()
listA=[]
listA[1]="Hello$c$ my name is Ms$d$ Render! What is your name?"
listA[2]="I$q$m not feeling so good$d$$d$$d$"
listA[3]="How is your day going?"
listA[4]="A friend of mine just gave me a gift!"
listA[5]="Today a student that was struggling improved really well$d$"
listA[6]="My dog is really sick$d$$d$$d$"
listA[7]="I lost my wallet earlier$d$"
listA[8]="I returned a lost bag to a student$d$"
listA[9]="The class pet just had a little baby$d$"
listA[10]="A friend of mine fell and broke their leg the other day$d$"
listB=[]
listB[1]=[]
temp=listB[1]
temp[1]="My name is $user$$d$"
temp[2]="I need to ask you a question$d$"
temp[3]="What do you need?"
temp[4]="Ms$d$ Render$e$ Nice to meet you $user$$d$ Good job with this one$d$"
listB[2]=[]
temp=listB[2]
temp[1]="Thats good to hear$d$"
temp[2]="Oh no is everything ok?"
temp[3]="I am feeling a bit hungry right now"
temp[4]="Ms$d$ Render$e$ Thanks$c$ I hope I feel better as well$d$ And that is correct!"
listB[3]=[]
temp=listB[3]
temp[1]="Are you feeling ok?"
temp[2]="What do you think is a good project idea is$d$"
temp[3]="I am doing alright$c$ how is your day going?"
temp[4]="Ms$d$ Render$e$ I am doing good thanks$d$ And that is correct!"
listB[4]=[]
temp=listB[4]
temp[1]="I think gifts are dumb$d$"
temp[2]="Wow that must have been exciting$c$ do you like the gift?"
temp[3]="Why should I care?"
temp[4]="Ms$d$ Render$e$ Yes I am excited$c$ it was an amazing gift!"
listB[5]=[]
temp=listB[5]
temp[1]="That sucks$c$ improvement isn$q$t a good thing$d$"
temp[2]="Wow you must be feeling sad about that$d$"
temp[3]="Wow that must have made you happy$d$"
temp[4]="Ms$d$ Render$e$ Yes I am happy$c$ it$q$s a teacher dream to see their students grow!"
listB[6]=[]
temp=listB[6]
temp[1]="That$q$s not good$c$ what do you think is wrong?"
temp[2]="I don$q$t like dogs anyway$d$"
temp[3]="Cats make better pets$d$"
temp[4]="Ms$d$ Render$e$ Oh I took Rex to the vet$c$ he got sick from drinking water from a dirty puddle$d$ Doctors say he$q$ll get better in no time$d$"
listB[7]=[]
temp=listB[7]
temp[1]="I wish I had tons of money$d$"
temp[2]="People shouldn$q$t be so bad with their possessions$d$"
temp[3]="You must have been worried$c$ did you find it?"
temp[4]="Ms$d$ Render$e$ Yes I did and I was worried I have all of my important info in there$d$ I left it in the teachers lounge$d$ Randy the Gym teacher told me and gave it back to me$d$"
listB[8]=[]
temp=listB[8]
temp[1]="The student must have felt happy to get their bag back$d$"
temp[2]="I don$q$t know how people can lose their stuff$d$"
temp[3]="People shouldn$q$t be so bad with their possessions$d$"
temp[4]="Ms$d$ Render$e$ Yes he was very happy to get his bag back$d$"
listB[9]=[]
temp=listB[9]
temp[1]="Ok thats kinda boring$d$"
temp[2]="That is really cool$c$ everyone must be excited to have a little hamster"
temp[3]="What does a rat do anyway$d$"
temp[4]="Ms$d$ Render$e$ Yes it is very nice to have a new little guy running around$d$"
listB[10]=[]
temp=listB[10]
temp[1]="Ouch that must have hurt$c$ is he ok?"
temp[2]="He should have watched where he was going$d$"
temp[3]="I fell and nothing happened to me$d$"
temp[4]="Ms$d$ Render$e$ Yes it was$c$ but he$q$ll make a full recovery$d$"
listC=[1,2,3,2,3,1,3,1,2,1]
count = 0
"Ms. Render: Let's give this game a go."
::loop::
length = getLength(listA)
if length>0 then GOTO("IND")|GOTO("Um")
::IND::
ind = randomInt(1,length)
A = listRemove(listA,ind)
B = listRemove(listB,ind)
C = listRemove(listC,ind)
b1=B[1]
b2=B[2]
b3=B[3]
b4=B[4]
"$A$"<
"$b1$" GOTO("c1")
"$b2$" GOTO("c2")
"$b3$" GOTO("c3")
>
::c1::
if C==1 then GOTO("correct")|GOTO("wrong")
::c2::
if C==2 then GOTO("correct")|GOTO("wrong")
::c3::
if C==3 then GOTO("correct")|GOTO("wrong")
::correct::
count=count+1
"$b4$"
GOTO("loop")
::wrong::
"Ms. Render: Um... Lets try another one!"
GOTO("loop")
::Um::
if count>5 then GOTO("win")|GOTO("tryagain")
::tryagain::
"MS. Render: Well I think we should try this game again..."
"Are you ready?"<
"Yes I am ready to try again" GOTO("yes")
"Not yet" GOTO("no")
>
::win::
played_gameschool = true
"MS. Render: Good job you got $count$ correct!"
"$user$: That's awesome! Thanks for your help"
if count==10 then GOTO("perfect")|GOTO("improve")
::perfect::
"Ms. Render: Wow amazing! You got them all right! I think you have mastered this. Good Luck on the rest of your project."
"$user$: Thank you, you have been a great help!"
"Where to now?"<
"Go to my house" JUMP("HOUSE")
"Go to the park" JUMP("PARK")
"Go to the aquarium" JUMP("AQUARIUM")
"Go to the store" JUMP("STORE")
>
::improve::
"Ms. Render: You did good! $count$/10 correct not bad!"
"$user$: Thank you!"
"Ms. Render: Do you want to try for a better score?"<
"Yes, I do want to see if I can get better." GOTO("yes")
"No, I think I have a good enough understanding of this now." GOTO("no")
>
}
[PARK]{
BG("images/Park.png")
BGStop()
ParkBG(true)
park = true
"The park is across across from the school."
"Most of the students go there after school to play before they go home."
"You see John, a student in your class on the swings and approach him"
"$user$: Hello John, are you having fun on the swings?"
"John: Yeah I am. I'm gonna keep playing until I have to go home. I still don't know what I'll write my essay on. Do you know?"
"$user$: Yes, I will do mine on Harry the frog and emotions. I want to figure out why he is happy throughout his day."
"John: That's cool! How are you going to figure it out though?"
"$user$: I plan to take Ms. Render's advice and study emotions in different areas I am familiar with."
"John: So what are you gonna do here?"
"$user$: Since there are many people here I know, I plan to ask them questions and understand their current emotions."
"John: I think five students from our class are still here, including me. Ask us your questions for your essay so you can write your essay."
"$user$: That sounds like a good idea"
"$user$: So John... "<
"May I ask you a question?" GOTO("yea")
"Goodbye" GOTO("byeJohn")
>
::yea::
"John: Sure, what do you want to ask me?"<
"How are you doing?" GOTO("doing")
"Are you happy?" GOTO("happy")
"Goodbye" GOTO("byeJohn")
>
::doing::
"John: I am doing fine, how are you doing?"<
"I am good, why are you feeling fine?" GOTO("fine")
"I'm alright what is making you feel that way?" GOTO("fine")
"Goodbye" GOTO("byeJohn")
>
::fine::
"John: I love getting some freah air in the park."
"John: Being here makes me happy"
::happy::
"John: The park makes me feel happy because it where I get to hang out with all of my friends."<
"So hanging out with your friends is what makes you happy?" GOTO("friends")
"What about your friends makes you happy?" GOTO("friendsPre")
>
::friendsPre::
"John: My friends allow me to relax and enjoy fun times. They are always there to make me laugh."
::friends::
"John: Hanging with my friends is one of best things that could happend on any day."
friends=true
::byeJohn::
"$user$: Alright John thats all of the questions that I have for you. Thanks for taking the time to help me out"
"John: Don't mention it... Looks like my friends are over there..."
"Randy: Hey John! Who's this?"
"John: Oh this is $user$ he's in our class, he sits in the back a lot so you may have missed him in class."
"Randy: Hey $user$ how is everything?"<
"I am good, working on the essay for class, can you help me?" GOTO("essayRandy")
"All is good, how are you?" GOTO("how")
>
::how::
randy=true
"Randy: I am doing okay, I am having tons of trouble with my essay for class."
"$user$: Thats funny I am having trouble with my essay as well... Maybe we can help each other. What is your essay about?"
"Randy: My essay is on: What makes people dream"
"$user$: Thats cool, I like that topic"
::essayRandy::
"Randy: What is your essay about?"<
"It's about what makes people feel emotions" GOTO("emotion")
"Nothing" GOTO("byeRandy")
>
::emotion::
help=true
"Randy: Hmm that is an interestin question... What made you pick that one?"
"$user$: I thought of it after Ms. Render read the story in class."
if asked_question==true then GOTO("asked")|GOTO("notasked")
::asked::
"Randy: Ah I remember now, you asked this in class, and the teacher said that it would make a good topic to do."
"$user$: Yes it sounded like a good idea at first, but it is much harder than I thought it would be."
::jumpback::
if randy==true then GOTO("a1")|GOTO("a2")
::a1::
"Your question sounds just as hard though"
"Randy: Yeah it is leaving me confused... I have no idea why people want to dream. Do you have any dreams?"<
"Yes" GOTO("dreams")
"Not really" GOTO("none")
>
::dreams::
"$user$: I have a dream that one day I will completely understand why people feel the way they do when different things happen to them"
"Randy: That's an interesting dream... Maybe people dream about things that they really want to achieve in life"
"$user$: When you put it like that, it makes a lot of sense. People want to dream about the things that they desire and want badly"
"Randy: Yes, that does make sense... Thanks a lot $user$ you helped me out big time"
"$user$: Happy to help"
GOTO("a2")
::none::
"$user$: I don't really have any dreams."
"Randy: Nothing?"
"$user$: Nope, for me there just doesn't seem to be anything that I strive for?"
"Randy: That must suck, I am the same. There isn't anything I feel is worth dreaming about. To me everything feels the same regardless of what I think."
"$user$: Hmm... wow seems like we both picked a tough project."
"Randy: Yeah, what do you think makes people dream?"<
"I think people dream to help them stick to a goal" GOTO("goal")
"People dream about what they can't do" GOTO("cant")
>
::goal::
"Randy: Hmm that's an interesting thought... Maybe people dream about things that they really want to achieve in life"
"$user$: When you put it like that, it makes a lot of sense. People want to dream about the things that they desire and want badly"
"Randy: Yes, that does make sense... Thanks a lot $user$ you helped me out big time"
"$user$: Happy to help"
GOTO("a2")
::cant::
"Randy: Hmm, that may be the case when I think about it... Perhaps people dream about the unattainable in life."
"$user$: Yeah, that may be the case..."
"Randy: Yes, that does make sense... Thanks a lot $user$ you helped me out big time"
"$user$: Happy to help"
::a2::
"$user$: What do you think would be a good way to apporach my essay?"
"Randy: Well you said you want to know what makes people happy right? Let me tell you something."
if randy==true then GOTO("a3")|GOTO("a4")
::a3::
"Randy: Eariler today I eas confused and annoyed with what I could do for this essay."
"Randy: Then you came along and help me out a lot..."
"Randy: I think doing good things for people and putting forth an honest effort is what helps a lot."
"Randy: Doing good for the sake of doing good and not for something you can get in return."
"$user$: So helping people can make others happy... But for some reason helping you made me feel good too."
"Randy: Yeah, that happens a lot when you do good things too... Also if people like you they will enjoy being around you as well."
GOTO("byeRandy")
::a4::
"Randy: I feel that you should think about what may make others feel happy"
::notasked::
"Randy: Ah that story was an interesting one. What did you think of it?"
"$user$: I felt it was a good story, seeing Harry happy made me think about what makes one happy and how one could become happy."
"Randy: That sounds like a good idea."
"$user$: Yes it sounded like a good idea at first, but it is much harder than I thought it would be."
GOTO("jumpback")
::byeRandy::
if help==true then GOTO("here")|GOTO("nohelp")
::here::
"$user$: Thanks for helping me with finishing my essay."
if randy==true then GOTO("NP")|GOTO("np")
::NP::
"Randy: Don't mention it, you helped me a great deal as well!"
"$user$: Haha, fellow classmates helping each other"
"Randy: Hey, after you are done working on your essay feel free to join us."
"Randy: We will be playing a game of kick ball, and would love another player."
"$user$: That sounds like a lot of fun"<
"I'd love to play" GOTO("play")
"I don't really like kickball" GOTO("next")
>
::play::
"Randy: Cool looking forward to it."
kickball = true
GOTO("next")
::np::
"Randy: Happy to help."
GOTO("next")
::nohelp::
"Randy: Well, I would have loved to help you, but you didn't tell me what you are working on."
"$user$: Yeah, I don't know what I was expecting would happen."<
"My essay is about what makes people feel emotions" GOTO("emotion")
"That's fine, I don't really like talking about it much" GOTO("endpark")
>
::next::
"Randy: Oh look Sally and Amy are coming over here."
"Sally: Hey who is this..."
"Amy: I think I've seen them in our class before."
"Sally: Yeah you're the one who sits in the back of class, how are you doing?"<
"I am doing good, nice to meet you" GOTO("igood")
"I am doing alright, confused on this project that I am doing" GOTO("ibusy")
>
::igood::
"Sally: Thats good to hear and I am doing fine as well"
"$user$: That's good!"<
"Ask Amy how she is doing?" GOTO("askamy")
"What brings you to the park" GOTO("whypark")
"Could you lend me some assistance on this essay of mine?" GOTO("noaskamy")
>
::askamy::
"$user$: Hey Amy how are you doing?"
"Amy: I am doing good, a little tired though, thanks for asking."
"$user$: Thats good to hear, why are you tired?"
"Amy: I have been really busy with my little brother."
"He's four years old and is always causing trouble for me."
"$user$: How so?"
"Amy: He keeps using his youngness to get me in trouble. You know how little siblings can be."
"$user$: Um I don't have any siblings..."
"Amy: Oh um..."
"Sally: Haha, same with me as well no brothers or sisters to get in my way."
"Amy: Lucky..."
"$user$: Haha, but I always wanted a brother or sister."
siblings=true
"Sally: How come?"
"$user$: I wanted to have someone I could have fun with."
"Amy: You know, while I do want to kill my little brother half of the time, he does make our family happier."
"$user$: Really, family can make you happy too?"
"Amy: Yeah they can, I love my family."
"$user$: Awesome, what about them makes you happy?"
"Amy: Well my family supports me and helps me when I am feeling sad."
"They always know just what to say to make me feel better."
"$user$: Oh I see, your family is able to turn your saddness into happiness."
"Amy: Yes that's what they are doing..."
"Sally: I could never be bothered by family"
"Amy: Hmm... This is the first time I am hearing about this."
"Sally: Well for me I feel that having fun is more important then family."
"$user$: That's interesting why do you say that?"
"Sally: They just don't get me much. Which is why I spend most of my time having fun in the park."
"$user$: Ah, that's why... what about the park do you like"
::whypark::
if siblings==true then GOTO("sib")|GOTO("nosib")
::sib::
"Sally: I love going to the park. I get to hang out and not have to worry about everything going on at home..."
"Amy: What do you mean about going on at home?"
"Sally: Well, my parents have been acting strange lately."
"They are constantly yelling and it makes me sad."
"Sometimes I cry for hours wondering why this is happening."
if played_gameschool==true then GOTO("emotionPlus")|GOTO("emotionMinus")
::emotionPlus::
"$user$: That must be tough."
"Sally: It is, I don't know how to handle this."
"Amy: Well you have friends that are able to help you."
if friends==true then GOTO("yesF")|GOTO("noF")
::yesF::
"$user$: Yeah, friends are a great support that can bring happiness."
"Sally: You are right, I'd like you to be my friend. You are such a caring person."
"$user$: Sure, I'd love to be your friend."
"Amy: Haha, look at you two"
"$user$ & Sally: What?"
"Amy: Nothing..."
sallyFriend = true
GOTO("GoodAsk")
::noF::
"$user$: yeah..."
"Amy: Well Sally, we are here to talk if you need."
"Sally: Thanks, I'll call you later."
"I think I over heard Randy saying that you are working on a project."
GOTO("ibusy")
::emotionMinus::
"$user$: Oh, that sucks."
"Sally: Yea it does... "
"I think I over heard Randy saying that you are working on a project."
GOTO("ibusy")
::nosib::
"Sally: I love going to the park. I get to hang out and have fun with my friends!"
"$user$: That sounds nice, I feel like the park is a nice relaxing place too."
"Sally: It is..."
"Amy: I enjoy the park as well."
"$uesr$: The park has a nice calm feel to it... And the sun is out and it feels good."
"Amy: Yeah the nice breeze and sun really makes you enjoy life."
"Sally: It does I do enjoy this weather too..."
if kickball==true then GOTO("kickit")|GOTO("nokick")
::kickit::
"Looking forward to our kickball game later today."
"$user$: Yeah Randy told me about that, told me I should stop by later and play when I am done working on my essay."
"Sally: That sounds fun. What are you working on?"
GOTO("GoodAsk")
::nokick::
"$user$: As much as I would like to relax, I have to finish my essay for class."
"Sally: What is your essay about?"
GOTO("GoodAsk")
::noaskamy::
"Sally: Sure I guess..."
::ibusy::
"$user$: I need help with figuring out what makes people happy."
"Sally: Thats easy, having fun is what makes people happy."
"Being fun is the way to go"
"$user$: Being fun?"
"Sally: Yes boring people are no fun, which means they cannot make others happy"
"$user$: Well being boting doesn't make people unhappy do they?"
"Sally: No, but they won't really change the emotions you are currently feeling."
"$user$: I think I understand what you are saying. Thanks for the help"
GOTO("lastone")
::GoodAsk::
"$user$: My essay in on what makes one happy."
"Sally: Oh thats interesting... I think happiness comes from having fun with friends and being satisifed with ones life."
"Amy: Yes, and family too can also help one to feel happy."
"$user$: That makes sense. I think I can talk about that in my essay."
"Amy & Sally: Happy to help."
::lastone::
"$user$: Thanks, Who's that over there?"
"Sally: Oh, thats Rob."
"$user$: Rob?"
"Amy: Yea, Rob is the life of our group. And the one who wanted us to play some kickball."
"$user$: Cool, sounds like a fun guy."
"Sally: He is, hmm looks like he's a bit busy right now though. Maybe you can speak to him later"
"$user$: Yeah thats fine I can chat with him later today. Randy, Amy, Sally and John thanks for your help today."
"John: Yeah don't mention it we were happy to help you with your essay."
if kickball==true then GOTO("closeA")|GOTO("closeB")
::closeA::
"Hope to see you later for the kickball game."
"$user$: Wouldn't miss it."
"John: Awesome!"
"$user$: Alright see you all later."
"Everyone: See you later at our game."
GOTO("endpark")
::closeB::
"$user$: Alright see you all later."
"Everyone: See you later in class."
::endpark::
"Where should I go?"<
"Go to my house" JUMP("HOUSE")
"Go to the school" JUMP("SCHOOL")
"Go to the aquarium" JUMP("AQUARIUM")
"Go to the store" JUMP("STORE")
>
}
[AQUARIUM]{
BG("images/aqua.png")
BGStop()
AquaBG(true)
aquarium = true
"You walk into the aquarium near your house."
"You come here once a week to watch the fish swim."
"The exhibits with the most fish are the Underwatered and Swim School."
"Jane works there every Monday and Tuesday From 10:00AM to 7:00 PM closing time."
"Jane: Hi $user$, are you here to see the exhibits?"
"$user$: I am but I am also here for research."
"Jane: What do you mean research?"
"$user$: In class Ms. Render read a book about a frog. The frog was happy and I was confused. She suggested I do my essay on emotions and why they change. Since frogs are amphibians I thought it was best to go to the aquarium."
"Jane: Well we do have one exhibits about frogs. We have four different species living together. They are all underwater frogs that swim in the water and eat bugs."
"$user$: They must be similar to the frog in the book."
"Jane: I will bring you over to the exhibit and you can try to find the frog like the one in your book. They may not be exactly the same but the behaviors of amphibians are similar. Let's go take a look."
MINIGAME_AQUARIUM()
GOTOE("choose")
}
[STORE]{
BG("images/store.png")
BGStop()
StoreBG(true)
store = true
if gamestoreplayed==true then GOTO("thanks")|GOTO("again")
::thanks::
"Jake: Thanks again for your help today. You did a great job helping out."
"$user$: It was fun, and I did feel good while I was helping you out."
"Jake: That's awesome... You know I forgot to mention this, but here."
candy = true
"$user$: Thanks I love EpicBars they taste so good."
"Jake: Don't mention it I am happy you helped out."
GOTO("letsgo")
::again::
"Walking into the local deli store, you see your friend Jake."
"Jake has owned the store for over a decade."
"Jake: Hey $user$, what can I get for you today?"
"$user$: Hello Jake, I am doing research for a essay I need to write."
"Jake: That sounds interesting, what type of research are you doing?"
"$user$: I am studying emotions and why they change. I have to write a report on it for school."
"Jake: How is the research going? Anything I can do to help?"
"$user$: I don't know. What emotion are you going through right now?"
"Jake: Well I am curious about your adventures and happy because today has been a good day."
"$user$: What made today good?"
"Jake: I was able to help my customers and work was pretty smooth."
"$user$: But why are you happy? Is it because nothing difficult happened?"
"Jake : Yes and because I am doing what I enjoy. Working at the store is the best for me."
"$user$: Do you think that is the same for everyone?"
"Jake: Every person is different but that could be part of the reason as to why they are happy."
"$user$: How do I know if it is the same or not?"
"Jake : How about we test this out? Come behind the counter and lets help the customers. A customer will make a request and you will have to give it to them. Look at their face and if they seem happy then you were correct, if not you try again."
"$user$: OK, I can try."
store = GameStore(true)
if store==true then GOTO("good")|GOTO("bad")
::good::
"Jake: Awesome job! You are a pro at this. So many happy customers"
gamestoreplayed = true
::letsgo::
"Where should I go?"<
"Go to my house" JUMP("HOUSE")
"Go to the school" JUMP("SCHOOL")
"Go to the park" JUMP("PARK")
"Go to the aquarium" JUMP("AQUARIUM")
>
::bad::
"Jake: Hehe that was not that good... seems like you were trying to give them what they didn't want!"
"Jake: I'll give you another chance."
"Jake: So what will it be, try again?"<
"Yeah, I'll give it another go" GOTO("again")
"I think I'll try again a bit later" GOTO("letsgo")
>
}
[END]{
BGStop()
CreditsBG(true)
"After going to each location you learned a lot about emotion and happiness specifically."
"Emotions are helpful in communicating and expressing what you like or dislike."
"The frog enjoyed his simple life, hanging out with his friends and helping them."
"You write your essay on everything you learned. Here is what you discovered throughout the day"
"You finish your essay and go to sleep at 9:25PM. School starts tomorrow at 8:15AM and you are prepared to present your essay."
"You talk about emotions and how each person expresses them differently."
"Harry the frog was happy because he was content with his lifestyle."
"Emotions can change throughout the day and can seem confusing. But with patience and practice they can be understood."
"THE END"
QUIT()
}

BIN
game/images/2 KIDS1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
game/images/2 KIDS1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 KiB

BIN
game/images/DownArrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
game/images/Park.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

BIN
game/images/Thumbs.db Normal file

Binary file not shown.

BIN
game/images/UpArrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
game/images/aqua.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
game/images/blur_black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

BIN
game/images/chalkboard.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
game/images/checked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
game/images/checked1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
game/images/classroom.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

BIN
game/images/floor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 KiB

BIN
game/images/gym.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

BIN
game/images/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
game/images/menuoptions.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
game/images/neutral.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
game/images/sad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
game/images/school.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
game/images/smile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
game/images/store.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

BIN
game/images/unchecked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
game/images/wood.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

BIN
game/images/wood.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -1,22 +1,55 @@
--package.path="/?/init.lua;"..package.path
require("Libs/Library") require("Libs/Library")
--~ require("Libs/Utils")
require("bin") require("bin")
require("multi.compat.love2d") --~ require("multi.compat.love2d") -- for use with the love2d engine
GLOBAL,sThread=require("multi.integration.loveManager").init()
require("parseManager") require("parseManager")
require("Libs/lovebind")
require("GuiManager") require("GuiManager")
require("Libs/AudioManager")
gui.LoadAll("Interface") gui.LoadAll("Interface")
jQueue=multi:newSystemThreadedJobQueue(4)
jQueue:registerJob("LoadImage",function(path)
local dat = love.image.newImageData(path)
return dat
end)
jQueue:start()
function form(link,x,y,w,h,sx,sy,sw,sh) function form(link,x,y,w,h,sx,sy,sw,sh)
local x,y,w,h,sx,sy,sw,sh=(link:varExists(x) or tonumber(x)),(link:varExists(y) or tonumber(y)),(link:varExists(w) or tonumber(w)),(link:varExists(h) or tonumber(h)),(link:varExists(sx) or tonumber(sx)),(link:varExists(sy) or tonumber(sy)),(link:varExists(sw) or tonumber(sw)),(link:varExists(sh) or tonumber(sh)) local x,y,w,h,sx,sy,sw,sh=(link:varExists(x) or tonumber(x)),(link:varExists(y) or tonumber(y)),(link:varExists(w) or tonumber(w)),(link:varExists(h) or tonumber(h)),(link:varExists(sx) or tonumber(sx)),(link:varExists(sy) or tonumber(sy)),(link:varExists(sw) or tonumber(sw)),(link:varExists(sh) or tonumber(sh))
return x,y,w,h,sx,sy,sw,sh return x,y,w,h,sx,sy,sw,sh
end end
math.randomseed(os.time())
actornum=0 actornum=0
animnum=0 animnum=0
rand=randomGen:new(0) rand=randomGen:new(0)
class_BG=audio:new("audio/Class.wav")
aqua_BG=audio:new("audio/Aqua.mp3")
park_BG=audio:new("audio/Park.mp3")
school_BG=audio:new("audio/School.mp3")
store_BG=audio:new("audio/Store.mp3")
house_BG=audio:new("audio/House.mp3")
credits_BG=audio:new("audio/Game Credits.mp3")
class_BG:setLooping(true)
aqua_BG:setLooping(true)
park_BG:setLooping(true)
school_BG:setLooping(true)
store_BG:setLooping(true)
house_BG:setLooping(true)
credits_BG:setLooping(true)
function BGStop()
class_BG:stop()
aqua_BG:stop()
park_BG:stop()
school_BG:stop()
store_BG:stop()
house_BG:stop()
credits_BG:stop()
end
parseManager:define{ parseManager:define{
getInput=function(self,msg) getInput=function(self,msg)
return multi:newFunction(function(mulitobj,self,msg)
inputBox.message.text=msg inputBox.message.text=msg
inputBox.Visible=true inputBox.Visible=true
inputBox.input:focus()
go.Visible=false go.Visible=false
thread.hold(function() return _inputvar~=nil end) thread.hold(function() return _inputvar~=nil end)
local i=_inputvar local i=_inputvar
@ -24,11 +57,71 @@ parseManager:define{
inputBox.Visible=false inputBox.Visible=false
go.Visible=true go.Visible=true
return i return i
end)(self,msg) end,
BGStop=function()
class_BG:stop()
aqua_BG:stop()
park_BG:stop()
school_BG:stop()
store_BG:stop()
house_BG:stop()
credits_BG:stop()
end,
ClassBG=function(b)
if b then
class_BG:play()
else
class_BG:stop()
end
end,
AquaBG=function(b)
if b then
aqua_BG:play()
else
aqua_BG:stop()
end
end,
ParkBG=function(b)
if b then
park_BG:play()
else
park_BG:stop()
end
end,
SchoolBG=function(b)
if b then
school_BG:play()
else
school_BG:stop()
end
end,
StoreBG=function(b)
if b then
store_BG:play()
else
store_BG:stop()
end
end,
HouseBG=function(b)
if b then
house_BG:play()
else
house_BG:stop()
end
end,
CreditsBG=function(b)
if b then
credits_BG:play()
else
credits_BG:stop()
end
end, end,
loadAudio=function(self,path) loadAudio=function(self,path)
return love.audio.newSource(path) return love.audio.newSource(path)
end, end,
loadSong=function(self,path)
return love.audio.newSource(path)
end,
playSongLooped=function(self,item) playSongLooped=function(self,item)
item:setLooping(true) item:setLooping(true)
item:play() item:play()
@ -37,12 +130,24 @@ parseManager:define{
item:play() item:play()
if n then if n then
multi:newAlarm(n):OnRing(function() multi:newAlarm(n):OnRing(function()
item:pause() item:stop()
end)
end
end,
getPeriod=function()
return "."
end,
playSong=function(self,item,n)
item:play()
if n then
multi:newAlarm(n):OnRing(function()
item:stop()
end) end)
end end
end, end,
sleep=function(self,n) sleep=function(self,n)
thread.sleep(n) local num=n
self.handle:hold(num)
end, end,
fadeSong=function(self,item) fadeSong=function(self,item)
self.handle:Pause() self.handle:Pause()
@ -59,6 +164,13 @@ parseManager:define{
stopAudio=function(self,item) stopAudio=function(self,item)
item:stop() item:stop()
end, end,
stopSong=function(self,item)
if self:varExists(item)==nil then
love.audio.stop()
return
end
item:stop()
end,
pauseAudio=function(self,item) pauseAudio=function(self,item)
item:pause() item:pause()
end, end,
@ -67,6 +179,7 @@ parseManager:define{
end, end,
BG=function(self,path) BG=function(self,path)
core:SetImage(path) core:SetImage(path)
currentBG = path
end, end,
SHOW=function(self,item) SHOW=function(self,item)
self:varExists(item).Visible=true self:varExists(item).Visible=true
@ -81,6 +194,7 @@ parseManager:define{
if obj.DPI>=2 then if obj.DPI>=2 then
obj.DPI=obj.DPI-1 obj.DPI=obj.DPI-1
end end
print("OBJECT: "..tostring(obj))
return obj return obj
end, end,
makeObject=function(self,link,x,y,w,h,sx,sy,sw,sh) makeObject=function(self,link,x,y,w,h,sx,sy,sw,sh)
@ -116,10 +230,12 @@ parseManager:define{
item:Reset() item:Reset()
end, end,
setImage=function(self,item,path) setImage=function(self,item,path)
smartPrint(item)
item:SetImage(path) item:SetImage(path)
end, end,
setText=function(self,item,text) setText=function(self,item,text)
if type(item)~="table" then if type(item)=="string" then
print(actor)
self:pushError("item must be a gui object!") self:pushError("item must be a gui object!")
end end
item.text=text item.text=text
@ -138,6 +254,15 @@ parseManager:define{
item.dragbut=db item.dragbut=db
end end
end, end,
randomInt=function(self,a,b)
return math.random(a,b)
end,
listRemove=function(self,list,ind)
return table.remove(list,ind)
end,
getLength=function(self,list)
return #list
end,
centerX=function(self,item) centerX=function(self,item)
item:centerX() item:centerX()
end, end,
@ -153,13 +278,21 @@ parseManager:define{
item:Destroy() item:Destroy()
end, end,
loadImage=function(self,path) loadImage=function(self,path)
return love.graphics.newImage(path) --
end,
getQuote=function()
return "'"
end, end,
newThread=function(blocklink,block) newThread=function(blocklink,block)
multi:newThread(block.." [Thread]",function() multi:newThread(block.." [Thread]",function()
local ThreadTest=parseManager:load(blocklink.chunks[block].path) local ThreadTest=parseManager:load(blocklink.chunks[block].path)
ThreadTest.mainENV=blocklink.mainENV ThreadTest.mainENV=blocklink.mainENV
ThreadTest.handle=loop ThreadTest.handle=loop
ThreadTest:define{
sleep=function(self,n)
thread.sleep(n)
end
}
local t=ThreadTest:next(block) local t=ThreadTest:next(block)
while true do while true do
if t.Type=="text" then if t.Type=="text" then
@ -171,55 +304,258 @@ parseManager:define{
end end
end) end)
end, end,
Menu = function(self,b)
core.menu.Visible=b
menu_BG:play()
menu_BG:setVolume(0)
multi:newThread("FadeIn",function()
for i=1,100 do
thread.sleep(.1)
menu_BG:setVolume(i/100)
end
end)
thread.hold(function() return core.menu.Visible==false end)
end,
GameStore = function(self,b)
core.game.Visible=b
core.game.store.Visible=b
core.chatFrame.textHolder.text=""
Progress()
thread.hold(function() return core.game.store.Visible==false end)
return STORE_CORRECT
end,
GameHouse = function(self,b)
core.game.Visible=b
core.game.house.Visible=b
core.chatFrame.textHolder.text=""
ProgressHouse()
thread.hold(function() return core.game.house.Visible==false end)
return HOUSE_CORRECT
end,
GameAqua = function(self,b)
core.game.Visible=b
core.game.aqua.Visible=b
core.chatFrame.textHolder.text=""
ProgressAqua()
thread.hold(function() return core.game.aqua.Visible==false end)
core.chatFrame.Visible = true
return GAME_AQUA
end,
SetActors = function(self,a,b,c)
actor1:SetImage(a)
actor2:SetImage(b)
actor3:SetImage(c)
end
} }
gui.enableAutoWindowScaling(true) standardRef = {
core=gui:newImageLabel(nil,0,0,0,0,0,0,1,1) [[OnEnter(function(self)
if not igmenu.Visible then
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(32,"fonts/Angeline.ttf")]],
[[setRoundness(10,10,360)]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = -38,
Color=Color.Black
}
choiceRef = {
[[OnEnter(function(self)
if not igmenu.Visible then
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(28,"fonts/zekton rg.ttf")]],
[[setRoundness(10,10,360)]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = 8,
Color=Color.Black
}
MenuRef = {
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(76,"fonts/Angeline.ttf")]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = -90,
Visibility = .85,
BorderSize = 0,
Color=Color.Black
}
bin.setBitsInterface(infinabits)
--FileSystem Setup
menuready = true
love.filesystem.setIdentity("Froggy Field Day")
love.filesystem.createDirectory("SavedData")
--gui.enableAutoWindowScaling(true)
core=gui:newImageLabel("images/classroom.jpg",0,0,0,0,0,0,1,1)--gui:newFullImageLabel("fire.jpg","BG")
top=gui:newFullFrame()
top.Visibility = 0
workspace=core:newFullFrame() workspace=core:newFullFrame()
top=gui:newFrame("",0,0,0,0,0,0,1,1)
workspace.Visibility=0 workspace.Visibility=0
top.Visibility=0 core.menubutton = workspace:newTextLabel("Menu",10,10,100,50)
core.chatFrame=core:newFrame("chatFrame",20,-100,-40,80,0,1,1) core.menubutton:OnEnter(function(self)
self:addDominance()
menu_sound:play()
end)
core.menubutton:OnExit(function(self)
self:removeDominance()
end)
core.menubutton:OnReleased(function(b,self)
menuready = false
top:addDominance()
igmenu.Visible = true
end)
core.game=core:newFullFrame()
core.game.Visibility=0
core.actorFrame=core:newFullFrame()
core.actorFrame.Visibility = 0
actor1 = core.actorFrame:newImageLabel(nil,100,-500,250,500,0,1)
actor2 = core.actorFrame:newImageLabel(nil,0,-500,250,500,0,1)
actor2:centerX()
actor3 = core.actorFrame:newImageLabel(nil,-350,-500,250,500,1,1)
core.chatFrame=core:newFrame("chatFrame",20,-140,-40,120,0,1,1)
core.chatFrame:setRoundness(10,10,360) core.chatFrame:setRoundness(10,10,360)
core.chatFrame.BorderSize=4 core.chatFrame.BorderSize=4
core.chatFrame.textHolder=core.chatFrame:newTextLabel("","",5,5,-10,-10,0,0,1,1) core.chatFrame.textHolder=core.chatFrame:newTextLabel("","",5,5,-10,-10,0,0,1,1)
core.chatFrame.textHolder.Visibility=0 core.chatFrame.textHolder.Visibility=0
core.chatFrame.textHolder.text="" core.chatFrame.textHolder.text=""
core.chatFrame.textHolder.TextFormat="left" core.chatFrame.textHolder.TextFormat="left"
core.chatFrame.textHolder:setNewFont(20,"fonts/zekton rg.ttf")
core.chatFrame.textHolder.namepiece = core.chatFrame.textHolder:newTextLabel("",0,-40,0,30)
core.chatFrame.textHolder.namepiece:setNewFont(20,"fonts/zekton rg.ttf")
core.chatFrame.textHolder.namepiece.Tween = 4
core.chatFrame.textHolder.namepiece:setRoundness(5,5,180)
function initGameWindow()
local childs = core.game:getChildern()
for i = 1,#childs do
childs[i]:Destroy()
end
end
test=parseManager:load("init.txt") test=parseManager:load("init.txt")
dump=test:dump() _dump=test:dump()
print(dump) print(_dump)
bin.new(dump):tofile("Dump.dat") bin.new(_dump):tofile("Dump.dat")
test.mainENV["gui"]=workspace test.mainENV["gui"]=workspace
test.mainENV["menu"]=top test.mainENV["menu"]=top
go=core.chatFrame.textHolder:newImageButton("images/arrow.png",-25,-25,20,20,1,1) go=core.chatFrame.textHolder:newImageButton("images/arrow.png",-25,-25,20,20,1,1)
go:OnReleased(function(b,self) go:OnReleased(function(b,self)
ready=true if not igmenu.Visible then
button_pressed = true
end
end) end)
multi:newLoop(function() core:OnReleased(function(b,self)
love.timer.sleep(.005) if not igmenu.Visible and core.chatFrame.Visible and b=="l" then
button_pressed = true
elseif not igmenu.Visible and b=="r" then
core.chatFrame.Visible = not core.chatFrame.Visible
if choiceframe and not choiceframe.Destroyed then
choiceframe.Visible = core.chatFrame.Visible
end
end
end) end)
ready=false dialogeHandler=multi:newThreadedLoop("loop",function(self,ti)
multi:newThread("TextHandler",function()
while true do
t=test:next() t=test:next()
button_pressed = false
enter_pressed = false
auto_progressed = false
if t==nil then love.thread.exit() end
if t.Type=="text" then if t.Type=="text" then
core.chatFrame.textHolder.text=t.text local temptag = t.text:match("(.-): ")
ready=false if temptag then
thread.hold(function() return ready==true end) test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.text = t.text:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
core.chatFrame.textHolder.text=""
for i in t.text:gmatch(".") do
local held = thread.hold(function() return igmenu.Visible == false end)
if held then
enter_pressed = false
button_pressed = false
auto_progressed = false
end
if Settings.Text_speed==1 then
thread.sleep(.1)
elseif Settings.Text_speed==3 then
thread.sleep(.02)
else
thread.sleep(.05)
end
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
if (button_pressed or auto_progressed) and menuready then enter_pressed = false button_pressed = false core.chatFrame.textHolder.text=t.text break end
end
if Settings.auto_progress and core.chatFrame.textHolder.Visible then
thread.sleep(1)
enter_pressed = true
end
thread.hold(function() return (enter_pressed or button_pressed or auto_progressed) and igmenu.Visible == false end)
elseif t.Type=="choice" then elseif t.Type=="choice" then
go.Visible=false go.Visible=false
local choiceframe=gui:newFrame("",0,0,300,(#t+1)*40-10) choiceframe=core:newFrame("",0,0,0,0,0,0,.8)
choiceframe:newTextLabel(t.prompt,0,0,0,40,0,0,1).Color=Color.light_blue choiceframe.Visibility = 0
core.chatFrame.textHolder.text=""
local temptag = t.prompt:match("(.-): ")
if temptag then
test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.prompt = t.prompt:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
for i in t.prompt:gmatch(".") do
thread.sleep(.05)
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
if enter_pressed or button_pressed or auto_progressed then enter_pressed = false button_pressed = false core.chatFrame.textHolder.text=t.prompt break end
end
local choice
for i=1,#t[1] do for i=1,#t[1] do
local choice=choiceframe:newTextButton(t[1][i],0,i*40,0,40,0,0,1) if not choice then
choice.Color=Color.Darken(Color.saddle_brown,.15) choice=choiceframe:newTextLabel(t[1][i],0,0,0,50,0,0,1)
choice.index=i else
choice=choice:newTextLabel(t[1][i],0,10,0,50,0,1,1)
end
choice.Color = Color.Darken(Color.saddle_brown,.15)
choice.index = i
choice.Visibility = .85
choice:OnReleased(function(b,self) choice:OnReleased(function(b,self)
if not igmenu.Visible and menuready then
choicemade=self.index choicemade=self.index
end
end) end)
gui.massMutate(choiceRef,choice)
end end
choiceframe:centerX() choiceframe:centerX()
choiceframe:centerY() y=((#t[1]*60)-10)/2
print(y)
choiceframe:SetDualDim(nil,-(y+60),nil,nil,nil,.5)
thread.hold(function() return choicemade~=nil end) thread.hold(function() return choicemade~=nil end)
go.Visible=true go.Visible=true
choiceframe:Destroy() choiceframe:Destroy()
@ -227,11 +563,9 @@ multi:newThread("TextHandler",function()
choicemade=nil choicemade=nil
t=test:next(nil,cm) t=test:next(nil,cm)
end end
thread.sleep(.001)
end
end) end)
test.handle=dialogeHandler test.handle=dialogeHandler
inputBox=gui:newFrame(0,0,500,160) inputBox=core.game:newFrame(0,0,500,160)
inputBox.Visibility=0 inputBox.Visibility=0
inputBox.header=inputBox:newFrame(0,0,8,28,0,0,1) inputBox.header=inputBox:newFrame(0,0,8,28,0,0,1)
inputBox.header.Visibility=0 inputBox.header.Visibility=0
@ -275,3 +609,20 @@ inputBox.input.ClipDescendants=true
inputBox:centerX() inputBox:centerX()
inputBox:centerY() inputBox:centerY()
inputBox.Visible=false inputBox.Visible=false
core.game=core:newFullFrame()
core.menu=core:newFullFrame()
require("minigames")
require("menu")
function love.keyreleased(key)
if key == "space" then
enter_pressed = true
end
end
gui.massMutate(standardRef,core.menubutton)
core.menu.Visible = true
function love.update(dt)
multi:uManager(dt)
end
function love.draw()
multi.dManager()
end

592
game/menu.lua Normal file
View File

@ -0,0 +1,592 @@
-- love.graphics.captureScreenshot( filename )
-- Save data stuff
igmenu = top:newFrame(0,0,0,0,0,0,.3,.8)
igmenu.Visible = false
igmenu.Visibility = 0
igmenu:center()
igmenu.resume = igmenu:newTextLabel("Resume",0,0,0,0,0,0,1,1/5)
igmenu.save = igmenu:newTextLabel("Save",0,0,0,0,0,(1/5),1,1/5)
igmenu.load = igmenu:newTextLabel("Load",0,0,0,0,0,(2/5),1,1/5)
igmenu.setting = igmenu:newTextLabel("Settings",0,0,0,0,0,(3/5),1,1/5)
igmenu.quit = igmenu:newTextLabel("Quit",0,0,0,0,0,(4/5),1,1/5)
igmenu.resume:OnReleased(function()
igmenu.Visible = false
multi:newAlarm(.1):OnRing(function(alarm)
alarm:Destroy()
menuready = true
end)
top:removeDominance()
end)
igmenu.save:OnReleased(function()
local date = os.date("%m.%d.%y_%I.%M.%S",os.time())
love.filesystem.createDirectory("SavedData/"..date)
local state = test:extractState()
local statedat = bin.new()
state.variables["gui"]=nil
state.variables["menu"]=nil
statedat:addBlock(state)
statedat:addBlock(currentBG,128)
test.mainENV["gui"]=workspace
test.mainENV["menu"]=top
statedat:tofileS("SavedData/"..date.."/savedata.dat")
igmenu.Visible = false
multi:newThread("Saving-Thread",function()
thread.sleep(.1)
love.graphics.newScreenshot():encode("png","SavedData/"..date.."/screen.png")
print("Saving image!")
igmenu.Visible = true
end)
print("data saved")
end)
igmenu.load:OnReleased(function()
core.menu.load:setParent(core.igmenu)
core.menu.load.Visible = true
core.igmenu.Visible = true
core.igmenu:addDominance()
core.menu.load:setDualDim(0,0,0,0,0,0,1,1)
loadSaves()
multi:newEvent(function()
return core.menu.load.Visible==false
end):OnEvent(function(evnt)
core.menu.load:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1)
evnt:Destroy()
end)
end)
igmenu.setting:OnReleased(function()
core.menu.settings:setParent(core.igmenu)
core.menu.settings.Visible = true
core.igmenu.Visible = true
core.igmenu:addDominance()
core.menu.settings:setDualDim(0,0,0,0,0,0,1,1)
multi:newEvent(function()
return core.menu.settings.Visible==false
end):OnEvent(function(evnt)
core.menu.settings:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.settings:setDualDim(0,0,0,0,1/3,0,2/3,1)
evnt:Destroy()
end)
end)
igmenu.quit:OnReleased(function()
core.menu.quit.Visible = true
core.menu.quit:addDominance()
end)
gui.massMutate(MenuRef,igmenu.quit,igmenu.setting,igmenu.load,igmenu.save,igmenu.resume)
menu_sound=audio:new("audio/menu.wav")
menu_BG=audio:new("audio/Menu.mp3")
menu_BG:setLooping(true)
core.menu.Visible = false
local options = core.menu:newFrame(0,0,0,0,0,0,1/3,1)
local lowerBg = core.menu:newImageLabel("images/school.png",0,0,0,0,1/3,0,2/3,1)
local bg = core.menu:newImageLabel("images/2 KIDS1.png",0,0,0,0,1/3,0,2/3,1)
local upperBg = core.menu:newFrame(0,0,0,0,1/3,0,2/3,1)
upperBg.Color = Color.Black
play = options:newTextLabel("Play",0,0,0,0,0,0,1,1/4)
load = options:newTextLabel("Load",0,0,0,0,0,1/4,1,1/4)
load:OnReleased(function(b,self)
core.menu.settings.Visible = false
core.menu.load.Visible = true
loadSaves()
end)
local settings = options:newTextLabel("Settings",0,0,0,0,0,2/4,1,1/4)
settings:OnReleased(function(b,self)
core.menu.load.Visible = false
core.menu.settings.Visible = true
end)
local quit = options:newTextLabel("Quit",0,0,0,0,0,3/4,1,1/4)
quit:OnReleased(function(b,self)
core.menu.quit.Visible = true
core.menu.quit:addDominance()
end)
core.menu.load = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1)
core.igmenu = gui:newFrame(0,0,0,0,0,0,1,1)
core.igmenu.Color = Color.Black
core.igmenu.Visible = false
core.menu.load.games = core.menu.load:newFrame(0,0,0,0,0,0,1,1)
core.menu.load.games.Visibility = 0
local Bbar = core.menu.load:newImageLabel("images/wood.png",0,-90,0,90,0,1,1)
local Tbar = core.menu.load:newImageLabel("images/wood.png",0,0,0,90,0,0,1)
Bbar.Color = Color.new(116,99,150)
Tbar.Color = Color.new(116,99,150)
core.menu.load.Visible = false
core.menu.load.Color=Color.new(116,99,150)
core.menu.load.dragFrame=core.menu.load:newImageLabel(nil,0,0,0,0,0,0,1,1)
core.menu.load.down = core.menu.load:newImageButton("images/DownArrow.png",0,-70,100,60,0,1)
core.menu.load.down:centerX()
core.menu.load.down.Color=Color.Darken(Color.Yellow,.15)
core.menu.load.up = core.menu.load:newImageButton("images/UpArrow.png",0,10,100,60)
core.menu.load.up.Visible = false
core.menu.load.up:centerX()
core.menu.load.up.Color=Color.Darken(Color.Yellow,.15)
core.menu.load.back = core.menu.load:newTextLabel("Back",20,-70,100,50,0,1)
core.menu.load.back:setRoundness(5,5,360)
core.menu.load.back:OnEnter(function(self)
self:addDominance()
end)
core.menu.load.back:OnExit(function(self)
self:removeDominance()
end)
core.menu.load.back:OnReleased(function(b,self)
core.menu.load.Visible = false
self:removeDominance()
end)
play:OnReleased(function(b,self)
multi:newThread("FadeOut",function()
for i=100,0,-1 do
thread.sleep(.01)
menu_BG:setVolume(i/100)
end
menu_BG:stop()
core.menu.Visible = false
end)
end)
core.menu.load.down:OnReleased(function(b,self)
local c = core.menu.load.games:getChildren()
if #c==0 then return end
core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y-100)
core.menu.load.up.Visible = true
if c[#c].y+200<=680 then
self.Visible = false
love.mouse.setCursor(_GuiPro.CursorN)
end
end)
core.menu.load.up:OnReleased(function(b,self)
local c = core.menu.load.games:getChildren()
core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y+100)
core.menu.load.down.Visible = true
if core.menu.load.games.offset.pos.y>=0 then
core.menu.load.games:setDualDim(nil,0)
self.Visible = false
love.mouse.setCursor(_GuiPro.CursorN)
end
end)
gui.massMutate({--fonts/PWRectangular.ttf
[[setNewFont(76,"fonts/Angeline.ttf")]],
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
Tween = -70,
TextColor = Color.Lighten(Color.Yellow,.05),
DefualtColor = Color.Lighten(Color.Yellow,.05),
Color = Color.Black,
},play,settings,load,quit)
core.menu.load.back:setNewFont(36,"fonts/PWRectangular.ttf")
core.menu.load.back.Tween=-4
crossRef = {}
localMax = 0
localcount = 0
jQueue.OnJobCompleted(function(JOBID,n)
print(JOBID,n)
crossRef[JOBID].ImageHolder:SetImage(n,JOBID)
localcount=localcount+1
if localcount==localMax then
crossRef = {}
localMax = 0
localcount = 0
end
end)
function loadSaves()
local files = love.filesystem.getDirectoryItems("savedData")
core.menu.load.games.Children={}
localMax = #files
for i=#files,1,-1 do
local temp = core.menu.load.games:newFrame(0,0,300,200)
temp.ImageHolder = temp:newImageLabel(nil,0,0,0,0,0,0,1,1)
local jobid = jQueue:pushJob("LoadImage","savedData/"..files[i].."/screen.png")
crossRef[jobid]=temp
local txt = temp:newTextLabel(files[i],0,0,0,30,0,0,1)
txt.Color = Color.Black
txt.TextColor = Color.White
local data = bin.load("savedData/"..files[i].."/savedata.dat")
temp.state = data:getBlock("t")
if temp.state.variables.user then
txt.text = temp.state.variables.user..": "..txt.text
end
temp.state.pos = temp.state.pos-1
print(files[i])
temp.BG = (data:getBlock("s",128) or ""):match("(.+)\0")
temp:OnReleased(function(b,self)
menu_BG:stop()
test:injectState(self.state)
local name = self.state.name
BGStop()
if name == "LOBBY" then
class_BG:play()
elseif name == "HOUSE" then
house_BG:play()
elseif name == "SCHOOL" then
school_BG:play()
elseif name == "PARK" then
park_BG:play()
elseif name == "AQUARIUM" then
aqua_BG:play()
elseif name == "STORE" then
store_BG:play()
elseif name == "END" then
credits_BG:play()
end
core:SetImage(self.BG)
core.menu.Visible = false
if igmenu.Visible then
multi:newThread("StateLoading-Thread",function()
thread.sleep(.1)
igmenu.Visible = false
_inputvar = ""
multi:newAlarm(.1):OnRing(function(alarm)
alarm:Destroy()
menuready = true
end)
core.menu.load:setParent(core.menu)
core.igmenu.Visible = false
core.igmenu:removeDominance()
core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1)
top:removeDominance()
end)
end
end)
end
end
local loadgame = Tbar:newTextLabel("Load",20,20,100,50)
local deletegame = loadgame:newTextLabel("Delete",20,0,150,50,1)
core.menu.load.games:OnUpdate(function(self)
local c = self:getChildren()
for i=1,#c do
local x,y = InGridX(i,core.menu.load.width,200,350,240)
c[i]:setDualDim(x+75,y+100)
end
end)
lowerBg.Visibility=0
core.menu.settings = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1)
core.menu.settings.Color=Color.new(116,99,150)
core.menu.settings.Visible = false
core.menu.settings.back = core.menu.settings:newTextLabel("Back",20,-70,100,50,0,1)
core.menu.settings.back:setRoundness(5,5,360)
core.menu.settings.back:OnReleased(function(self)
core.menu.settings.Visible = false
end)
core.menu.quit = gui:newFrame(0,0,0,0,0,0,1,1)
core.menu.quit.Visible = false
core.menu.quit.Visibility = 0
local qu = core.menu.quit:newFrame(0,0,300,200)
qu:centerX()
qu:centerY()
qu:setRoundness(15,15,360)
qu.Color=Color.Black
qu.BorderColor = Color.Lighten(Color.Yellow,.05)
local msg = qu:newTextLabel("Are You Sure",20,20,-40,60,0,0,1)
local yes = qu:newTextLabel("Yes",20,-80,100,60,0,1)
local no = qu:newTextLabel("No",-120,-80,100,60,1,1)
msg.TextColor = Color.Lighten(Color.Yellow,.05),
msg:setNewFont(48,"fonts/Angeline.ttf")
msg.Visibility = 0
msg.Tween = -68
gui.massMutate({
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(32,"fonts/Angeline.ttf")]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Visibility = 0,
Tween = -38
},yes,no,core.menu.load.back,core.menu.settings.back,loadgame,deletegame)
loadgame.Visibility = 1
loadgame.Color = Color.Black
loadgame:setRoundness(5,5,360)
deletegame.Visibility = 1
deletegame.Color = Color.Black
deletegame:setRoundness(5,5,360)
core.menu.load.back.Visibility = 1
core.menu.load.back.Color = Color.Black
core.menu.settings.back.Visibility = 1
core.menu.settings.back.Color = Color.Black
yes:OnReleased(function(self)
love.event.quit()
end)
no:OnReleased(function(self)
core.menu.quit.Visible = false
core.menu.quit:removeDominance()
end)
multi:newThread("Menu-Background",function()
local count = 1
while true do
thread.hold(function() return core.menu.Visible==true and (core.menu.load.Visible==false) end) -- if the menu is active do this if not wait till it is
lowerBg:SetImage("images/"..({"Park","aqua","home","store","classroomafterhours"})[count]..".png")
for i = 1,1000 do
thread.sleep(.001) -- hehe a bit of a hack
upperBg.Visibility = (1000-i)/1000
end
for i = 1000,1,-1 do
thread.sleep(.001) -- hehe a bit of a hack
upperBg.Visibility = (1000-i)/1000
end
count = count + 1
if count > 5 then
count=1
end
end
end)
---------------------------------
--~ settings
evntA = multi:newEvent(function()
return core.menu.settings.Visible==true
end)
evntA:OnEvent(function()
evntB:Reset()
end)
evntB = multi:newEvent(function()
return core.menu.settings.Visible==false
end)
evntB:Pause()
evntB:OnEvent(function()
print("Saving settings!")
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
evntA:Reset()
end)
local title = core.menu.settings:newTextLabel("Settings",0,0,0,100,0,0,1)
title:setNewFont(72,"fonts/Angeline.ttf")
title.Tween = -72
title.Visibility = 0
title.TextColor = Color.Darken(Color.White,.15)
local Volume=core.menu.settings:newFrame(0,0,400,130)
local vol = Volume:newTextLabel("Volume",0,0,200,60)
local mute = Volume:newTextLabel("Mute",0,60,200,60)
local vv = vol.Font:getWidth("Volume")
local slidebar = Volume:newFrame(-200,10,200,60,1)
Volume.Visibility = 0
slidebar.Visibility=0
slidebar.display=slidebar:newTextLabel("100%",0,0,40,20)
slidebar.display:centerX()
slidebar.display.Tween=-3
slidebar.display.Visibility = 0
slidebar.display.TextColor = Color.Darken(Color.White,.15)
slidebar:setNewFont(20,"fonts/Angeline.ttf")
slidebar.left=slidebar:newFrame(0,0,10,0,0,0,0,1)
slidebar.bar=slidebar:newFrame(10,0,-20,10,0,0,1)
slidebar.bar:centerY()
slidebar.bar:OnClicked(function(b,self,x,y,xx,yy)
slidebar.move:setDualDim(x-10)
if slidebar.move.offset.pos.x<0 then
slidebar.move:setDualDim(0)
elseif slidebar.move.offset.pos.x>160 then
slidebar.move:setDualDim(160)
end
love.mouse.setY(slidebar.move.y+10)
end)
slidebar.right=slidebar:newFrame(-10,0,10,0,1,0,0,1)
slidebar.move=slidebar.bar:newFrame(80,0,20,20,0,0,0)
slidebar.move:centerY()
slidebar.move:OnUpdate(function()
slidebar.display.text=math.ceil((slidebar.move.offset.pos.x/160)*100) .."%"
Settings.Volume=math.ceil((slidebar.move.offset.pos.x/160)*100)
love.audio.setVolume(Settings.Volume/100)
end)
Volume.muter=Volume:newImageLabel("images/unchecked.png",-190,80,40,40,1)
Volume.muter:OnReleased(function(b,self)
if Settings.mute then
self:SetImage("images/unchecked.png")
Settings.mute = false
love.audio.resume()
else
self:SetImage("images/checked.png")
Settings.mute = true
love.audio.pause()
end
end)
gui.massMutate({
[[setRoundness(5,5,60)]],
Color=Color.Saddle_brown
},slidebar.move,slidebar.right,slidebar.left)
slidebar.move.Color = Color.Lighten(Color.Saddle_brown,.20)
slidebar.bar.Color=Color.Saddle_brown
local asave=Volume:newTextLabel("Autosave",0,0,200,60,0,1)
asaveC=asave:newImageLabel("images/checked.png",10,15,40,40,1)
asaveC:OnReleased(function(b,self)
if Settings.auto_save then
self:SetImage("images/unchecked.png")
Settings.auto_save = false
else
self:SetImage("images/checked.png")
Settings.auto_save = true
end
end)
local aprogress=asave:newTextLabel("Auto Progress",0,0,300,60,0,1)
aprogressC=aprogress:newImageLabel("images/unchecked.png",10,20,40,40,1)
aprogressC:OnReleased(function(b,self)
if Settings.auto_progress then
self:SetImage("images/unchecked.png")
Settings.auto_progress = false
else
self:SetImage("images/checked.png")
Settings.auto_progress = true
end
end)
local tspeed=aprogress:newTextLabel("Text Speed",0,10,200,60,0,1)
speed = tspeed:newFrame(0,0,500,60,1)
speed.Visibility = 0
S_slow = speed:newTextLabel("Slow",0,0,0,0,0,0,1/3,1)
S_Med = speed:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1)
S_Fast = speed:newTextLabel("Fast",0,0,0,0,2/3,0,1/3,1)
S_slow:OnReleased(function(b,self)
Settings.Text_speed = 1
self.Visibility = 1
S_Med.Visibility = 0
S_Fast.Visibility = 0
end)
S_Med:OnReleased(function(b,self)
Settings.Text_speed = 2
self.Visibility = 1
S_slow.Visibility = 0
S_Fast.Visibility = 0
end)
S_Fast:OnReleased(function(b,self)
Settings.Text_speed = 3
self.Visibility = 1
S_Med.Visibility = 0
S_slow.Visibility = 0
end)
local fontsize=tspeed:newTextLabel("Font Size",0,10,200,60,0,1)
fonts = fontsize:newFrame(0,0,500,60,1)
fonts.Visibility = 0
S_slow2 = fonts:newTextLabel("Small",0,0,0,0,0,0,1/3,1)
S_Med2 = fonts:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1)
S_Fast2 = fonts:newTextLabel("Large",0,0,0,0,2/3,0,1/3,1)
S_slow2:OnReleased(function(b,self)
Settings.Font_Size = 1
self.Visibility = 1
S_Med2.Visibility = 0
S_Fast2.Visibility = 0
core.chatFrame.textHolder:setNewFont(16)
end)
S_Med2:OnReleased(function(b,self)
Settings.Font_Size = 2
self.Visibility = 1
S_slow2.Visibility = 0
S_Fast2.Visibility = 0
core.chatFrame.textHolder:setNewFont(20)
end)
S_Fast2:OnReleased(function(b,self)
Settings.Font_Size = 3
self.Visibility = 1
S_Med2.Visibility = 0
S_slow2.Visibility = 0
core.chatFrame.textHolder:setNewFont(28)
end)
gui.massMutate({
TextColor = Color.Darken(Color.White,.15),
Visibility = 0,
[[setNewFont(48,"fonts/Angeline.ttf")]],
Tween = -60
},vol,mute,asave,aprogress,tspeed,fontsize)
gui.massMutate({
[[OnEnter(function(self)
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
[[setRoundness(10,10,360)]],
TextColor = Color.Darken(Color.White,.15),
Visibility = 0,
Color=Color.Saddle_brown,
DefualtColor = Color.Darken(Color.White,.15),
[[setNewFont(24,"fonts/Angeline.ttf")]],
Tween = -15
},S_slow,S_Med,S_Fast,S_slow2,S_Med2,S_Fast2)
S_Med.Visibility = 1
S_Med2.Visibility = 1
loadgame.Visibility = 1
if bin.fileExists("Settings.dat") then
local set = bin.loadS("Settings.dat")
Settings={}
local function LoadSettings()
print("Loading Settings...")
Settings.Volume = set:getBlock("n",1)
Settings.mute = set:getBlock("b")
Settings.auto_save = set:getBlock("b")
Settings.auto_progress = set:getBlock("b")
Settings.Text_speed = set:getBlock("n",1)
Settings.Font_Size = set:getBlock("n",1)
if Settings.Text_speed==1 then
S_slow.Visibility = 1
S_Med.Visibility = 0
elseif Settings.Text_speed==3 then
S_Fast.Visibility = 1
S_Med.Visibility = 0
end
if Settings.Font_Size==1 then
S_slow2.Visibility = 1
S_Med2.Visibility = 0
core.chatFrame.textHolder:setNewFont(16,"fonts/zekton rg.ttf")
elseif Settings.Font_Size==3 then
S_Fast2.Visibility = 1
S_Med2.Visibility = 0
core.chatFrame.textHolder:setNewFont(28,"fonts/zekton rg.ttf")
end
if Settings.auto_progress then
aprogressC:SetImage("images/checked.png")
end
if not Settings.auto_save then
asaveC:SetImage("images/unchecked.png")
end
if Settings.mute then
Volume.muter:SetImage("images/checked.png")
end
slidebar.move:setDualDim((Settings.Volume/100)*160)
love.audio.setVolume(Settings.Volume/100)
print("Success!")
end
status, err = pcall(LoadSettings)
if not status then
Settings={}
print("Setting data is currupt! Restoring defualts!")
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
end
else --
Settings={
Volume = 50,
mute = false,
auto_save = true,
auto_progress = false,
Text_speed = 2,
Font_Size = 2
}
local set = bin.new()
set:addBlock(Settings.Volume,1)
set:addBlock(Settings.mute,1)
set:addBlock(Settings.auto_save,1)
set:addBlock(Settings.auto_progress,1)
set:addBlock(Settings.Text_speed,1)
set:addBlock(Settings.Font_Size,1)
set:tofileS("Settings.dat")
end
local x,y = Volume:getFullSize()
Volume:setDualDim(nil,-y,nil,nil,nil,.35)

2
game/minigames.lua Normal file
View File

@ -0,0 +1,2 @@
require("store")
--digital.otf

View File

@ -23,57 +23,10 @@ SOFTWARE.
]] ]]
require("multi") require("multi")
os.sleep=love.timer.sleep os.sleep=love.timer.sleep
function love.run()
if love.math then
love.math.setRandomSeed(os.time())
end
if love.event then
love.event.pump()
end
if love.load then love.load(arg) end
if love.timer then love.timer.step() end
local dt = 0
while true do
-- Process events.
if love.event then
love.event.pump()
for e,a,b,c,d in love.event.poll() do
if e == "quit" then
if not love.quit or not love.quit() then
if love.audio then
love.audio.stop()
end
return
end
end
love.handlers[e](a,b,c,d)
end
end
if love.timer then
love.timer.step()
dt = love.timer.getDelta()
end
if love.update then love.update(dt) end
if multi.boost then
for i=1,multi.boost-1 do
multi:uManager(dt)
end
end
multi:uManager(dt)
if love.window and love.graphics and love.window.isCreated() then
love.graphics.clear()
love.graphics.origin()
if love.draw then love.draw() end
multi.dManager()
love.graphics.setColor(255,255,255,255)
if multi.draw then multi.draw() end
love.graphics.present()
end
end
end
multi.drawF={} multi.drawF={}
function multi:dManager() function multi.dManager()
for ii=1,#multi.drawF do for ii=1,#multi.drawF do
love.graphics.setColor(255,255,255,255)
multi.drawF[ii]() multi.drawF[ii]()
end end
end end
@ -81,34 +34,34 @@ function multi:onDraw(func,i)
i=i or 1 i=i or 1
table.insert(self.drawF,i,func) table.insert(self.drawF,i,func)
end end
function multi:lManager() --~ function multi:lManager()
if love.event then --~ if love.event then
love.event.pump() --~ love.event.pump()
for e,a,b,c,d in love.event.poll() do --~ for e,a,b,c,d in love.event.poll() do
if e == "quit" then --~ if e == "quit" then
if not love.quit or not love.quit() then --~ if not love.quit or not love.quit() then
if love.audio then --~ if love.audio then
love.audio.stop() --~ love.audio.stop()
end --~ end
return nil --~ return nil
end --~ end
end --~ end
love.handlers[e](a,b,c,d) --~ love.handlers[e](a,b,c,d)
end --~ end
end --~ end
if love.timer then --~ if love.timer then
love.timer.step() --~ love.timer.step()
dt = love.timer.getDelta() --~ dt = love.timer.getDelta()
end --~ end
if love.update then love.update(dt) end --~ if love.update then love.update(dt) end
multi:uManager(dt) --~ multi:uManager(dt)
if love.window and love.graphics and love.window.isCreated() then --~ if love.window and love.graphics and love.window.isCreated() then
love.graphics.clear() --~ love.graphics.clear()
love.graphics.origin() --~ love.graphics.origin()
if love.draw then love.draw() end --~ if love.draw then love.draw() end
multi.dManager() --~ multi.dManager()
love.graphics.setColor(255,255,255,255) --~ love.graphics.setColor(255,255,255,255)
if multi.draw then multi.draw() end --~ if multi.draw then multi.draw() end
love.graphics.present() --~ love.graphics.present()
end --~ end
end --~ end

View File

@ -605,16 +605,8 @@ function multi:hold(task)
local env=self.Parent:newEvent(task) local env=self.Parent:newEvent(task)
env:OnEvent(function(envt) envt:Pause() envt.Active=false end) env:OnEvent(function(envt) envt:Pause() envt.Active=false end)
while env.Active do while env.Active do
if love then
if love.graphics then
self.Parent:lManager()
else
self.Parent:Do_Order() self.Parent:Do_Order()
end end
else
self.Parent:Do_Order()
end
end
env:Destroy() env:Destroy()
self:Resume() self:Resume()
self.held=false self.held=false
@ -1464,7 +1456,9 @@ function thread.sleep(n)
coroutine.yield({"_sleep_",n or 0}) coroutine.yield({"_sleep_",n or 0})
end end
function thread.hold(n) function thread.hold(n)
if n then if n() then return false end end
coroutine.yield({"_hold_",n or function() return true end}) coroutine.yield({"_hold_",n or function() return true end})
return true
end end
function thread.skip(n) function thread.skip(n)
coroutine.yield({"_skip_",n or 0}) coroutine.yield({"_skip_",n or 0})
@ -1992,7 +1986,7 @@ function multi:newThreadedLoop(name,func)
thread.sleep(c.restRate) -- rest a bit more when a thread is paused thread.sleep(c.restRate) -- rest a bit more when a thread is paused
else else
for i=1,#c.func do for i=1,#c.func do
c.func[i](os.clock()-self.Start,c) c.func[i](c,os.clock()-self.Start)
end end
thread.sleep(c.updaterate) -- lets rest a bit thread.sleep(c.updaterate) -- lets rest a bit
end end

View File

@ -9,11 +9,12 @@ multi.integration={}
multi.integration.love2d={} multi.integration.love2d={}
multi.integration.love2d.ThreadBase=[[ multi.integration.love2d.ThreadBase=[[
tab={...} tab={...}
__THREADID__=table.remove(1,tab) __THREADID__=table.remove(tab,1)
__THREADNAME__=table.remove(1,tab) __THREADNAME__=table.remove(tab,1)
require("love.filesystem") require("love.filesystem")
require("love.system") require("love.system")
require("love.timer") require("love.timer")
require("love.image")
require("multi") require("multi")
GLOBAL={} GLOBAL={}
setmetatable(GLOBAL,{ setmetatable(GLOBAL,{
@ -34,7 +35,7 @@ setmetatable(GLOBAL,{
function __sync__() function __sync__()
local data=__mythread__:pop() local data=__mythread__:pop()
while data do while data do
love.timer.sleep(.001) love.timer.sleep(.01)
if type(data)=="string" then if type(data)=="string" then
local cmd,tp,name,d=data:match("(%S-) (%S-) (%S-) (.+)") local cmd,tp,name,d=data:match("(%S-) (%S-) (%S-) (.+)")
if name=="__DIEPLZ"..__THREADID__.."__" then if name=="__DIEPLZ"..__THREADID__.."__" then
@ -158,14 +159,6 @@ end
function sThread.hold(n) function sThread.hold(n)
repeat __sync__() until n() repeat __sync__() until n()
end end
multi:newLoop(function(self)
self:Pause()
local ld=multi:getLoad()
self:Resume()
if ld<80 then
love.timer.sleep(.01)
end
end)
updater=multi:newUpdater() updater=multi:newUpdater()
updater:OnUpdate(__sync__) updater:OnUpdate(__sync__)
func=loadDump([=[INSERT_USER_CODE]=])(unpack(tab)) func=loadDump([=[INSERT_USER_CODE]=])(unpack(tab))

View File

@ -37,19 +37,62 @@ function multi:newSystemThreadedQueue(name) -- in love2d this will spawn a chann
function c:init() -- create an init function so we can mimic on bith love2d and lanes function c:init() -- create an init function so we can mimic on bith love2d and lanes
self.chan=love.thread.getChannel(self.name) -- create channel by the name self.name self.chan=love.thread.getChannel(self.name) -- create channel by the name self.name
function self:push(v) -- push to the channel function self:push(v) -- push to the channel
self.chan:push({type(v),resolveData(v)}) local tab
if type(v)=="table" then
tab = {}
for i,c in pairs(v) do
if type(c)=="function" then
tab[i]="\1"..string.dump(c)
else
tab[i]=c
end
end
self.chan:push(tab)
else
self.chan:push(c)
end
end end
function self:pop() -- pop from the channel function self:pop() -- pop from the channel
local tab=self.chan:pop() local v=self.chan:pop()
--print(tab) if not v then return end
if not tab then return end if type(v)=="table" then
return resolveType(tab[1],tab[2]) tab = {}
for i,c in pairs(v) do
if type(c)=="string" then
if c:sub(1,1)=="\1" then
tab[i]=loadstring(c:sub(2,-1))
else
tab[i]=c
end
else
tab[i]=c
end
end
return tab
else
return self.chan:pop()
end
end end
function self:peek() function self:peek()
local tab=self.chan:peek() local v=self.chan:peek()
--print(tab) if not v then return end
if not tab then return end if type(v)=="table" then
return resolveType(tab[1],tab[2]) tab = {}
for i,c in pairs(v) do
if type(c)=="string" then
if c:sub(1,1)=="\1" then
tab[i]=loadstring(c:sub(2,-1))
else
tab[i]=c
end
else
tab[i]=c
end
end
return tab
else
return self.chan:pop()
end
end end
GLOBAL[self.name]=self -- send the object to the thread through the global interface GLOBAL[self.name]=self -- send the object to the thread through the global interface
return self -- return the object return self -- return the object
@ -221,6 +264,7 @@ function multi:newSystemThreadedJobQueue(numOfCores)
function c:pushJob(name,...) function c:pushJob(name,...)
self.queueOUT:push({self.jobnum,name,...}) self.queueOUT:push({self.jobnum,name,...})
self.jobnum=self.jobnum+1 self.jobnum=self.jobnum+1
return self.jobnum-1
end end
local GLOBAL=multi.integration.GLOBAL -- set up locals incase we are using lanes local GLOBAL=multi.integration.GLOBAL -- set up locals incase we are using lanes
local sThread=multi.integration.THREAD -- set up locals incase we are using lanes local sThread=multi.integration.THREAD -- set up locals incase we are using lanes

View File

@ -40,6 +40,9 @@ end
function parseManager:defualtENV() function parseManager:defualtENV()
self:setENV(self.mainENV) self:setENV(self.mainENV)
end end
function parseManager:exposeNamespace(name,ref)
self.mainENV[name]=ref
end
function parseManager:load(path,c) function parseManager:load(path,c)
local c = c local c = c
if not c then if not c then
@ -75,7 +78,6 @@ function parseManager:load(path,c)
file.data=file.data:gsub("\2","//") file.data=file.data:gsub("\2","//")
file.data=file.data:gsub("\t","") file.data=file.data:gsub("\t","")
file:trim() file:trim()
print(file.data)
for fn in file:gmatch("LOAD (.-)\n") do for fn in file:gmatch("LOAD (.-)\n") do
debug("L",fn) debug("L",fn)
self:load(fn,c) self:load(fn,c)
@ -111,6 +113,15 @@ function parseManager:load(path,c)
--c.chunks=readonlytable(c.chunks) --c.chunks=readonlytable(c.chunks)
return c return c
end end
function parseManager:extractState()
return {name=self.currentChunk.name,pos = self.currentChunk.pos,variables = self.mainENV,cc = self.currentENV}
end
function parseManager:injectState(tbl)
self.chunks[tbl.name].pos=tbl.pos
self.currentChunk=self.chunks[tbl.name]
self.mainENV = tbl.variables
self.currentENV = tbl.cc
end
function parseManager.split(s,pat) function parseManager.split(s,pat)
local pat=pat or "," local pat=pat or ","
local res = {} local res = {}
@ -217,7 +228,7 @@ function parseManager:dump()
met[#met+1]=v[k][i][2].Func met[#met+1]=v[k][i][2].Func
args[#args+1]=concat(v[k][i][2].args," ") args[#args+1]=concat(v[k][i][2].args," ")
end end
str=str.."\tCHOICE["..v[k].prompt.."]$C<"..concat(opt,", ")..">$F<"..concat(met,", ")..">$A<"..concat(args,", ")..">" str=str.."\tCHOICE["..v[k].prompt.."]$C<"..concat(opt,", ")..">$F<"..concat(met,", ")..">$A<"..concat(args,", ")..">\n"
elseif v[k].Type=="text" then elseif v[k].Type=="text" then
str=str.."\tDISP_MSG \""..v[k].text.."\"\n" str=str.."\tDISP_MSG \""..v[k].text.."\"\n"
elseif v[k].Type=="assign" then elseif v[k].Type=="assign" then
@ -335,6 +346,7 @@ function parseManager:compileAssign(assignA,assignB,name)
assign.vals[#assign.vals+1]={} assign.vals[#assign.vals+1]={}
else else
assign.vals[#assign.vals+1]=pieceList(listB[k]:sub(2,-2),self,name) assign.vals[#assign.vals+1]=pieceList(listB[k]:sub(2,-2),self,name)
table.print(assign.vals[#assign.vals])
end end
elseif listB[k]:match("[%w_]-%[.-%]") then elseif listB[k]:match("[%w_]-%[.-%]") then
local dict,sym=listB[k]:match("([%w_]-)%[(.-)%]") local dict,sym=listB[k]:match("([%w_]-)%[(.-)%]")
@ -356,7 +368,7 @@ function parseManager:compileAssign(assignA,assignB,name)
assign.vals[#assign.vals+1]=false assign.vals[#assign.vals+1]=false
elseif listB[k]:match("[%w_]+")==listB[k] then elseif listB[k]:match("[%w_]+")==listB[k] then
assign.vals[#assign.vals+1]="\1"..listB[k] assign.vals[#assign.vals+1]="\1"..listB[k]
elseif listB[k]:match("[_%w%+%-/%*%^%(%)%%]+") then elseif listB[k]:match("[_%w%+%-/%*%^%(%)%%]+")==listB[k] then
mathTest=true mathTest=true
self:compileExpr(listA[k],listB[k],name) self:compileExpr(listA[k],listB[k],name)
else else
@ -364,8 +376,11 @@ function parseManager:compileAssign(assignA,assignB,name)
end end
if not mathTest then if not mathTest then
assign.vars[#assign.vars+1]=pieceAssign(listA[k],self,name) assign.vars[#assign.vars+1]=pieceAssign(listA[k],self,name)
else
print("FUCK!!!!!!!!!!!")
end end
end end
table.print(assign)
table.insert(self.chunks[name],assign) table.insert(self.chunks[name],assign)
end end
function parseManager:compileCondition(condition,iff,elsee,name) function parseManager:compileCondition(condition,iff,elsee,name)
@ -652,7 +667,7 @@ function parseManager:compile(name,ctype,data)
for i=1,#data do for i=1,#data do
data[i]=trim1(data[i]) data[i]=trim1(data[i])
if data[i]~="" then if data[i]~="" then
if data[i]:match(".-<%s*") then if data[i]:match(".-\"<%s*") then
choiceBlock=true choiceBlock=true
choice={} choice={}
j=0 j=0
@ -669,6 +684,7 @@ function parseManager:compile(name,ctype,data)
j=1 j=1
else else
local a,b=dat:match("\"(.-)\"%s*(.+)") local a,b=dat:match("\"(.-)\"%s*(.+)")
if b then
local f,ag=b:match("^([%w_]+)%s*%((.*)%)") local f,ag=b:match("^([%w_]+)%s*%((.*)%)")
if ag~="" then if ag~="" then
choice[#choice+1]={a,{ choice[#choice+1]={a,{
@ -685,6 +701,7 @@ function parseManager:compile(name,ctype,data)
end end
end end
end end
end
else else
local cmd={} local cmd={}
local Return,RETArgs=data[i]:match("(return)%s*(.*)$") local Return,RETArgs=data[i]:match("(return)%s*(.*)$")
@ -953,10 +970,10 @@ function parseManager:next(block,choice)
self.choiceData=data self.choiceData=data
local CList={} local CList={}
for i=1,#data do for i=1,#data do
CList[#CList+1]=data[i][1] CList[#CList+1]=self:parseHeader(data[i][1])
end end
self.lastCall=nil self.lastCall=nil
return {Type="choice",prompt=data.prompt,CList} return {Type="choice",prompt=self:parseHeader(data.prompt),CList}
elseif data.Type=="assign" then elseif data.Type=="assign" then
self:pairAssign(data.vars,data.vals) self:pairAssign(data.vars,data.vals)
self.lastCall=nil self.lastCall=nil

BIN
game/savetest.dat Normal file

Binary file not shown.

247
game/store.lua Normal file
View File

@ -0,0 +1,247 @@
core.game.Visible = false
core.game.store=core.game:newFullFrame()
core.game.store.Visible = false
core.game.store.Visibility = 0
core.game.Visibility = 0
local maingame = core.game.store:newFrame(0,0,0,0,.2,.3,.58,.4)
maingame.Visibility = 0
face = maingame:newImageLabel("images/neutral.png",0,0,0,0,.05,.1,.35,.8)
ChoiceA = maingame:newTextLabel("This",0,0,0,0,.5,.1,.5,.3)
ChoiceB = maingame:newTextLabel("That",0,0,0,0,.5,.6,.5,.3)
ChoiceA.Correct = false
items = {
"Milk",
"Cheese",
"Pepper",
"Salt",
"Orange Juice",
"Chicken",
"Cookies",
"Popcorn",
"Candy",
"Ice Cream",
"Frozen Pizzas",
"Turkey",
"Salmon",
"Pasta",
"Rice",
"Tomato sauce",
"Mustard",
"Barbecue sauce",
"Salsa",
"Olive oil",
"Hot sauce",
"Cereal",
"Tuna",
"Frozen shrimp",
"Butter",
"Crackers",
"Nuts",
"Peanut butter",
"Chocolate",
"Apples",
"Broccoli",
"Sparkling water"
}
numCorrect = 0
total = 0
names={"Liam","William","Mason","James","Benjamin","Jacob","Michael","Noah"}
function GetRandom()
if #items <= 1 then return end
return table.remove(items,math.random(1,#items)),table.remove(items,math.random(1,#items))
end
goo=true
function Progress(cho,cc)
if not cho then
goo=true
PushText("Jake: Don't worry I know you got this! People will come into the store and all you have to do is give them what they want. Good Luck!",function()
goo=true
PushText(test.mainENV["user"]..": Alright I think I got this!",mainLooper)
end)
else
total=total+1
if cc then
multi:newThread("meh",function()
goo2=true
PushText2("Jake: Great job thats exactly what he wanted!",function() LETSDOIT=true end)
thread.sleep(1)
numCorrect=numCorrect+1
thread.hold(function() return LETSDOIT end)
LETSDOIT=false
goo=true
end)
else
multi:newThread("meh",function()
goo2=true
PushText2("Jake: Um that's the wrong item... Sorry about that sir!",function()
thread.sleep(1)
goo2=true
PushText2(test.mainENV["user"]..": Opps sorry about that...!",function() thread.sleep(1) LETSDOIT=true end)
end)
thread.hold(function() return LETSDOIT end)
LETSDOIT=false
goo=true
end)
end
end
end
function mainLooper()
a,b=GetRandom()
if not a then
goo=true
if numCorrect/total > .5 then
STORE_CORRECT=true
else
STORE_CORRECT=false
end
core.game.store.Visible = false
else
ChoiceA.text=a
ChoiceB.text=b
c=math.random(1,2)
if c==1 then
ChoiceA.Correct = true
ChoiceB.Correct = false
else
ChoiceB.Correct = true
ChoiceA.Correct = false
end
plzwait=false
PushText(names[math.random(1,#names)]..": Hello I would like...",mainLooper)
end
end
ChoiceA:OnEnter(function(self)
if self.Correct then
face:SetImage("images/smile.png")
else
face:SetImage("images/sad.png")
end
end)
ChoiceA:OnExit(function()
face:SetImage("images/neutral.png")
end)
ChoiceB:OnEnter(function(self)
if self.Correct then
face:SetImage("images/smile.png")
else
face:SetImage("images/sad.png")
end
end)
ChoiceB:OnExit(function()
face:SetImage("images/neutral.png")
end)
plzwait=false
gui.massMutate({
[[OnEnter(function(self)
if not igmenu.Visible then
self.TextColor=Color.Darken(self.TextColor,.35)
menu_sound:play()
end
end)]],
[[OnExit(function(self)
self.TextColor=self.DefualtColor
end)]],
[[OnReleased(function(b,self)
if not plzwait then
Progress(self.text,self.Correct)
plzwait=true
end
end)]],
TextColor = Color.Lighten(Color.Yellow,.05),
[[setNewFont(48,"fonts/zekton rg.ttf")]],
[[setRoundness(10,10,360)]],
DefualtColor = Color.Lighten(Color.Yellow,.05),
Tween = 16,
Color=Color.Black
},ChoiceA,ChoiceB)
function PushText(txt,callback)
core.chatFrame.textHolder.text=""
t={text=txt}
multi:newThread("Store",function()
local temptag = t.text:match("(.-): ")
if temptag then
test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.text = t.text:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
core.chatFrame.textHolder.text=""
for i in t.text:gmatch(".") do
local held = thread.hold(function() return igmenu.Visible == false end)
if held then
enter_pressed = false
button_pressed = false
auto_progressed = false
end
if Settings.Text_speed==1 then
thread.sleep(.1)
elseif Settings.Text_speed==3 then
thread.sleep(.02)
else
thread.sleep(.05)
end
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
end
if Settings.auto_progress and core.chatFrame.textHolder.Visible then
thread.sleep(1)
enter_pressed = true
end
thread.hold(function() return (goo and igmenu.Visible == false) end)
core.chatFrame.textHolder.text=""
goo = false
if callback then
callback()
end
end)
end
function PushText2(txt,callback)
core.chatFrame.textHolder.text=""
t={text=txt}
multi:newThread("Store",function()
local temptag = t.text:match("(.-): ")
if temptag then
test.mainENV["tag"] = temptag
end
if core.chatFrame.textHolder.namepiece.text=="" and test.mainENV["tag"] then
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
if temptag then
t.text = t.text:match(".-: (.+)")
core.chatFrame.textHolder.namepiece.text = test.mainENV["tag"]
core.chatFrame.textHolder.namepiece:widthToTextSize(16)
end
core.chatFrame.textHolder.text=""
for i in t.text:gmatch(".") do
local held = thread.hold(function() return igmenu.Visible == false end)
if held then
enter_pressed = false
button_pressed = false
auto_progressed = false
end
if Settings.Text_speed==1 then
thread.sleep(.1)
elseif Settings.Text_speed==3 then
thread.sleep(.02)
else
thread.sleep(.05)
end
core.chatFrame.textHolder.text=core.chatFrame.textHolder.text..i
end
if Settings.auto_progress and core.chatFrame.textHolder.Visible then
thread.sleep(1)
enter_pressed = true
end
thread.hold(function() return (goo2 and igmenu.Visible == false) end)
goo2 = false
if callback then
callback()
end
end)
end

45
game/test.lua Normal file
View File

@ -0,0 +1,45 @@
package.path = "?/init.lua;"..package.path
--~ require("bin")
--~ dat = bin.load("savetest.dat")
--~ tab = dat:getBlock("t")
--~ print(dat:getBlock("s",128):match("(.+)\0"))
--~ for i,v in pairs(tab) do
--~ print(i,v)
--~ end
--~ function test(path)
--~ print("Doing stuff")
--~ local dat = love.image.newImageData(path)
--~ print("did it")
--~ return dat
--~ end
--~ io.write(string.dump(test))
print("loading lib")
require("multi")
multi.dStepA = 0
multi.dStepB = 0
multi.dSwap = 0
updater = multi:newUpdater(60)
updater:OnUpdate(function(self)
if self.Parent.dSwap == 0 then
self.Parent.dStepA = os.clock()
self.Parent.dSwap = 1
else
self.Parent.dSwap = 0
self.Parent.dStepB = os.clock()
end
end)
function multi:getLoad()
local val = math.abs(self.dStepA-self.dStepB)/updater.skip
return (val)*100
end
multi:newTLoop(function(self)
print(self.Parent:getLoad())
end,.1)
multi:newLoop(function()
local a=0
for i=1,1000000 do
a=a+1
end
end)
print("Started")
multi:mainloop()