Skip to content

Commit

Permalink
Added new shop menu
Browse files Browse the repository at this point in the history
  • Loading branch information
alesan99 committed Nov 22, 2023
1 parent 1db0d44 commit d56e84e
Show file tree
Hide file tree
Showing 21 changed files with 368 additions and 243 deletions.
3 changes: 2 additions & 1 deletion website/assets/areas/chictoriassecret.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"name": "Chictoria's Secret",
"items": {
"head": {
"tophat": true
"tophat": true,
"snapback": true
},
"body": {
"scarf": true,
Expand Down
2 changes: 1 addition & 1 deletion website/assets/areas/seeddispensary.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"NPCs": {
"cashier": {
"profile": {
"name": "Seedtender",
"name": "Bazooka Benny",
"color": [132, 211, 74],
"head": "snapback",
"face": false,
Expand Down
6 changes: 4 additions & 2 deletions website/assets/items/body/alesanaccessories.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Bud's Accessories",
"description": "Radical. - Bud",
"cost": 40,

"center": [
[64,55],
[92,49],
[63,56]
],
"cost": 40
]
}
6 changes: 4 additions & 2 deletions website/assets/items/body/beefcakeaccessories.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Beefcake's Accessories",
"description": "As worn by Beefcake. Pushes the boundaries of what can be considered fashion.",
"cost": 1000,

"center": [
[83,81],
[101,74],
[82,92]
],
"cost": 100
]
}
6 changes: 4 additions & 2 deletions website/assets/items/body/chains.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Chains",
"description": "The dollar sign is made out of 14k solid gold.",
"cost": 80,

"center": [
[63,58],
[88,46],
[62,55]
],
"cost": 50
]
}
6 changes: 4 additions & 2 deletions website/assets/items/body/scarf.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Scarf",
"description": "A warm and cozy scarf. Perfect for chilly days.",
"cost": 5,

"center": [
[63,58],
[88,46],
[64,52]
],
"cost": 5
]
}
6 changes: 4 additions & 2 deletions website/assets/items/body/silverchains.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Silver Chains",
"description": "Elegantly crafted with premium silver. Or so I'm told.",
"cost": 50,

"center": [
[63,58],
[88,46],
[62,55]
],
"cost": 50
]
}
6 changes: 4 additions & 2 deletions website/assets/items/face/visors.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Visors",
"desciption": "Essential for skiing or looking futuristic.",
"cost": 5,

"center": [
[65,1],
[89,3],
[63,2]
],
"cost": 5
]
}
6 changes: 4 additions & 2 deletions website/assets/items/head/hoodie.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Hoodie",
"description": "Comfortable and practical.",
"cost": 15,

"center": [
[62,5],
[92,3],
[63,3]
],
"cost": 10
]
}
6 changes: 4 additions & 2 deletions website/assets/items/head/snapback.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Snapback",
"description": "Adjustable to the size of your head. Technology is amazing.",
"cost": 5,

"center": [
[62,5],
[92,3],
[63,3]
],
"cost": 10
]
}
8 changes: 5 additions & 3 deletions website/assets/items/head/tophat.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "Top Hat",
"description": "Watch for doorways.",
"cost": 10,

"center": [
[38,47],
[38,44],
[38,47],
[38,47]
],
"cost": 10
]
}
4 changes: 2 additions & 2 deletions website/assets/quests/tutorial.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "Tutorial",
"description": "Discover what to do in Chicken Society!",

"progressStart": [false, false, false],
"progressStart": [0, 0, 0],

"progressFinish": [true, true, true],
"progressFinish": [1, 1, 1],

