Hot answers tagged

9 votes
Accepted

"Industry Standard" JSON formats for game assets

I am Andreas Loew - creator of TexturePacker and PhysicsEditor. We define the export formats for our tools depending on the needs of the framework developers - in most cases we simply adapt to ...
Andreas Löw's user avatar
5 votes
Accepted

Switching from Arcade to P2 physics in Phaser

Arcade physics, unlike P2 and most other physics engines, is a very simple and simplistic system. The former will use a lot of lay terms whereas P2 will use terms plucked straight from a physics text ...
congusbongus's user avatar
  • 14.8k
5 votes
Accepted

How to center a tilemap in Phaser?

I found out why it was not working... I needed to do this: layer.fixedToCamera = false;
Leonardo Seccia's user avatar
4 votes
Accepted

Point plotting with a line graph

You can solve this with some basic trigonometry. I wrote the code in Unity, but the general idea should be the same. Consider the following image: We already have P1 and P2. Here is some code to ...
jgallant's user avatar
  • 8,364
3 votes

Is it possible to make a pseudo isometric game with phaser?

Phaser handles this out of the box using sorting based on the y index. I have used this exact technique too to create stacked sprites so the elements at the bottom of the screen are drawn over the ...
Bob_Gneu's user avatar
  • 222
3 votes
Accepted

Change running tween speed

If the objects cover the same distance (400px) in 40 or in 80 seconds, it's going to have an impact on the spacing if the objects start with a fixed delay of 2 seconds (values taken from your jsfiddle)...
bummzack's user avatar
  • 22.6k
3 votes

How to use 16/32 square pixel tiles in tilemap on arbitrarily sized canvas in Phaser

The usual workflow with tilemaps in Phaser is this: You make a tile map, probably in a map editor like Tiled, and export to a format that Phaser can support, like JSON. Load the tile map in Phaser. ...
congusbongus's user avatar
  • 14.8k
3 votes
Accepted

Collision happens even though the objects are not colliding according to what we see

The physics body is offset from the sprite body, causing collisions to happen to the right of the displayed sprite for the pool cue. To see what I mean, enable debugging on the P2 body by changing: <...
kevinAlbs's user avatar
  • 165
3 votes

How do you do tile-based movement in Phaser?

The player should have a position, that can be any number, and a target position. When the current position is equal to the target position, check the input, and set the new target position ...
Bálint's user avatar
  • 14.8k
3 votes

Why can't i change the background color in Phaser?

If you want to change the background color for the whole game, it´s easier to just set it in the game config. You can even use transparency: ...
andyrandy's user avatar
  • 141
3 votes

Pathfinding in Isometric Phaser with Tunnels

I disagree that you have to have a 3D map for this, and depending on how far along you are and how you implemented things, it might be a lot of work or bring other problems if you try to convert your ...
Christian's user avatar
  • 2,067
3 votes
Accepted

One pixel lines flash on tile map when camera moves

I was able to fix the problem by setting following a point instead of following my hero sprite. The core problem was the camera wasn't moving in round pixels. By making that point move in round pixels ...
Erik's user avatar
  • 161
3 votes
Accepted

Phaser 3 - How to trigger an event every 1 second?

In your scene's update method you receive both the current timestamp, and the delta since the last update call (see https://photonstorm.github.io/phaser3-docs/Phaser.Scene.html#update__anchor) You ...
vassildador's user avatar
3 votes
Accepted

Algorithm for taking the shortest path between two XY coordinates

Your code makes him move vertical and horizontal if needed. He moves the same speed both vertical and horizontal, that's why you only get a 45 degree angle. He moves like this until there is no need ...
agiopnl's user avatar
  • 146
2 votes
Accepted

Does Phaser Arcade.Body velocity include deltaTime or not?

Well.... I think I'm stupid... My calculation of the deltaTime was wrong The correct formula will be ...
Alexey Shimansky's user avatar
2 votes
Accepted

How to kill a fired bullet sprite after certain amount of time in Phaser?

I found out that objects can be killed with body.lifespan Adding the line bullet.lifespan = 1000; in my ...
flufflepuff's user avatar
2 votes

add physics to a group or container body in phaser

I think you can't do it. Phaser groups doesn't have body: http://phaser.io/docs/2.4.4/Phaser.Group But you can use setAll method to set properties to all sprites of a group: http://phaser.io/docs/2....
jolmos's user avatar
  • 171
2 votes

Pathfinding in Isometric Phaser with Tunnels

So you might be rendering in 2d, but effectively by doing this your game map is no longer 2d, it is in fact 3d. You could handle this by pathfinding in three dimensions. Assuming a 3x3 grid with a ...
Macha's user avatar
  • 121
2 votes
Accepted

Component based architecture in TypeScript

I've got some good suggestions on Phaser forum, the solution shown by user @flyovergames was what I was looking for: ...
Guilherme Recchi Cardozo's user avatar
2 votes

Take an image and cut it up into a tile map

Take a look at Tiled. It's a tool for creating 2D tile maps including hex-based maps like the example in your post. Phaser allows you to load tile map data generated by this tool. Once you've created ...
JRR's user avatar
  • 21
2 votes

Why are not the images loaded in Phaser?

I tested your Phaser Javascript code and it works fine. So I'm thinking it's a problem with how you've set up your server. Look up Express.js, its an NPM module that makes it really easy to set up ...
Dabe's user avatar
  • 21
2 votes
Accepted

Whay can my player only move in one direction?

I think your problem is that your understanding of if and else is slightly wrong. ...
Philipp's user avatar
  • 118k
2 votes
Accepted

How to justify text that appears character-by-character

I don't know what functionality Phaser offers, so this answer is abstract, but in general you must lay out the full text (or at least the entire next word for ragged-right and the entire next ...
Kevin Reid's user avatar
  • 5,398
2 votes
Accepted

How to make object movable only by the player?

If you want to use the builtin phaser functions, you just need to create a phaser-matter-gameboject, like an image (link to the documentation), and that you configer it to be draggable. create matter-...
winner_joiner's user avatar
1 vote
Accepted

Phaser game is not registering collisions and input - but only on my machine

I was able to solve it by clearing my local cache in my browser history. Lesson learnt: clear the cache if weird localised problems happen.
Felix O'Brien's user avatar
1 vote

setSize in Phaser.io

It doesn't look like you're initializing the physics anywhere. If you're trying to set attributes on the 'body', the body will be null unless you've initialized a physics engine on the sprite. Do ...
HaywardMorihara's user avatar
1 vote

Loading maps on HTML5 Games

That depends on how you load your maps and how long it takes. Depending on how it is programmed, a Javascript application can either start downloading a resource on pageload or when it actually needs ...
Philipp's user avatar
  • 118k
1 vote

Loading maps on HTML5 Games

On some consoles, it is required to have a loading screen if it takes more than x seconds to load, and the loading screen has to have a 'loading' animation if it takes more than x+y seconds to load. ...
Vaillancourt's user avatar
  • 16.3k
1 vote

Trouble loading sprite from spritesheet with Phaser

You need to set the anchor for the ball sprite the same as you did for the paddle, e.g.: ball.anchor.set(0.5, 1.0); Also when adding the ball animations, the 2nd ...
existenzial's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible