Skip to content

Commit

Permalink
Update inventory.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GusInfiniteLinesOfCode committed Apr 13, 2024
1 parent cdfdbf9 commit 4a2346d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/SquarePixels/uimanagement/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,29 @@
# Create item surfaces
items = [pig.Surface((50, 50), pig.SRCALPHA) for x in range(4)]
wood = pig.image.load(r"Recources\Textures\wood.png")
leaves = pig.image.load(r"Recources\Textures\leaves.png")
hatchet = pig.image.load(r"Recources\Textures\hatchet.jpg")
dirt = pig.image.load(r"Recources\Textures\dirt.jpg")
stone = pig.image.load(r"Recources\Textures\stone.jpg")
iron = pig.image.load(r"Recources\Textures\iron.jpg")
stonesword = pig.image.load(r"Recources\Textures\ssword.jpg")
scale = (25, 25)
wood = pig.transform.scale(wood, scale)
stone = pig.transform.scale(stone, scale)
leaves = pig.transform.scale(leaves, scale)
hatchet = pig.transform.scale(hatchet, scale)
dirt = pig.transform.scale(dirt, scale)
iron = pig.transform.scale(iron, scale)
stonesword = pig.transform.scale(stonesword, scale)
items[0].blit(wood, (15, 15, 100, 100))
items[1].blit(stone, (15, 15, 100, 100))
# Create a green sword item
pig.draw.circle(items[2], (0, 255, 0), (25, 25), 25)
# Create a blue circle item
pig.draw.circle(items[3], (0, 0, 255), (25, 25), 25)
items[2].blit(leaves, (15, 15, 100, 100))
items[3].blit(hatchet, (15, 15, 100, 100))
items[4].blit(dirt, (15, 15, 100, 100))
items[5].blit(iron, (15, 15, 100, 100))
items[6].blit(stonesword, (15, 15, 100, 100))



font = pig.font.Font(pig.font.match_font("calibri"), 26)

Expand Down Expand Up @@ -265,10 +278,13 @@ def remove_item(self, item_id, count, inventory):
)


iid = {"wood":0,"stone":1,"leaves":2,"hatchet":3,"dirt":4,"iron":5,"stonesword":6,}
crafting_recipes = [
{
"pattern": [[(0, 1), None, (0, 1)], [None, (1, 1), None], [None, (1, 1), None]],
"output": (2, 1), # Green sword
"pattern": [[(iid["stone"], 1), iid["leaves"], iid["stone"]],
[None, (iid["wood"], 1), None],
[None, (iid["wood"], 1), None]],
"output": (iid["stonesword"], 1),
},
# Add more recipes as needed
]
Expand Down

0 comments on commit 4a2346d

Please sign in to comment.