Phaser is a JavaScript framework for game development on desktop and mobile platforms. This tag can be used for all versions of Phaser.
Questions tagged [phaserjs]
50 questions
3
votes
1 answer
How can I check for overlap during a single sprite frame? And subtract only 1 from the players health on each loop the player overlaps the frame?
I have a spike sprite that has 4 frames in its loop. I want to subtract 1 from the health variable when the player overlaps with 3rd frame of the spike sprite.
Currently, the .on function will not load properly. My game works, but the overlap…

JackF99
- 125
- 6
2
votes
1 answer
phaser - how to find mobile device notch size
My game is running fullscreen on mobile devices but I need to keep some top safe space to avoid notch space and statusbar.
Found this scale examples but it doesn't handle notch/statusbar spaces.
scale: {
mode: Phaser.Scale.FIT,
autoCenter:…

anderlaini
- 1,593
- 2
- 24
- 39
2
votes
1 answer
simple tween is not working to move object X
My code below is showing two scenes side-by-side. It's working fine the way I need.
So I'm trying to simply move them using Tween and it's not working.
Am I doing something wrong?
document.body.style =…

anderlaini
- 1,593
- 2
- 24
- 39
2
votes
1 answer
Phaser 3 create tilesprite from dynamic texture
I have developed a slot machine in Phaser 3. The reels are essentially tile sprites that rotate during spinning.
When the reels slow down, I would like to load a tile sprite of symbols representing the outcome of the payout engine.
Since I can't…

Diego
- 37
- 5
2
votes
1 answer
Phaser 3 : Distort shape of grid
If there is grid with 5x5, how to make the grid distort like the image below ? The reason is to make a walk way, the nearest is bigger tiles, furthest is smaller tiles, and able to dynamic prepend 5x1 on top

FeelRightz
- 2,777
- 2
- 38
- 73
2
votes
1 answer
How to make a group of sprites enemy behaviour where they will run at player when within 400 pixels. I have code but am getting errors
How can I make my group follow the player when within 400 pixels? I created code based on this tutorial (https://docs.idew.org/video-game/project-references/phaser-coding/enemy-behavior). My current code I have created is below,
//IN CREATE…

JackF99
- 125
- 6
2
votes
1 answer
Player sprite isn't interacting with game object to change maps
I'm very new to Phaser 3 and I've been trying to create an instance where the player sprite collides with a game object that takes the player to another map. Right now I'm trying to make the player change scenes from house 1 to house 2, but when I…

Kenzie Sanderson
- 43
- 6
1
vote
1 answer
Phaser Background loading trouble, is camera causing it
I'm making a game in which the camera follows the player as they move across the level. But I'm having trouble with the background.
The game window is 1600 x 900, while the background image is 3400 x 900, all in pixels. The player starts at on the…

EmptyStone
- 235
- 1
- 7
1
vote
1 answer
is there any other way to monitor the percentage of erased pixels in phaser
so im trying to create a scratch card game where the user need to scratch the card to reveal what's underneath it. i want to check whenever the user has scratched 70% of the canvas to reveal it all. i am trying to get this to work using phaser but…

georgio bejjani
- 21
- 6
1
vote
1 answer
Phaser 3 | Enable sleep event for static object
I want to build a tower stacking game.
A click triggers the block to fall down.
I need to listen on when the falling stone goes to sleep and trigger an event afterwards to get the next round started.
To enable the sleep listeners I need to specify…

Wiz
- 61
- 5
1
vote
1 answer
How to detect collisions in Phaser.js
I have been trying to figure out how to detect collisions in Phaser.js 3, but I cannot find any working solutions. Here is my phaser code:
var gameState = {};
function preload() {
this.load.image('codey',…

frigidus
- 48
- 7
1
vote
1 answer
phaser - container not moving it's objects
I'm using external class with a container and trying to move it
import Phaser from 'phaser';
export default class tabContainer extends Phaser.GameObjects.Container {
container_hit_clicker;
constructor(scene){
super(scene);
…

anderlaini
- 1,593
- 2
- 24
- 39
1
vote
1 answer
phaser - how to keep game data organized right way
My game will handle a data model like this:
- Characters
- Name
- PowerBase
- League
- Title
- BossName
- Match
- Player
- Character
- League
- Progress
- PowerTotal
- Money
- Loan1, Loan2
- Funding1, Funding2
As you can…

anderlaini
- 1,593
- 2
- 24
- 39
1
vote
1 answer
Phaser setting specific slots in an array didn't work?
I've pretty much gotten past this problem by attacking to from a different angle, but I would like to know why my first approach didn't work.
In my game I had and array:
let inventory =…

EmptyStone
- 235
- 1
- 7
1
vote
1 answer
Phaser Need a new trigger for text
I'm working on a game in which, when the player talks to an npc with a quest, one of for dialogues is shown, based on what a string made in the main scene is set to. The string can be:
inactive: is set to this be default, the player hasn't talked…

EmptyStone
- 235
- 1
- 7