"reward": {
"nuggets": 10,
Expand Down
15 changes: 9 additions & 6 deletions website/game/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ function loadGameAssets() {
for (const [category, list] of Object.entries(ITEMS)) {
for (const [itemId, item] of Object.entries(list)) {
// Load image, create sprite frames when image is loaded, and load hat centers from JSON
let async = function() {
item.sprite = new Sprite(item.image, 1, 3, item.image.w,(item.image.h-2)/3, 0,0, 1,1)
}
item.image = new RenderImage(`assets/items/${category}/${itemId}.png`, async)
item.center = [[0.5, 0.7],[0.5, 0.7],[0.5, 0.7]]
item.cost = 0
item.name = ""
item.description = ""
item.cost = 0
item.center = [[0.5, 0.7],[0.5, 0.7],[0.5, 0.7]]
loadJSON(`assets/items/${category}/${itemId}.json`, (data) => {
item.name = data.name
item.description = data.description
item.center = data.center
item.cost = data.cost
})
let async = function() {
item.sprite = new Sprite(item.image, 1, 3, item.image.w,(item.image.h-2)/3, 0,0, 1,1)
}
item.image = new RenderImage(`assets/items/${category}/${itemId}.png`, async)
}
}

Expand All @@ -108,6 +110,7 @@ function loadGameAssets() {
FONT.hud = new RenderFont("Arial", 28)
FONT.caption = new RenderFont("Arial", 20)
FONT.nametag = new RenderFont("Arial", 16)
FONT.description = new RenderFont("Arial", 18)
FONT.chatBubble = new RenderFont("Courier New", 18)
FONT.guiLabel = new RenderFont("Times New Roman", 20)
}
Expand Down
37 changes: 18 additions & 19 deletions website/game/menu/customization.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,34 @@ MENUS["customization"] = new class extends Menu {
PLAYER.updateProfile(PROFILE, "sendToServer");
}, null, 348,365, 100,32)

// Inventorty
// Inventory
this.tab = "allTab"
this.inventory = []
this.buttons["allTab"] = new Button("All", ()=>{this.filterInventory("all")}, null, 476,150, 46,34)
this.buttons["headTab"] = new Button("H", ()=>{this.filterInventory("head")}, null, 522,150, 34,34)
this.buttons["faceTab"] = new Button("F", ()=>{this.filterInventory("face")}, null, 522+34*1,150, 34,34)
this.buttons["bodyTab"] = new Button("B", ()=>{this.filterInventory("body")}, null, 522+34*2,150, 34,34)
this.buttons["furitureTab"] = new Button("FT", ()=>{this.filterInventory("furniture")}, null, 522+34*3,150, 34,34)
this.buttons["itemTab"] = new Button("I", ()=>{this.filterInventory("item")}, null, 522+34*4,150, 34,34)
this.buttons["allTab"] = new Button("All", ()=>{this.filterInventory("all"); this.buttons[this.tab].selected=false; this.tab = "allTab"; this.buttons[this.tab].selected=true}, null, 476,150, 46,34)
this.buttons["headTab"] = new Button("H", ()=>{this.filterInventory("head"); this.buttons[this.tab].selected=false; this.tab = "headTab"; this.buttons[this.tab].selected=true}, null, 522,150, 34,34)
this.buttons["faceTab"] = new Button("F", ()=>{this.filterInventory("face"); this.buttons[this.tab].selected=false; this.tab = "faceTab"; this.buttons[this.tab].selected=true}, null, 522+34*1,150, 34,34)
this.buttons["bodyTab"] = new Button("B", ()=>{this.filterInventory("body"); this.buttons[this.tab].selected=false; this.tab = "bodyTab"; this.buttons[this.tab].selected=true}, null, 522+34*2,150, 34,34)
this.buttons["furnitureTab"] = new Button("FT", ()=>{this.filterInventory("furniture"); this.buttons[this.tab].selected=false; this.tab = "furnitureTab"; this.buttons[this.tab].selected=true}, null, 522+34*3,150, 34,34)
this.buttons["itemTab"] = new Button("I", ()=>{this.filterInventory("item"); this.buttons[this.tab].selected=false; this.tab = "itemTab"; this.buttons[this.tab].selected=true}, null, 522+34*4,150, 34,34)
this.filterInventory("all")
this.buttons["allTab"].selected = true

this.buttons["inventory"] = new GridSelector(
(itemId)=>{
this.buttons["inventory"] = new ItemGrid(
(itemId,itemType)=>{
// Set clothing item
if (PROFILE[getItemCategory(itemId)] && PROFILE[getItemCategory(itemId)] == itemId) {
PROFILE[getItemCategory(itemId)] = false;
if (PROFILE[itemType] && PROFILE[itemType] == itemId) {
PROFILE[itemType] = false;
} else {
PROFILE[getItemCategory(itemId)] = itemId;
PROFILE[itemType] = itemId;
}
PLAYER.updateProfile(PROFILE, "sendToServer");
}, this.inventory,
(i,itemId)=>{
},
this.inventory,
(itemId,itemType)=>{
// Is selected?
let category = getItemCategory(itemId)
if (PROFILE[category] && PROFILE[category] == itemId) {
if (PROFILE[itemType] && PROFILE[itemType] == itemId) {
return true
}
},
(i,itemId)=>{
return [ITEMS[getItemCategory(itemId)][itemId].image, ITEMS[getItemCategory(itemId)][itemId].sprite]
}, 476,184, 56,56, 5,3)

// this.buttons["bodyRight"] = new Button(">", ()=>{
Expand Down
Loading

0 comments on commit d56e84e

Please sign in to comment.