DD@DD0D43@DD@LL@DD0D43@N0333DD@DD4D43NDD@DD0D43@@DD@LL@DD4D43NDDDDCDC03@N4333N33C03  / D@@@DDD@DD@D@DPUUPUUPUUUUPPPP @@@@@@D@3333DDD ,""",""",,w,w,w, " " " " " " " ,""",""",,""",""",""",""" " " " " " " <333<333<333<333<333<333<33333333333333333333333333333333333333333333333333333333333 333333333333333333333<333<333<333<333<333<333<33333333333333333333333333333333333333333333333333333333333333333333333333333333<3<3<3<3 E@DD@DDDDDDDD@DD@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@DD@DDDDDDDD@DD@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@DDDD@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@DDD@DDD@D@@D@@DD@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@@D@DDDDDD@D@DD@DDDDDDDDDDDDDDDDDDODDDODDDODDDDDDDDODD@DD@D@DDDDDDDDD@D@D@DDDDDD    ̑    ̈̈̌ ̈ȈȈ ̈ ," "   ȈȈ   ", ^ //////////////////////$%68Iz000007;=>?????????????????????   "#55FHIZ[lm~8 ̙̜ ̙̜̙ ̙̜̙̙̙̜̙̙̜̜̜̜̜̜̜̜̜̜̜̜̜̜̙̜̜̙̜̙̜̙̜̜̙̜ ̜̜ ̜ ̜ ̜̜ ̜ ̜̜ ̜ ̜ ̜̜ ̜ ̜̜̙̜̙̜ ̜̜̙̜ ̜̜̜ ̜ ̜̜̜ ̜ ̜̙̜ ̜ ̜ ̜ ̜ ̜̜̙ ̙̜ ̜̜̙̜ ̜̜ ̜ ̜̜ ̜ ̜̜ ̜ ̜̜ ̜ ̜̜ ̜ ̜̜ ̜̙̜̜ ̜̙̜̜ ̜̜ ̜̜̜ ̜̜ ̜̜̜ ̜̙̜ ̜̙̜ ̜ ̜ ̜̙̜ ̜ 񈈈HDDDDDDDDDDDDDDDDHDDDDDDDHDDDDDDDHDDDDDDDHDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD83ӍDDDDDDDDDDDDDDDDDDDDDDDDDDDD"=DDHDDDDD"DDDD"HDDDDDDD/(=CDDDD)(=ID"(=ID"(="==3"=33"23333 333333333333"33333333333""33333333333""33333333333333333333323333333333332333333333338333333333303333303333330333333""2333""33333""33333""3333"""3333"3(""3(""3"33"33""""""""" ,0,]']>S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3 8 then SkillBarStep = 1 end elseif t % 10.0 ~= 0.0 and SkillBarhasStepped == true then SkillBarhasStepped = false end end -- draws the indicater line line(skillBarPos.centre.x, skillBarPos.centre.y, skillBar.vec.x[SkillBarStep], skillBar.vec.y[SkillBarStep], 3) end function DrawSkillSlider() -- color changed on font when in the check window if skillSliderBoxesPos.selecXpos == SkillBarStep then rectb(skillBarPos.centre.x - 4, skillBarPos.centre.y + 12, 9, 9, 6) print("Z", skillBarPos.centre.x - 2, skillBarPos.centre.y + 14, 6) else rectb(skillBarPos.centre.x - 4, skillBarPos.centre.y + 12, 9, 9, 12) print("Z", skillBarPos.centre.x - 2, skillBarPos.centre.y + 14, 12) end rectb(skillBarPos.centre.x - 13, skillBarPos.centre.y, 27, 6, 2) local steps = #skillSlider.vec.x if skillSlider.successCheckstep < 5 then ---tick actions for skill bar if t % 8.0 == 0.0 and SkillBarhasStepped == false then SkillBarhasStepped = true if SkillBarStep == steps then skillSlider.isReverse = true elseif SkillBarStep == 1 then skillSlider.isReverse = false end if skillSlider.isReverse then SkillBarStep = SkillBarStep - 1 else SkillBarStep = SkillBarStep + 1 end elseif t % 8.0 ~= 0.0 and SkillBarhasStepped == true then SkillBarhasStepped = false end end line(skillSlider.vec.x[SkillBarStep], skillBarPos.centre.y + 1, skillSlider.vec.x[SkillBarStep], skillBarPos.centre.y + 5 - 1, 3) end function SkillSliderBox() if skillSliderBoxesPos.posbeenSelected == false then local xRan = math.random(#skillSliderBoxesPos.vec.x) skillSliderBoxesPos.selecXpos = xRan skillSliderBoxesPos.posbeenSelected = true else DrawSliderSkillBox(skillSliderBoxesPos.selecXpos, skillSliderBoxesPos.vec.y, 3, 4, -1, 1) end end function SkillBox() --Make Skill check box if skillBoxesPos.posbeenSelected == false then local xRan = math.random(#skillBoxesPos.vec.x) local yRan = xRan skillBoxesPos.selecXpos = xRan skillBoxesPos.selecYpos = yRan skillBoxesPos.posbeenSelected = true else DrawSkillBox(skillBoxesPos.selecXpos, skillBoxesPos.selecYpos, 3, 3, 0, 0) end end function DrawSkillBox(_xPos, _yPos, _sizeX, _sizeY, _offsetX, _offsetY) rect(skillBoxesPos.vec.x[_xPos] + _offsetX, skillBoxesPos.vec.y[_yPos] + _offsetY, _sizeX, _sizeY, 5) end function DrawSliderSkillBox(_xPos, _yPos, _sizeX, _sizeY, _offsetX, _offsetY) rect(skillSliderBoxesPos.vec.x[_xPos] + _offsetX, skillSliderBoxesPos.vec.y + _offsetY, _sizeX, _sizeY, 5) end --#endregion --#region SKILLCHECK FUNCTIONS function SuccessStep() -- counts the successful skill checks and moves the sprites and adds to the skill check bar if skillBar.successCheckstep <= 0 then DrawHand(256, 240 // 2 - 40, 136 // 2 - 25, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6) SetBarValue(skillCheckBar, 0) elseif skillBar.successCheckstep == 1 then DrawHand(256, 240 // 2 - 40, 136 // 2 - 12, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6) SetBarValue(skillCheckBar, 6) elseif skillBar.successCheckstep == 2 then DrawHand(256, 240 // 2 - 40, 136 // 2, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6) SetBarValue(skillCheckBar, 12) elseif skillBar.successCheckstep == 3 then DrawHand(260, 240 // 2 - 40, 136 // 2, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6) SetBarValue(skillCheckBar, 18) elseif skillBar.successCheckstep == 4 then DrawHand(260, 240 // 2 - 40, 136 // 2 - 12, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6 - 12) SetBarValue(skillCheckBar, 24) elseif skillBar.successCheckstep >= 5 then DrawHand(260, 240 // 2 - 40, 136 // 2 - 25, cutSceneSpr, 240 // 2 - 40, 136 // 2 + 6 - 25) local p = print("Collected", 240, 136) print("Collected", ((p // 2) + 240 // 2) - 75, 136 // 2 + 20, 6) SetBarValue(skillCheckBar, 30) if player.objHolding ~= nil then Collect(player.objHolding) SfxSkillCheckCollected() end WindowDelay(2) end end function SuccessStepSlider() -- counts the successful skill checks and moves the sprites and adds to the skill check bar if skillSlider.successCheckstep <= 0 then SetBarValue(skillCheckBar, 0) elseif skillSlider.successCheckstep == 1 then SetBarValue(skillCheckBar, 6) elseif skillSlider.successCheckstep == 2 then SetBarValue(skillCheckBar, 12) elseif skillSlider.successCheckstep == 3 then SetBarValue(skillCheckBar, 18) elseif skillSlider.successCheckstep == 4 then SetBarValue(skillCheckBar, 24) elseif skillSlider.successCheckstep >= 5 then SetBarValue(skillCheckBar, 30) --if player.objHolding ~= nil then -- Collect(player.objHolding) WindowDelay(2) end --end end function SuccessCheck() -- check if skill check is in box area for success check if skillBar.successCheckstep < 5 then if skillBoxesPos.selecXpos == SkillBarStep then -- button press here for win check if btnp(4) then skillBar.success = true; SfxSkillCheckGood() skillBoxesPos.posbeenSelected = false; skillBar.successCheckstep = skillBar.successCheckstep + 1 if skillBar.successCheckstep > 5 then skillBar.successCheckstep = 5 end end --print("YES", 240 // 2, 136 // 2, 4, 0, 3) else if btnp(4) then skillBar.fail = true; SfxSkillCheckFail() skillBoxesPos.posbeenSelected = false; skillBar.successCheckstep = skillBar.successCheckstep - 1 if skillBar.successCheckstep < 0 then skillBar.successCheckstep = 0 end end --print("NO", 240 // 2, 136 // 2, 4, 0, 1) end end end function SuccessCheckSlider() -- check if skill check is in box area for success check if skillSlider.successCheckstep < 5 then if skillSliderBoxesPos.selecXpos == SkillBarStep then -- button press here for win check if btnp(4) then skillBar.success = true; SfxSkillCheckGood() skillSliderBoxesPos.posbeenSelected = false; skillSlider.successCheckstep = skillSlider.successCheckstep + 1 if skillSlider.successCheckstep > 5 then skillSlider.successCheckstep = 5 end end --print("YES", 240 // 2, 136 // 2, 4, 0, 3) else if btnp(4) then skillBar.fail = true; SfxSkillCheckFail() skillSliderBoxesPos.posbeenSelected = false; skillSlider.successCheckstep = skillSlider.successCheckstep - 1 if skillSlider.successCheckstep < 0 then skillSlider.successCheckstep = 0 end end --print("NO", 240 // 2, 136 // 2, 4, 0, 1) end end end --#endregion --#region BAR FUNCTIONS ---Skill fill bar --------------------------------------------------------- local BarJoltDelayTimer = 0 function SkillBar() if skillBar.success == true then BarJoltDelayTimer = BarJoltDelayTimer + 1 --makes bar flash green and move up rectb(skillBarPos.centre.x - skillCheckBar.barWidth // 2, skillBarPos.centre.y - 20 - 4, skillCheckBar.barWidth, 6, 12) if BarJoltDelayTimer / 60 % 0.1 == 0.0 then DrawBarFill(skillCheckBar, 6, skillBarPos.centre.x - skillCheckBar.barWidth // 2 + 1, skillBarPos.centre.y - 20 + 1 - 4) else DrawBarFill(skillCheckBar, 5, skillBarPos.centre.x - skillCheckBar.barWidth // 2 + 1, skillBarPos.centre.y - 20 + 1 - 4) end if BarJoltDelayTimer / 60 % 0.3 == 0.0 then skillBar.success = false end elseif skillBar.fail == true then BarJoltDelayTimer = BarJoltDelayTimer + 1 -- makes the bar flash red when fail and move down if BarJoltDelayTimer / 60 % 0.2 == 0.0 then rectb(skillBarPos.centre.x - skillCheckBar.barWidth // 2, skillBarPos.centre.y - 20 + 4, skillCheckBar.barWidth, 6, 12) else rectb(skillBarPos.centre.x - skillCheckBar.barWidth // 2, skillBarPos.centre.y - 20 + 4, skillCheckBar.barWidth, 6, 2) end -- turns fill bar area red DrawBarFill(skillCheckBar, 2, skillBarPos.centre.x - skillCheckBar.barWidth // 2 + 1, skillBarPos.centre.y - 20 + 1 + 4) if BarJoltDelayTimer / 60 % 0.6 == 0.0 then skillBar.fail = false end else BarJoltDelayTimer = 0 rectb(skillBarPos.centre.x - skillCheckBar.barWidth // 2, skillBarPos.centre.y - 20, skillCheckBar.barWidth, 6, 12) DrawBarFill(skillCheckBar, 6, skillBarPos.centre.x - skillCheckBar.barWidth // 2 + 1, skillBarPos.centre.y - 20 + 1) end end -- Dash bar----------------------------------------------------------------- function DashBar() local p = print("Dash = ", 0, 140) print("Dash = ", 0, borderBox.bottom + bordersize + 1, 12) rectb(p, borderBox.bottom + bordersize + 1, dashBar.barWidth, 6, 12) DrawBarFill(dashBar, 10, dashBar.barWidth + 5, borderBox.bottom + bordersize + 2) end ---- housework bar ------------------------------------------------------ function HouseWorkBar() local p = print("HouseWork = ", 0, 140) print("HouseWork = ", 240 - hWBar.barWidth - p, 0, 12) rectb(240 - hWBar.barWidth, 0, hWBar.barWidth, 6, 12) DrawBarFill(hWBar, 2, 240 - hWBar.barWidth + 1, 1) end function SetBarValue(_bar, value) _bar.currentFillValue = value if value >= _bar.maxValue then _bar.currentFillValue = _bar.maxValue end if value <= 0 then _bar.currentFillValue = 0 end end function AddToBar(_bar, value) _bar.currentFillValue = _bar.currentFillValue + value if _bar.currentFillValue >= _bar.maxValue then _bar.currentFillValue = _bar.maxValue if _bar.isfull == false then _bar.isfull = true end end end function MinusBar(_bar, value) _bar.currentFillValue = _bar.currentFillValue - value if _bar.currentFillValue < 0 then _bar.currentFillValue = 0 end if _bar.isfull == true then _bar.isfull = false end end function DrawBarFill(_Bar, _color, _xloc, _yloc) rect(_xloc, _yloc, _Bar.currentFillValue, _Bar.fillThickness, _color) end --#endregion --#region PARTICLES AND ANIM function DrawParticles(_px, _py) if btn(2) then local sPoint = { x = _px + 7, y = _py + 7 } for i = 0, 3, 1 do if i == 3 then i = 4 end pix(sPoint.x + i, sPoint.y, 12) pix(sPoint.x + i, sPoint.y - 7, 12) if i < 2 then pix(sPoint.x + i + 1, sPoint.y - 4, 12) end end elseif btn(3) then local sPoint = { x = _px - 1, y = _py + 7 } for i = 0, 3, 1 do if i == 3 then i = 4 end pix(sPoint.x - i, sPoint.y, 12) pix(sPoint.x - i, sPoint.y - 7, 12) if i < 2 then pix(sPoint.x - i - 1, sPoint.y - 4, 12) end end elseif btn(0) then local sPoint = { x = _px, y = _py + 6 } for i = 0, 3, 1 do if i == 3 then i = 4 end pix(sPoint.x, sPoint.y + i, 12) pix(sPoint.x + 7, sPoint.y + i, 12) if i < 2 then pix(sPoint.x + 4, sPoint.y + i + 1, 12) end end elseif btn(1) then local sPoint = { x = _px, y = _py - 1 } for i = 0, 3, 1 do if i == 3 then i = 4 end pix(sPoint.x, sPoint.y - i, 12) pix(sPoint.x + 7, sPoint.y - i, 12) if i < 2 then pix(sPoint.x + 3, sPoint.y - i - 1, 12) end end end end --#endregion --#region PLAYER FUNCTIONS --- Player Functions----------------------------------------------------- function DrawPlayer() if btn(2) then if t // 6 % 4 == 0 then spr(player.sprite + 3, player.x, player.y, 0, 1, 1) elseif t // 6 % 4 == 1 then spr(player.sprite, player.x, player.y, 0, 1, 1) elseif t // 6 % 4 == 2 then spr(player.sprite + 5, player.x, player.y, 0, 1, 1) elseif t // 6 % 4 == 3 then spr(player.sprite, player.x, player.y, 0, 1, 1) end elseif btn(3) then if t // 6 % 4 == 0 then spr(player.sprite + 3, player.x, player.y, 0) elseif t // 6 % 4 == 1 then spr(player.sprite, player.x, player.y, 0) elseif t // 6 % 4 == 2 then spr(player.sprite + 5, player.x, player.y, 0) elseif t // 6 % 4 == 3 then spr(player.sprite, player.x, player.y, 0) end elseif btn(0) then if t // 6 % 4 == 0 then spr(player.sprite + 8, player.x, player.y, 0) elseif t // 6 % 4 == 1 then spr(player.sprite + 2, player.x, player.y, 0) elseif t // 6 % 4 == 2 then spr(player.sprite + 9, player.x, player.y, 0) elseif t // 6 % 4 == 3 then spr(player.sprite + 2, player.x, player.y, 0) end elseif btn(1) then if t // 6 % 4 == 0 then spr(player.sprite + 7, player.x, player.y, 0) elseif t // 6 % 4 == 1 then spr(player.sprite + 1, player.x, player.y, 0) elseif t // 6 % 4 == 2 then spr(player.sprite + 6, player.x, player.y, 0) elseif t // 6 % 4 == 3 then spr(player.sprite + 1, player.x, player.y, 0) end else spr(player.sprite + 1, player.x, player.y, 0) end end function PlayerMove() Dash() --print(collideWithABox, 10, 10) if isPickUpScene == true or isBrewScene == true then return end --up and down movement if btn(0) and BorderHitMinus(borderBox.top, player.y) == false then -- checks if collided with boxes if collideWithABox == false or player.collide.bottom then player.y = player.y - player.s player.collide.bottom = false else player.collide.top = true player.collide.right = true player.collide.left = true end end if btn(1) and BorderHitPlus(borderBox.bottom, player.y + 8) == false then -- checks if collided with boxes if collideWithABox == false or player.collide.top then player.y = player.y + player.s player.collide.top = false else player.collide.bottom = true player.collide.right = true player.collide.left = true end end -- left and right movement if btn(2) and BorderHitMinus(borderBox.left, player.x) == false then -- checks if collided with boxes if collideWithABox == false or player.collide.right then player.x = player.x - player.s player.collide.right = false else player.collide.left = true player.collide.bottom = true player.collide.top = true end end if btn(3) and BorderHitPlus(borderBox.right, player.x + 8) == false then -- checks if collided with boxes if collideWithABox == false or player.collide.left then player.x = player.x + player.s player.collide.left = false else player.collide.right = true player.collide.bottom = true player.collide.top = true end end end function PlayerHitBox() end -- makes player dash function Dash() --activates the dash action if btnp(6) and dashBar.currentFillValue ~= 0 and isfilling == false then dashed = true end --if the bar is empty this will activate it to start filling up if dashBar.currentFillValue < 30 then isfilling = true end -- fills the bar back up and stops when gets full if isfilling then AddToBar(dashBar, 0.8) if dashBar.currentFillValue == 30 then isfilling = false end end -- when dashed this is executed,,,, dashes and has a delay for next dash. if dashed then if player.dashTimer // 11 < 1 then player.s = 3 player.dashTimer = player.dashTimer + 1 player.dashDelayT = 0 DrawParticles(player.x, player.y) if player.dashTimer < 2 then MinusBar(dashBar, 30) end else player.s = 1 player.dashDelayT = player.dashDelayT + 1 if player.dashDelayT >= 2 then player.dashTimer = 0 dashed = false end end end end function AttemptPickUp(obj) if Collision(player.x, player.y, 8, obj.x, obj.y, 8, 8) then if btnp(4, 60, 6) then if obj.iswork ~= true and player.objHolding == nil then player.objHolding = obj cutSceneSpr = obj.cutscenespr isPickUpScene = true end else if player.objHolding == obj then player.objHolding = nil end end return true end end function InteractPrompt() rectb(player.x - 1, player.y + 15, 9, 9, 6) print("Z", player.x + 1, player.y + 17, 6) end function Collect(obj) if Collision(player.x, player.y, 8, obj.x, obj.y, 8, 8) then obj.collected = true if obj.iswork == true then MinusBar(hWBar, houseworkcost) SfxCollectHW() else local t = { teabag, kettle, cup } for i = 1, #t do if t[i].collected == false then BoxesSpawn() SpawnInTeaItem(t[i]) break end end end end end function DestroyBox(box) local t = { teabag, kettle, cup } -- if tea item is inside then it will draw the item for i = 1, #t do if box.x == t[i].x and box.y == t[i].y then t[i].see = true end end if dashed then if box.isDestroyed == false then SfxBoxSmash() end box.isDestroyed = true end end function CollideWithBox(box) if Collision(player.x, player.y, 8, box.x, box.y, 8, 8) then collideWithABox = true DestroyBox(box) return true end collideWithABox = false return false end -- checks to see is you have approched the brewing table so you dont interact with it every frame function IsAtTable() if Collision(player.x, player.y, 8, workTop.x, workTop.y, workTop.pixsizeX, workTop.pixsizeY) then if btnp(4, 60, 6) then if BrewTablebeenInteracted == false then isBrewScene = true BrewTablebeenInteracted = true end end return true end end ---------------------------------------------------------- --#endregion --#region OBJECT FUNCTIONS AND COLLISIONS function ObjMove(obj) --if hit top border then moves obj down if BorderHitMinus(borderBox.top, obj.y) == true then obj.mDown = true --if hit bottom border then moves obj up elseif BorderHitPlus(borderBox.bottom, obj.y + 8) == true then obj.mDown = false end --if hit right border then moves obj left if BorderHitPlus(borderBox.right, obj.x + 8) == true then obj.mLeft = true ----if hit left border then moves obj right elseif BorderHitMinus(borderBox.left, obj.x) == true then obj.mLeft = false end --if hits an static obj for i = 1, #staticObjs do if HitItemWhileMoving(obj, staticObjs[i], staticObjs[i].pixsizeX, staticObjs[i].pixsizeY) then if obj.mDown == true then obj.mDown = false else obj.mDown = true break end if obj.mLeft == true then obj.mLeft = false else obj.mLeft = true break end end end -- if it hits a box CollideObj(obj, boxes) -- this does the actual movement if obj.mDown == true then obj.y = obj.y + obj.s elseif obj.mDown == false then obj.y = obj.y - obj.s end if obj.mLeft == false then obj.x = obj.x + obj.s / 2 elseif obj.mLeft == true then obj.x = obj.x - obj.s / 2 end end function CollideObj(_thisObj, _oObjs) for i = 1, #_oObjs do if HitItemWhileMoving(_thisObj, _oObjs[i], 8, 8) then if _thisObj.mDown == true then _thisObj.mDown = false else _thisObj.mDown = true break end if _thisObj.mLeft == true then _thisObj.mLeft = false else _thisObj.mLeft = true break end end end end -- sets the object offscreen when called so it cant be seen function ResetObj(_obj) _obj.x = 240 // 2 _obj.y = 140 end ------ collisions--------------------------------------------- function BorderHitPlus(_mo, _so) if _mo <= _so and _mo > _so - 10 then return true else return false end end function BorderHitMinus(_mo, _so) if _mo >= _so and _mo < _so + 10 then return true else return false end end -- collision between px&py and ox&oy with oSize for the pixel width and length for col detection function Collision(px, py, pSize, ox, oy, oSizeX, oSizeY) local hitX = false; local hitY = false; -- left or right side collided? if (px >= ox and px < ox + oSizeX) or (px + pSize > ox and px + pSize < ox + oSizeX) then hitX = true; end -- top and bottom collided? if (py >= oy and py < oy + oSizeY) or (py + pSize > oy and py + pSize < oy + oSizeY) then hitY = true; end --check collision if hitX and hitY then return true else return false end end function HitItemWhileMoving(_mo, _so, _soSizeX, _soSizeY) if Collision(_mo.x, _mo.y, 8, _so.x, _so.y, _soSizeX, _soSizeY) then return true else return false end end --#endregion --#region GAMEOBJECT DRAW FUNCTIONS --- Draw functions---------------------------------------------------------------- function DrawObj(sprite, posX, posY, w, h) spr(sprite, posX, posY, 0, 1, 0, 0, w, h) end function ShakeDraw(time, shakeS, sprite, posX, posY, w, h) if t / 60 % time >= 0 and t / 60 % time <= 0.5 then if t / 60 % shakeS >= 0 and t / 60 % shakeS <= shakeS / 2 then DrawObj(sprite, posX - 1, posY, w, h) else DrawObj(sprite, posX + 1, posY, w, h) end else DrawObj(sprite, posX, posY, w, h) end end function DrawTeaBag() if teabag.see == true then ShakeDraw(5, 0.125, teabag.sprite, teabag.x, teabag.y, 1, 1) end end function DrawKettle() if kettle.see == true then ShakeDraw(5, 0.125, kettle.sprite, kettle.x, kettle.y, 1, 1) end end function DrawCup() if cup.see == true then ShakeDraw(5, 0.125, cup.sprite, cup.x, cup.y, 1, 1) end end function DrawBox(index) if boxes[index].isDestroyed == false then DrawObj(boxes[index].sprite, boxes[index].x, boxes[index].y, 1, 1) --ShakeDraw(.1, 0.125, boxes[index].sprite, boxes[index].x, boxes[index].y, 1, 1) else if boxes[index].animeTimer <= 1 then ShakeDraw(.1, 0.125, boxes[index].sprite + 1, boxes[index].x, boxes[index].y, 1, 1) --DrawObj(boxes[index].sprite + 1, boxes[index].x, boxes[index].y, 1, 1) elseif boxes[index].animeTimer >= 1 and boxes[index].animeTimer <= 2 then ShakeDraw(.1, 0.125, boxes[index].sprite + 2, boxes[index].x, boxes[index].y, 1, 1) --DrawObj(boxes[index].sprite + 2, boxes[index].x, boxes[index].y, 1, 1) elseif boxes[index].animeTimer >= 2 and boxes[index].animeTimer <= 3 then ShakeDraw(.1, 0.125, boxes[index].sprite + 3, boxes[index].x, boxes[index].y, 1, 1) --DrawObj(boxes[index].sprite + 3, boxes[index].x, boxes[index].y, 1, 1) elseif boxes[index].animeTimer >= 4 then boxes[index].x = 240 boxes[index].y = 140 boxes[index].animeTimer = 0 boxes[index].isDestroyed = false end boxes[index].animeTimer = boxes[index].animeTimer + .1666666 end end function DrawWMachine() DrawObj(wMachine.sprite, wMachine.x, wMachine.y, 1, 1) end function DrawLaundry(index) DrawObj(laundrys[index].sprite, laundrys[index].x, laundrys[index].y, 1, 1) end function DrawPost(index) DrawObj(posts[index].sprite, posts[index].x, posts[index].y, 1, 1) end function DrawWashingUp(index) DrawObj(washingUp[index].sprite, washingUp[index].x, washingUp[index].y, 1, 1) end function DrawDoor() DrawObj(postDoor.sprite, postDoor.x, postDoor.y, 2, 2) end function DrawSink() DrawObj(sink.sprite, sink.x, sink.y, 2, 2) end function DrawWorkTop() if cup.collected and kettle.collected and teabag.collected then ShakeDraw(5, 0.125, workTop.sprite, workTop.x, workTop.y, 4, 2) else DrawObj(workTop.sprite, workTop.x, workTop.y, 4, 2) end spr(145, workTop.x, workTop.y + 16, 0, 1, 0, 0, 1, 1) spr(145, workTop.x + 24, workTop.y + 16, 0, 1, 1, 0, 1, 1) end --#endregion --#region WASHING MACHINE FUNCTIONS ---Washing machine functions------------------------------------------------------ function WMachineFire() -- fires out laundry at every spittime if hWBar.isfull == false then if timer % (wMachine.spittime // houseWorkMultiplyer) == 0 then SpitLaundry(wMachine) else wMachine.hasSpit = false end end -- checks at specified time to reset laundry if timer % 20 == 0 then for i = 1, #laundrys do if laundrys[i].collected == true then laundrys[i].collected = false laundrys[i].dropped = false laundrys[i].x = 240 // 2 laundrys[i].y = 140 end end end end function SpitLaundry(_wMachine) local a = 0 while (a < #laundrys) do a = a + 1 if _wMachine.hasSpit == false and laundrys[a].y == 140 then _wMachine.hasSpit = true laundrys[a].x = _wMachine.x laundrys[a].y = _wMachine.y laundrys[a].dropped = true laundrys[a].collected = false AddToBar(hWBar, houseworkcost) SfxHWDrop() break end end end --#endregion --#region POST FUNCTIONS --Post functions ---------------------------------------------------------------------- function PostFire() if hWBar.isfull == false then if timer % (postDoor.spittime // houseWorkMultiplyer) == 0 then SpitPost() else postDoor.hasSpit = false end end -- checks at specified time to reset post if timer % 20 == 0 then for i = 1, #posts do if posts[i].collected == true then posts[i].collected = false posts[i].dropped = false posts[i].x = 240 // 2 posts[i].y = 140 posts[i].moveSteps = 0 end end end end function PostMove() for i = 1, #posts do if posts[i].moveSteps <= posts[i].postDistance.x and posts[i].dropped == true then posts[i].moveSteps = posts[i].moveSteps + 1 if posts[i].moveSteps <= posts[i].postDistance.y then posts[i].y = posts[i].y - 3 end posts[i].x = posts[i].x - 3 end end end function SpitPost() local a = 0 while (a < #posts) do a = a + 1 if postDoor.hasSpit == false and posts[a].y == 140 then postDoor.hasSpit = true posts[a].x = postDoor.x + 2 posts[a].y = postDoor.y + 6 posts[a].dropped = true posts[a].collected = false posts[a].postDistance.x = math.random(9, 60) posts[a].postDistance.y = math.random(0, 10) posts[a].moveSteps = 0 AddToBar(hWBar, houseworkcost) SfxHWDrop() break end end end --#endregion --#region SINK FUNCTIONS ------------Sink functions ----------------------------------------------------------------------------- function CreateWashingUp() if hWBar.isfull == false then if timer % (sink.spittime // houseWorkMultiplyer) == 0 then SpitWashingUp() else sink.hasSpit = false end end if timer % 20 == 0 then for i = 1, #washingUp do if washingUp[i].collected == true then washingUp[i].collected = false washingUp[i].dropped = false washingUp[i].x = 240 // 2 washingUp[i].y = 140 washingUp[i].moveSteps = 0 washingUp[i].sprite = math.random(51, 52) end end end end function WashingUpMove() for i = 1, #washingUp do if washingUp[i].moveSteps <= washingUp[i].postDistance.x and washingUp[i].dropped == true then washingUp[i].moveSteps = washingUp[i].moveSteps + 1 if washingUp[i].moveSteps <= washingUp[i].postDistance.y then washingUp[i].y = washingUp[i].y + 2 end washingUp[i].x = washingUp[i].x + 2 end end end function SpitWashingUp() local a = 0 while (a < #washingUp) do a = a + 1 if sink.hasSpit == false and washingUp[a].y == 140 then sink.hasSpit = true washingUp[a].x = sink.x + 3 + math.random(3) washingUp[a].y = sink.y + 2 + math.random(8) washingUp[a].dropped = true washingUp[a].collected = false washingUp[a].postDistance.x = math.random(5 * 2, 38 * 2) washingUp[a].postDistance.y = math.random(1, 5 * 2) washingUp[a].moveSteps = 0 AddToBar(hWBar, houseworkcost) SfxHWDrop() break end end end --#endregion --#region POPUP WINDOW FUNCTIONS ---------------------------cut Scene------------------------------------------------------ function DrawCutWindow() cutWindowOpenTime = cutWindowOpenTime + 1 local xindent = 239 // 4 local yindent = 136 // 4 rect(0 + xindent, 136 // 2 - yindent, 239 - xindent * 2, 136 - yindent * 2, 0) line(0 + xindent, 136 // 2 - yindent, 239 - xindent, 136 // 2 - yindent, 1) line(0 + xindent, 136 - yindent, 239 - xindent, 136 - yindent, 1) line(0 + xindent, 136 // 2 - yindent, 0 + xindent, 136 - yindent, 1) line(239 - xindent, 136 // 2 - yindent, 239 - xindent, 136 - yindent, 1) rect(239 - xindent * 2, 136 - yindent + 1, xindent, 10, 0) line(239 - xindent * 2, 136 - yindent + 1, 239 - xindent * 2, 136 - yindent + 10, 1) line(239 - xindent * 2, 136 - yindent + 10, 239 - xindent * 2 + xindent, 136 - yindent + 10, 1) line(239 - xindent * 2 + xindent, 136 - yindent + 10, 239 - xindent * 2 + xindent, 136 - yindent, 1) -- text print local p = print("Progress Check", 0, 140) print("Progress Check", 239 // 2 - p // 2, 136 // 2 - 136 // 4 + 3, 12) local x = print("X to exit", 0, 140) print("X to exit", skillBarPos.centre.x - x // 2, 136 // 2 + 37, 14) rectb(skillBarPos.centre.x - x // 2 - 2, 136 // 2 + 35, 9, 9, 14) if hWBar.currentFillValue == hWBar.maxValue then WindowDelay(2) end end function DrawHand(_handspr, _hxPos, _hyPos, _itemspr, _ixPos, _iyPos) spr(_itemspr, _ixPos, _iyPos, 0, 1, 0, 0, 4, 4) spr(_handspr, _hxPos, _hyPos, 0, 1, 0, 0, 4, 4) end function SkillCheckSequanceCircle() DrawCutWindow() if hWBar.currentFillValue < hWBar.maxValue then DrawSkillBar() SkillBox() SuccessCheck() SuccessStep() SkillBar() else local p = print("Failed", 240, 136) print("Failed", ((p // 2) + 240 // 2), 136 // 2, 2) end end function SkillCheckSequanceSlider() if hWBar.currentFillValue < hWBar.maxValue then DrawSkillSlider() SkillSliderBox() SuccessCheckSlider() SuccessStepSlider() SkillBar() else local p = print("Failed", 240, 136) print("Failed", ((p // 2) + 240 // 2), 136 // 2, 2) end end function BrewProgress(_timer) if brewingStage == 1 then SkillCheckSequanceSlider() spr(384, 240 // 2 - 12, 136 // 2 + 3, 0, 1, 0, 0, 4, 4) if skillSlider.successCheckstep >= 5 then spr(328, 240 // 2 - 45, 136 // 2 - 10, 0, 1, 0, 0, 4, 4) local p = print("Poured", 240, 136) print("Poured", ((p // 2) + 240 // 2) - 70, 136 // 2 + 20, 6) if WindowDelay(2) == true then brewingStage = 2 end else if _timer // 60 % 2 == 0 then tri(240 // 2 - 1, 136 // 2 + 4, 240 // 2 - 3, 136 // 2 + 12, 240 // 2 + 3, 136 // 2 + 12, 11) else tri(240 // 2 - 1, 136 // 2 + 4, 240 // 2 + 1, 136 // 2 + 12, 240 // 2 - 5, 136 // 2 + 12, 11) end spr(328, 240 // 2 - 22, 136 // 2 - 24, 0, 1, 0, 1, 4, 4) end return end if brewingStage == 2 then SkillCheckSequanceSlider() spr(384, 240 // 2 - 12, 136 // 2 + 3, 0, 1, 0, 0, 4, 4) if skillSlider.successCheckstep >= 5 then rect(240 // 2, 136 // 2 - 5, 3, 8, 11) spr(261, 240 // 2 - 5, 136 // 2 - 24, 0, 1, 0, 0, 4, 4) circ(240 // 2 + 1, 136 // 2 + 4, 3, 11) local p = print("Stirred", 240, 136) print("Stirred", ((p // 2) + 240 // 2) - 70, 136 // 2 + 20, 6) if WindowDelay(2) == true then brewingStage = 3 end else if _timer // 60 % 2 == 0 then rect(240 // 2 - 5, 136 // 2 + 4, 3, 8, 11) spr(261, 240 // 2 - 10, 136 // 2 - 15, 0, 1, 0, 0, 4, 4) else rect(240 // 2 + 5, 136 // 2 + 4, 3, 8, 11) spr(261, 240 // 2, 136 // 2 - 15, 0, 1, 0, 0, 4, 4) end end return end if brewingStage == 3 then -- stops all housework developing for player to finish whats left --- brewCompleted = true spr(384, 240 // 2 - 12, 136 // 2, 0, 1, 0, 0, 4, 4) if _timer // 60 % 2 == 0 then -- this draws the heat haze aboove the cup spr(388, 240 // 2 - 12, 136 // 2 - 5, 0, 1, 0, 0) spr(388, 240 // 2 - 6, 136 // 2 - 5, 0, 1, 1, 0) spr(388, 240 // 2, 136 // 2 - 5, 0, 1, 0, 0) spr(388, 240 // 2 + 6, 136 // 2 - 5, 0, 1, 1, 0) else spr(388, 240 // 2 - 12, 136 // 2 - 5, 0, 1, 1, 0) spr(388, 240 // 2 - 6, 136 // 2 - 5, 0, 1, 0, 0) spr(388, 240 // 2, 136 // 2 - 5, 0, 1, 1, 0) spr(388, 240 // 2 + 6, 136 // 2 - 5, 0, 1, 0, 0) end if hWBar.currentFillValue > 0 then local p = print("Finish The housework", 240, 136) print("Finish The housework", (240 // 2 - p // 2), 136 // 2 - 20, 6) else local p = print("You Have Won", 240, 136) print("You Have Won", (240 // 2 - p // 2), 136 // 2 - 20, 6) finishGame = true if WindowDelay(4) then toBrewScene = true end end return end --- shows whats been collected ---- if cup.collected == true and teabag.collected == false and kettle.collected == false then spr(324, 240 // 2 - 12, 136 // 2, 0, 1, 0, 0, 4, 4) elseif teabag.collected == true and cup.collected == false and kettle.collected == false then spr(320, 240 // 2 - 12, 136 // 2, 0, 1, 0, 0, 4, 4) elseif kettle.collected == true and teabag.collected == false and cup.collected == false then spr(328, 240 // 2 - 12, 136 // 2, 0, 1, 0, 0, 4, 4) elseif cup.collected == true and kettle.collected == true and teabag.collected == false then spr(328, 240 // 2 + 12, 136 // 2, 0, 1, 0, 0, 4, 4) spr(324, 240 // 2 - 42, 136 // 2, 0, 1, 0, 0, 4, 4) elseif cup.collected == true and teabag.collected == true and kettle.collected == false then spr(320, 240 // 2 + 12, 136 // 2, 0, 1, 0, 0, 4, 4) spr(324, 240 // 2 - 42, 136 // 2, 0, 1, 0, 0, 4, 4) elseif kettle.collected == true and teabag.collected == true and cup.collected == false then spr(320, 240 // 2 + 12, 136 // 2, 0, 1, 0, 0, 4, 4) spr(328, 240 // 2 - 42, 136 // 2, 0, 1, 0, 0, 4, 4) elseif cup.collected == true and teabag.collected == true and kettle.collected == true then brewingStage = 1 end end function DrawBrewingSequance() DrawCutWindow() BrewProgress(t) end function CancelPickUpScene() isPickUpScene = false skillBar.successCheckstep = 0 cutWindowOpenTime = 0 windowDelayTimer = 0 end function CancelBrewingScene() isBrewScene = false BrewTablebeenInteracted = false skillBar.successCheckstep = 0 cutWindowOpenTime = 0 windowDelayTimer = 0 end --#endregion --#region Sound function SfxSkillCheckFail() sfx(0) end function SfxSkillCheckGood() sfx(1) end function SfxBoxSmash() sfx(2) end function SfxCollectHW() sfx(3) end function SfxHWDrop() sfx(4) end function SfxSkillCheckCollected() sfx(5) end --#endregion --#region GAME LOOP ------The Games Game Loop ---------------------------------------------------------------------------- function MainGameLoop() cls(0) Border(bordersize, 9) HouseWorkBar() DashBar() t = t + 1 PlayerMove() Timer() for i = 1, #laundrys do Collect(laundrys[i]) end for i = 1, #posts do Collect(posts[i]) end for i = 1, #washingUp do Collect(washingUp[i]) end ObjMove(wMachine) DrawWorkTop() if teabag.collected == false then DrawTeaBag() elseif teabag.collected == true then ResetObj(teabag) end if kettle.collected == false then DrawKettle() elseif kettle.collected == true then ResetObj(kettle) end if cup.collected == false then DrawCup() elseif cup.collected == true then ResetObj(cup) end DrawSink() DrawDoor() DrawWMachine() PostMove() WashingUpMove() if interactPrompt == true then InteractPrompt() end for i = 1, #boxes do DrawBox(i) end for i = 1, #boxes do if CollideWithBox(boxes[i]) then break end end for i = 1, #laundrys do if laundrys[i].collected == false then DrawLaundry(i) elseif laundrys[i].collected == true then ResetObj(laundrys[i]) end end for i = 1, #posts do if posts[i].collected == false then DrawPost(i) elseif posts[i].collected == true then ResetObj(posts[i]) end end for i = 1, #washingUp do if washingUp[i].collected == false then DrawWashingUp(i) elseif washingUp[i].collected == true then ResetObj(washingUp[i]) end end --- item actions if brewCompleted == false then WMachineFire() PostFire() CreateWashingUp() end SkillCheckMultiplyer() DrawPlayer() --- cut scene skill checks ------ if isPickUpScene == true then SkillCheckSequanceCircle() if btnp(5) and finishGame == false then CancelPickUpScene() end end if isBrewScene == true then DrawBrewingSequance() if finishGame == false then if btnp(5) then CancelBrewingScene() end end end if AttemptPickUp(teabag) or AttemptPickUp(kettle) or AttemptPickUp(cup) or IsAtTable() then interactPrompt = true else interactPrompt = false end --- if game is won ------ if toBrewScene == true then mgr:active("end") end --print(cutWindowOpenTime // 60, 20, 20, 3) end --#endregion --#region SCENES --------Scenes ----------------------------------------------------------------------------- function Title() local s = {} local ti = 0 function s:onActive() -- optional sync(1, 1) ti = 0 end function s:update() end function s:draw() cls() ti = ti + 1 spr(0, 240 // 2 - 64, 136 // 3 - 40 + math.sin(ti // 5 - 10) * 2, 0, 1, 0, 0, 16, 4) --BrewProgress(ti) spr(66, 240 // 2 - 20, 136 // 3, 0, 1, 0, 0, 5, 8) local p = print("Press z to start", 0, 136) print("Press z to start", 240 // 2 - p // 2, 136 - 20, 12, 0, 1) if btnp(4) then mgr:active("game") end end return s end function Game() local s = {} function s:onActive() -- optional sync(1, 0) ResetGame() end function s:update() end function s:draw() MainGameLoop() --if btnp(6) then -- mgr:active("title") --end end return s end ------ testing scene --------- function Test() local s = {} function s:onActive() -- optional sync(1, 0) end function s:update() end function s:draw() cls() DrawCutWindow() local p = print("Finish The housework", 240, 136) print("Finish The housework", (240 // 2 - p // 2), 136 // 2 - 20, 6) spr(384, 240 // 2 - 12, 136 // 2, 0, 1, 0, 0, 4, 4) end return s end ---- end scene ------------ function End() local s = {} local ti = 0 function s:onActive() -- optional sync(1, 2) ti = 0 SaveScore(timer) end function s:update() end function s:draw() cls() spr(0, 56, -3, -1, 1, 0, 0, 16, 16) ti = ti + 1 local p = print("Enjoy your tea", 240, 136) print("Enjoy your tea", (240 // 2 - p // 2), 136 // 2 - 20 + math.sin(ti // 5 - 10) * 2, 1) local w = print("Press z to skip", 240, 136) print("Press z to skip", (240 // 2 - w // 2), 136 - 8, 14) if ti // 60 >= 10 or btnp(4) then mgr:active("highscores") end end return s end ----- leaderboard scene ----------------------------- function HighScores() local s = {} local ti = 0 function s:onActive() -- optional sync(1, 0) ti = 0 end function s:update() end function s:draw() cls() ti = ti + 1 LeaderBoard() if ti // 60 >= 10 or btnp(4) then mgr:active("title") end end return s end --#endregion --#region LEADERBOARD function SaveScore(_score) for i = 0, 10, 1 do if pmem(i) == 0 then pmem(i, _score) do return end end end for i = 0, 10, 1 do if pmem(i) <= _score then pmem(i, _score) do return end end end end function LeaderBoard() local scoreHolder = {} for i = 0, 10, 1 do if pmem(i) > 0 then table.insert(scoreHolder, pmem(i)) end end table.sort(scoreHolder, function(a, b) return a < b end) rect((240 - 150) // 2, (136 - 115) // 2, 150, 115, 8) local message = "HighScores" local width = print(message, 0, -6) print(message, (240 - width * 2) // 2, (136 - 105) // 2, 3, false, 2) for i = #scoreHolder, 1, -1 do local message = scoreHolder[i] local width = print(message .. " secs", 0, -6) print(message .. " secs", (240 - width) // 2, (136 - 105) // 2 + 15 + (7 * i), 13, false) local message = i .. "." local width = print(message, 0, -6) print(message, (240 - width) // 2 - 40, (136 - 105) // 2 + 15 + (7 * i), 13, false) end -- prints skip option local w = print("Press z to skip", 240, 136) print("Press z to skip", (240 // 2 - w // 2), 136 - 8, 14) end --#endregion ----------------------------------------------------------------------------------------- --********************* MAIN ************************************************************ mgr:add(Title(), "title") mgr:add(Game(), "game") mgr:add(Test(), "test") mgr:add(End(), "end") mgr:add(HighScores(), "highscores") mgr:active("title") -- TIC is called at 60fps----- function TIC() mgr:draw() end --*********************MAIN END ********************************************************** ------------------------------------------------------------------------------------------ --#region TILES, SPRITES, MAP AND SOUND DATA USED BY TIC-80