Skip to content

Commit

Permalink
Added start render
Browse files Browse the repository at this point in the history
  • Loading branch information
nathannlu committed Mar 19, 2024
1 parent a3a40b5 commit d1e3c5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions js/apiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const EVENTS = {
ADD_FOOD: 'ADD_FOOD',
START_GAME: 'START_GAME',
OPEN_SHOP: 'OPEN_SHOP',
START_RENDER: 'START_RENDER',
}

const fetchWithCache = async (url) => {
Expand Down Expand Up @@ -102,3 +103,11 @@ export async function openShopEvent() {

await fetch(url)
}

export async function startRenderEvent() {
const user = await getCurrentUser()
const userId = user?.user_id
const url = `${ENDPOINT}/e?t=${EVENTS.START_RENDER}&u=${userId}`

await fetch(url)
}
11 changes: 10 additions & 1 deletion js/game/stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { Food } from './food.js'
import { container } from './shop/index.js'
import { EndlessRunnerGame } from './minigames/endless_runner.js'
import { FlappyGame } from './minigames/flappy_pets.js'
import { addFoodEvent, startGameEvent, openShopEvent } from '../apiClient.js'
import {
addFoodEvent,
startGameEvent,
openShopEvent,
startRenderEvent,
} from '../apiClient.js'
import { MediumButton } from './buttons.js'
import { events, EARN_COINS } from '../events.js'
import { PointBar } from './ui/pointBar.js'
Expand Down Expand Up @@ -125,6 +130,10 @@ export class ComfyPetsStage extends ComfyNode {
}
*/

onAdded() {
startRenderEvent()
}

addPet() {
const height = this.size[1]
const petWidth = 75
Expand Down

0 comments on commit d1e3c5f

Please sign in to comment.