Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Chocobois/built-to-scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Golen87 committed Aug 17, 2024
2 parents 5296628 + baa1101 commit 7771ded
Show file tree
Hide file tree
Showing 32 changed files with 784 additions and 5 deletions.
23 changes: 22 additions & 1 deletion src/assets/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,42 @@ const images: Image[] = [
image('titlescreen/foreground', 'title_foreground'),
image('titlescreen/character', 'title_character'),


//temp
image('temp/invwindow', 'invwindow'),

];

/* Spritesheets */
const spritesheets: SpriteSheet[] = [
//temp
spritesheet('temp/invbutton', 'invbutton', 128, 128),
spritesheet('temp/fwbutton', 'fwbutton', 64, 262),
spritesheet('temp/rock', 'rock', 100, 100),
spritesheet('temp/coke', 'coke', 100, 100),
spritesheet('temp/brocc', 'brocc', 100, 100),
spritesheet('temp/hotdog', 'hotdog', 100, 100),
spritesheet('temp/hourglass', 'hourglass', 100, 100),
spritesheet('temp/hypnosis', 'hypnosis', 100, 100),
spritesheet('temp/milk', 'milk', 100, 100),
spritesheet('temp/pocky', 'pocky', 100, 100),
spritesheet('temp/polish', 'polish', 100, 100),
spritesheet('temp/snowglobe', 'snowglobe', 100, 100),
spritesheet('temp/usb', 'usb', 100, 100),
spritesheet('temp/pillowtalk', 'pillowtalk', 100, 100),
spritesheet('temp/shuriken', 'shuriken', 100, 100),

spritesheet('temp/blankspr', 'blankspr', 100, 100),
];

/* Audios */
const audios: Audio[] = [
music('title', 'm_main_menu'),
music('first', 'm_first'),
sound('place', 'place', 0.5),
sound('return', 'return', 0.5),
sound('scroll', 'scroll', 0.5),
sound('tree/rustle', 't_rustle', 0.5),
sound('tree/meme_explosion_sound', 'meme_explosion_sound', 0.5),
];

/* Fonts */
Expand Down
Binary file added src/assets/images/temp/blankspr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/brocc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/coke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/fwbutton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/hotdog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/hourglass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/hypnosis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/invwindow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/milk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/pillowtalk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/pocky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/polish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/rock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/shuriken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/snowglobe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/temp/usb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sounds/place.mp3
Binary file not shown.
Binary file added src/assets/sounds/return.mp3
Binary file not shown.
Binary file added src/assets/sounds/scroll.mp3
Binary file not shown.
Binary file added src/assets/sounds/tree/escape.mp3
Binary file not shown.
Binary file not shown.
23 changes: 22 additions & 1 deletion src/components/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,40 @@ import { interpolateColor } from "@/functions";
import { ThoughtBubble } from "./ThoughtBubble";
import { StationType } from "./StationData";

export interface CustomerType {
spr: string;
tags: string[];
antitags: string[];
budget: number;

}

