I set up a small project to test this out, simply using the example code in the README:
require('@geckos.io/phaser-on-nodejs')
const Phaser = require('phaser')
// set the fps you need
const FPS = 30
global.phaserOnNodeFPS = FPS // default is 60
// your MainScene
class MainScene extends Phaser.Scene {
constructor() {
super('MainScene')
}
create() {
console.log('it works!')
}
}
// prepare the config for Phaser
const config = {
type: Phaser.HEADLESS,
width: 1280,
height: 720,
banner: false,
audio: false,
scene: [MainScene],
fps: {
target: FPS
},
physics: {
default: 'arcade',
arcade: {
gravity: { y: 300 }
}
}
}
// start the game
new Phaser.Game(config)
I run it with node index.js and it exits immediately. I figured maybe it was just the process didn't have anything to "wait" for and ended before the scene could be created, so I created an http server and have the server listening at the end of the file so the process doesn't exit. However, still nothing. Not seeing the console.log from the scene's create method.
I set up a small project to test this out, simply using the example code in the README:
I run it with
node index.js
and it exits immediately. I figured maybe it was just the process didn't have anything to "wait" for and ended before the scene could be created, so I created an http server and have the server listening at the end of the file so the process doesn't exit. However, still nothing. Not seeing the console.log from the scene's create method.I am using Phaser 3.52.0 and node 14.5.0