Merge pull request #11 from nathannlu/nathannlu/minor-ui

Nathannlu/minor UI
This commit is contained in:
Nathan
2024-03-14 01:07:32 -07:00
committed by GitHub
3 changed files with 8 additions and 14 deletions
+5 -12
View File
@@ -1,9 +1,9 @@
import { GIF } from "../libs/gif.js";
//import { GIF } from "../libs/gif.js";
import { GameObject } from "./core.js";
// Our sprite sheet is on a grid of 64pxs
// Each row is 64px tall, and each frame is 64px wide
const SPRITE_SIZE = 64;
const SPRITE_SIZE = 128;
const SPRITE_SHEET = {
JUMP: {
row: 0,
@@ -61,16 +61,9 @@ export class Pet extends GameObject {
this.directionDuration = 0;
// Assets
//this.gifSrc = "https://raw.githubusercontent.com/tonybaloney/vscode-pets/master/media/dog/akita_walk_8fps.gif"
//this.gifSrc = "./Group.png"
this.gifSrc = "";
//this.gifSrc = "";
this.petImage = new Image();
//this.petImage.src = "./Group.png"
this.petImage.src =
"https://comfyui-output.nyc3.cdn.digitaloceanspaces.com/Group%204.png";
this.petGif = GIF();
this.petGif.load(this.gifSrc);
this.petImage.src = "https://comfyui-output.nyc3.cdn.digitaloceanspaces.com/corgi-sprite-128x128.png"
/**
* Creates render sprite functions
@@ -216,7 +209,7 @@ export class Pet extends GameObject {
slowFpsBy = 10 // Slows down fps by n amount
) {
const _spriteFramesY = SPRITE_SIZE * spriteFramesY;
const spriteRenderSize = SPRITE_SIZE * 2; // This is the final size users see the sprite as
const spriteRenderSize = SPRITE_SIZE; // This is the final size users see the sprite as
ctx.imageSmoothingEnabled = true;
ctx.imageSmoothingQuality = "high";
+3 -2
View File
@@ -41,6 +41,8 @@ export class ComfyPetsStage extends ComfyNode {
this.gameButton.fontWeight = "bold";
this.gameButton.fontFamily = "Courier New";
this.size = [400,200]
// Stage objects
this.pets = [];
this.foods = [];
@@ -48,8 +50,7 @@ export class ComfyPetsStage extends ComfyNode {
// Assets
this.backgroundImage = new Image();
this.backgroundImage.src =
"https://media.istockphoto.com/id/1333010525/vector/simple-flat-pixel-art-illustration-of-cartoon-outdoor-landscape-background-pixel-arcade.jpg?s=612x612&w=0&k=20&c=uTGqB9fhmjzaNd17EGRHYU04_70K7a3M8ilRoJjDwtY=";
this.backgroundImage.src = "https://comfyui-output.nyc3.cdn.digitaloceanspaces.com/Summer2.png"
}
addPet() {