export class Customer extends Button {
// Movement
public lastX: number; // Last position on the grid
public lastY: number;
public dragX: number; // Current drag position
public dragY: number;
public tags: string[];
public currentStation: Station | null;
public currentEmployee: Employee | null;

public cdata: CustomerType;
// Requests
public itinerary: StationType[]; // List of stations to visit
public requestedStation: StationType | null;

// Happiness variables
public baseTip: number;
public tipMultiplier: number;
public tipBonus: number;
public happinessStage: number; //0-6, rounds down
public minHappiness: number = 0; // bonuses
public maxHappiness: number = 6; // bonuses

public patience: number;
public minPatience: number; // bonuses
public lockPatience: boolean; // bonuses

// Stats
public doingCuteThing: boolean;
public tasksCompleted: number;
Expand Down
174 changes: 174 additions & 0 deletions src/components/Inventory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
import { BaseScene } from "@/scenes/BaseScene";
import { GameScene } from "@/scenes/GameScene";
import { Item } from "./Item";
import { SimpleButton } from "./elements/SimpleButton";
import { ItemButton } from "./ItemButton";

export class Inventory extends Phaser.GameObjects.Container {
public scene: GameScene;
public isOpen: boolean = false;
public itemList: Item[];
public display: ItemButton[];
public window: Phaser.GameObjects.Image;
public fwButton: SimpleButton;
public title: Phaser.GameObjects.Text;
public tdisplay: Phaser.GameObjects.Text;
private currentIndices: number[] = [0,11];
private coordinates: number[][] = [
[64,64], [148,64], [232,64],
[64,148], [148,148], [232,148],
[64,232], [148,232], [232,232],
[64,316], [148,316], [232,316]
];
constructor(scene:GameScene, x:number, y:number, stock:number[]){
super(scene,x,y);
this.scene=scene;
this.itemList = [
new Item(0,"rock",stock[0],1,["rock","cheap"],["cheap"],"Complimentary Pet Rock","A loving pet rock to cheer up any customer. Works modestly well."),
new Item(1,"coke",stock[1],50,["drug"],["illegal","cool"],"Cocaine","A delicious white powder made from plants. Improves working speed a whole bunch!"),
new Item(2,"hotdog",stock[2],25,["velociraptor","meat","bread","skeleton","ketchup","mustard","gay"],["meat","elitist","gay","gluten"],"Hot Dog","A big wiener with sauce, to satisfy any meat lover. You can also buy a bacon-wrapped cheesy version for 69 kr."),
new Item(3,"brocc",stock[3],12,["triceratops","veggie","healthy","stinky"],["veggie","healthy","stinky"],"Broccoli","This large stalk of free-range broccoli is perfect for vegans and herbivorous animals."),
new Item(4,"usb",stock[4],30,["protogen","tech","metal","nerd"],["nerd","tech"],"Mini USB Drive", "Additional storage space in a compact unit. I wonder who would want this?"),
new Item(5,"milk",stock[5],40,["dragon","horny","creamy","lactose","gay"],["horny","creamy","lactose","gay"],"Fresh Milk","Fresh, creamy milk for dragons. Still warm and thick."),
new Item(6,"snowglobe",stock[6],35,["lugia","kitsch","cold","ball"],["kitsch","cold","ball"],"Snowglobe","A cute little snowglobe. A certain type of customer might want this."),
new Item(7,"pocky",stock[7],30,["boykisser","weeb","cringe","sweet","chocolate"],["weeb","cringe","sweet"],"P*cky","Sweet snack made of edible sticks. There's a traditional game where you kiss while biting them. A favorite of virgins."),
new Item(8,"hourglass",stock[8],110,["time","physics","glass"],["physics"],"Hourglass","Turns back the time on a customer's patience. Might make it hard to work though..."),
new Item(9,"hypnosis",stock[9],90,["hypno","horny","kinky","weird","psychic"],["horny","kinky","weird"],"Hypnosis","Uses a state of hypnosis to keep a customer's patience constant. You can't increase it any more either though."),
new Item(10,"polish",stock[10],80,["expensive","creamy","musky"],["expensive","musky"],"Extra-Premium Polish","Gives scales a wonderful gloss and unique scent. Most customers love it, but comes at a premium."),
new Item(11,"pillowtalk",stock[11],50,["horny","soft","cringe"],["horny","cringe"],"Pillow Talk","Talk to a customer alluringly to have them use more services. Good telemarketing is vital!"),
new Item(12,"shuriken",stock[12],75,["sharp","weeb","ninja","cringe","cool"],["cool","cringe","weeb","sharp"],"Shuriken","Some type of fidget spinner that sharpens mental capabilites. Allows a worker to critical manicure."),
];
this.display = [];
this.window = new Phaser.GameObjects.Image(this.scene,x,y,"invwindow");
this.window.setAlpha(0.85);
//this.window.setVisible(false);
this.window.setOrigin(-1,0);
this.add(this.window);
this.title = this.scene.addText({
x: 75,
y: 760,
size: 30,
color: "#FFFFFF",
text: "",
});
this.tdisplay = this.scene.addText({
x: 75,
y: 845,
size: 25,
color: "#FFFFFF",
text: "",
});
this.tdisplay.setWordWrapWidth(500);
this.add(this.title);
this.add(this.tdisplay);
this.fwButton = new SimpleButton(this.scene,x,y,"","fwbutton",10);
this.fwButton.on("click", ()=> {this.scroll()});
this.scene.add.existing(this);
}

unhighlight(){
for(let p=0; p<this.display.length; p++){
if(this.display[p].state==1){
this.display[p].unselect();
}
}
this.title.setText("");
this.tdisplay.setText("");
}

highlight(id: number){
this.title.setText(this.itemList[id].name + " x" + this.itemList[id].quant);
this.tdisplay.setText(this.itemList[id].desc);
this.scene.sound.play("scroll");
}

populate(){
//only run on init!
let rs = 0;
for(let np = this.currentIndices[0]; np < this.currentIndices[1]+1; np++){
if(np < this.itemList.length){
this.display.push(new ItemButton(this.scene,this.coordinates[rs][0], this.coordinates[rs][1], this, this.itemList[np].id, rs, this.itemList[np].spr));
if(this.itemList[np].quant <= 0) {
this.display[rs].shadow();
}
this.add(this.display[rs]);
}
else {
this.display[rs] = new ItemButton(this.scene,this.coordinates[rs][0], this.coordinates[rs][1], this, -1, rs, "blankspr");
this.add(this.display[rs]);
}
rs++;
}
}

repopulate(){
let rs = 0;
for(let np = this.currentIndices[0]; np < this.currentIndices[1]+1; np++){
this.display[rs].destroy();
if(np < this.itemList.length){
this.display[rs] = new ItemButton(this.scene,this.coordinates[rs][0], this.coordinates[rs][1], this, this.itemList[np].id, rs, this.itemList[np].spr);
if(this.itemList[np].quant <= 0) {
this.display[rs].shadow();
}
this.add(this.display[rs]);
}
else {
this.display[rs] = new ItemButton(this.scene,this.coordinates[rs][0], this.coordinates[rs][1], this, -1, rs, "blankspr");
this.add(this.display[rs]);
}
rs++;
}
}

toggle(){
if(!this.isOpen) {
this.open();
} else {
this.close();
}
}

close(){
this.scene.sound.play("t_rustle");
this.display.forEach((ib) => ib.destroy());
this.setPosition(-650,0);
this.isOpen=false;
this.display = [];
this.window.setVisible(false);
}

open(){
this.scene.sound.play("t_rustle");
this.window.setVisible(true);
console.log("Open Processed");
this.x = 0;
this.y = 0;
this.isOpen=true;
this.populate();
}

returnItem(id: number){
this.itemList[id].quant++;
}

updateAmountText(id:number, i: number){
if(i > 0) {
this.title.setText(this.itemList[id].name + " x" + i);
} else {
this.title.setText("");
this.tdisplay.setText("");
}
}

scroll(){
if(this.currentIndices[1] < this.itemList.length) {
let b = this.currentIndices[1] + 1;
let e = this.currentIndices[1] + 11;
this.currentIndices = [b,e];
} else {
this.currentIndices = [0,11];
}
this.repopulate();

}
}
40 changes: 40 additions & 0 deletions src/components/Item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export class Item {
public id:number;
public spr:string;
public quant:number;
public price:number;
public tags:string[];
public antitags:string[];
public name:string;
public desc:string;

//-1 - default item, does nothing
//0 - Complimentary Pet Rock - increases satisfaction by one stage
//1 - cocaine - doubles station workspeed, once
//2 - hot dog - increases satisfaction by 2 stages for velociraptors
//3 - broccoli - increases satisfaction by 2 stages for triceratops
//4 - usb - increases satisfaction by 2 stages for protogen
//5 - fresh milk - increases satisfaction by 2 stages for dragon
//6 - snow globe - increases satisfaction by 2 stages for lugia
//7 - pocky - increases satisfaction by 2 stages for boykisser
//8 - hourglass - station takes twice as long, but resets patience
//9 - hypnosis - customers no longer lose patience after being serviced at least once, but patience cannot increase either
//10 - extra polish - increases tips received by 100% base amount, unless customer is cheap
//11 - pillow talk - adds a random station to the end of a customer's itinerary
//12 - shuriken - barbers can crit, crit causes happiness to raise one stage

constructor(id:number,sp:string,qt:number,pr:number,tgs:string[],atgs:string[],name:string,dsc:string) {
this.id=id;
this.spr=sp;
this.quant=qt;
this.price=pr;
this.tags=tgs;
this.antitags=atgs;
this.name=name;
this.desc=dsc;
}

setQuantity(n:number){
this.quant=n;
}
}
Loading

0 comments on commit 7771ded

Please sign in to comment.