Per the doc, destroy() method Destroys this Game Object removing it from the Display List and Update List and severing all ties to parent resources. Also removes itself from the Input Manager and Physics Manager if previously enabled. Use this to remove a Game Object from your game if you don’t ever plan to use it again. As long as
Tag: phaser-framework
Phaser 3 How to Access and Affect Player in Collision between 2 Objects Not Involving Player
I am trying to create a grappling hook in Phaser 3. I can successfully shoot the grappling hook at an upward angle away from the player. I need to get the player to move towards the grappling hook when the grappling hook reaches its destination. The problem is that I can’t access the player object in my Spawner.ts file to
Phaser3 framework javascript: current anims index
In phaser 3 framework, what syntax do I use to check the current frame index? I want to make a hit area appear only when the player’s sprite sheet reaches a certain index(the index displaying the motion of ‘attack’). I want to accomplish this through detecting its current frame index. How can I do this? Answer The solution is found.
Moving the character a few tiles more seems to cause the whole scene (the physics world) to shake, why is that? How do I fix it?
Here is the example code from phaser3 tutorial. Per the tutorial, there are 2 scenes, one for the world map and the other for the battle. I doubt if the code above implement the battle scene. I assume the scene in question is the world scene. Moving (with arrow keys) the character one or two steps/tiles works well. Keep moving
How can set pointerDown for each of rectangle on Phaser 3
I’m trying to set up the Conway’s Game of Life using Phaser. My question is this: how can I make a Rectangular of the Phaser.geom class contain a click event? Class Dots: Class Game: Answer You are setting interactive on the graphics serveral time, it the forEach-loop. I think this can be done only once, so you are overriding it,
How to handle collisions in Phaser
I want to make objects push away from each other in my Phaser game (arcade physics). To do so I’ve tried to use the collider function: But I always get TypeError: undefined is not an object (evaluating ‘t.isParent’) It looks like this is error rises during the update process as it’s risen thousand times a minute… I’m using Phaser 3
Download pixel art drawing as .png in PhaserJS
I need to download the created pixel drawing from this Phaser example as a .png image via FilesSaver.js but the canvas returns null. Error: Uncaught TypeError: Cannot read properties of null (reading ‘toBlob’) This is the save function: drawingArea: (PhaserJS 2) How to get the data of the drawing to create a .png out of it? Answer Well I don’t
Phaser 3: load spritesheet for animation with unequal dimensions
Im trying to work with the phaser 3 framework. In order to load a spritesheet and create its animation I first load the spritesheet: this.load.spritesheet(‘player’, ‘assets/spritesheets/player.png’,{frameWidth:16,frameheight:16}); then I create the animation as follows: This works fine but if I have unequal dimensions such as I receive the following error: if i print console.log(this.anims.generateFrameNumbers(“player”)); the output is: however for the unequal
How to detect overlap in Phaser.js?
I am new to Phaserjs, and I am trying to make a shooting game. I want the damage function to fire when a bullet touches plane2, that is the green plane. Can somone please tell me what am I doing wrong here? Here is my code: Here is the link to the game if needed https://shoot.abaanshanid.repl.co/ Answer This works: but
How to add a Div on a Phaser Game
I have a game.js where all the sprites from my Phaser game is rendered. I also have a index.html that calls this script to render the game. I would like to add a <div> for a health bar over the game.js canvas but I am not able to do it, when I try, it only shows above or below the