Skip to content

Commit bdd2ade

Browse files
committed
add notify function, use background for grid, use sprites for environment sprites
1 parent 06ff51d commit bdd2ade

15 files changed

Lines changed: 303 additions & 107 deletions

File tree

source/assets/images/grass.png

129 Bytes
Loading

source/assets/images/heart.png

145 Bytes
Loading
21 Bytes
Loading

source/assets/images/locked.png

139 Bytes
Loading

source/assets/images/logo.png

402 Bytes
Loading

source/libraries/Signal.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import "CoreLibs/object"
66

77
class("Signal").extends()
88

9-
print("IMPORTING SIGNAL")
10-
119
function Signal:init()
1210
self.listeners = {}
1311
end

source/libraries/noble/modules/Noble.GameData.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ function Noble.GameData.setup(__keyValuePairs, __numberOfSlots, __saveToDisk, __
9595

9696
local createdNewData = false
9797

98-
print("# SLOTS", numberOfSlots)
9998
-- Noble Engine checks on disk for GameDatas, including ones that were
10099
-- added with addSlot, but it assumes your game will have no greater than 1000 of them.
101100
for i = 1, 1000, 1 do

source/libraries/playout.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ function tree:computeTabIndex(id)
594594
end
595595

596596
walk(self.root)
597-
597+
598598
table.sort(tabIndex, function(a, b)
599599
return a.properties.tabIndex < b.properties.tabIndex
600600
end)

source/main.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import "CoreLibs/easing"
12
import "CoreLibs/object"
23
import "CoreLibs/sprites"
34
import "CoreLibs/timer"
5+
import "CoreLibs/ui"
46

57
import "libraries/noble/Noble"
68
import "libraries/AnimatedSprite"
@@ -17,7 +19,7 @@ import "scripts/Item"
1719
import "scenes/BaseScene"
1820
import "scenes/Title"
1921
import "scenes/Play"
20-
import "scenes/View"
22+
import "scenes/Stats"
2123

2224
Noble.Text.FONT_NEWSLEAK = Graphics.font.new("assets/fonts/Newsleak Serif/Newsleak-Serif")
2325
Noble.Text.FONT_NEWSLEAK_BOLD = Graphics.font.new("assets/fonts/Newsleak Serif/Newsleak-Serif-Bold")

source/scenes/Play.lua

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ local itemTimer
99
local player
1010
local playerSlot
1111
local ground = gfx.image.new("/assets/images/ground")
12+
local tree = gfx.image.new("/assets/images/tree")
13+
local grass = gfx.image.new("/assets/images/grass")
1214

1315
Play.inputHandler = {
1416
leftButtonDown = function()
@@ -41,6 +43,28 @@ end
4143
function Play:enter()
4244
Play.super.enter(self)
4345

46+
local tree_sprite = gfx.sprite.new(tree)
47+
tree_sprite:setCenter(0.5, 1) -- This sets the anchor to the bottom center
48+
tree_sprite:moveTo(144, 104)
49+
self:addSprite(tree_sprite)
50+
51+
local bush_sprite = gfx.sprite.new(tree) -- This sprite is centered at 0.5, 0.5
52+
bush_sprite:moveTo(32, 100)
53+
self:addSprite(bush_sprite)
54+
55+
local grass1 = gfx.sprite.new(grass)
56+
grass1:setCenter(0.5, 1)
57+
grass1:moveTo(50, 105)
58+
self:addSprite(grass1)
59+
local grass2 = gfx.sprite.new(grass)
60+
grass2:setCenter(0.5, 1)
61+
grass2:moveTo(130, 105)
62+
self:addSprite(grass2)
63+
64+
local ground_sprite = gfx.sprite.new(ground)
65+
ground_sprite:setCenter(0.5, 0) -- This sets the anchor to the top center
66+
ground_sprite:moveTo(100, 104)
67+
self:addSprite(ground_sprite)
4468
self:addSprite(player)
4569
player:setState("idle")
4670
playdate.display.setScale(2)
@@ -65,16 +89,20 @@ function Play:start()
6589
end
6690

6791
-- This runs once per frame.
68-
function Play:update()
69-
Play.super.update(self)
70-
-- Your code here
71-
end
72-
73-
function Play:drawBackground()
74-
Play.super.drawBackground(self)
75-
-- Your code here
76-
ground:draw(4, 104)
77-
end
92+
-- function Play:update()
93+
-- Play.super.update(self)
94+
-- -- Your code here
95+
-- end
96+
97+
-- function Play:drawBackground()
98+
-- Play.super.drawBackground(self)
99+
-- -- Your code here
100+
-- tree:draw(24, 80)
101+
-- tree:draw(146, 74)
102+
-- grass:draw(56, 89, gfx.kImageFlippedX)
103+
-- grass:draw(156, 89)
104+
-- ground:draw(4, 104)
105+
-- end
78106

79107
-- This runs as as soon as a transition to another scene begins.
80108
function Play:exit()
@@ -83,7 +111,6 @@ function Play:exit()
83111
Noble.showFPS = false
84112
itemTimer:remove()
85113
Signal:remove("collected")
86-
printTable(items)
87114
Noble.GameData.set("items", items, playerSlot)
88115
end
89116

@@ -94,6 +121,7 @@ function Play:finish()
94121
playdate.display.setScale(1)
95122
end
96123

124+
-- TODO Show number of items collected
97125
function Play:pause()
98126
Play.super.pause(self)
99127
-- Your code here

0 commit comments

Comments
 (0)