ddabrahim

Members
  • Content Count

    11
  • Joined

  • Last visited

  1. ddabrahim

    BUG:animationFrame is undefined

    Hi I get the following error message with Phaser 3.1.2 when trying to run the project from this tutorial: http://phaser.io/tutorials/making-your-first-phaser-3-game
  2. ddabrahim

    Hosting multiplayer games?

    Hi. I'm currently developing a single player game in Phaser and occurred to me to make it online multiplayer instead but I would prefer not to run my own server and wondering what solutions are out there for hosting online multiplayer games? I searched the web and did come across 4 solutions. PlayerIO, AppWarp, Photon and using platforms like Heroku and Amazon.... At the moment I'm more likely go with PlayerIO because the pricing is better, the free package allow me to get started with no obligations and the paid packages also seems cheap compared to other hosts but I would like to get some feedback if it any good or not, should I consider using something else? I would be grateful for any opinion on this or even links to articles I could learn something from. Thank you.
  3. ddabrahim

    Sprite animation from individual images?

    Yes TexturePacker would be a lot easier I can see that but I'm only getting started with Phaser and doing it this way is going to be useful at least to get to know Phaser better then I might end up using TexturePacker anyway. Thanks.
  4. ddabrahim

    Sprite animation from individual images?

    Thank you for the replies and suggestions, it sounds promising. I'll give it a try
  5. Hi. I made a game using an other engine and would like to port the game over to Phaser but it is using individual images for all sprite animations. I was wondering if is there any way to create a sprite animation from individual images inside Phaser? I was searching the web and everyone seems to offer to pack all images on to a single texture then use an atlas in phaser. It could be the best way to do it, but I'm really would like to know if it possible to create sprite animation inside Phaser without using any 3rd party tools? To give an explanation, I would like to attempt to import the game levels from the JSON exported directly from the tool I was using, so this way I need to remake the game logic only and don't need to worry about building all the levels and menus again. I could just write the import code once, then import all my levels directly from the JSON and I don't need to start completely from scratch. Even if I would be using an atlas, I need to work on this importer to get the position, scale, animation frame and other details of everything in the level so getting the images too and make sprite animations from them could be faster to get the levels up and running in Phaser. Thank you.
  6. ddabrahim

    How to sort Z depth of sprites using a custom Z value?

    Thank you for the links and the tip. I'm appreciate it.
  7. ddabrahim

    How to sort Z depth of sprites using a custom Z value?

    Thank you for the reply. I tried calling updateZ on the group but didn't work, I get the same results. I tried simply just using group.updateZ() and also passing the children as argument group.updateZ(group.children[index].z). Also tried in both the create and the update function. No effect. I'm also note sure how to use the move methods. If I have 4 sprites and I want the rendering order ascending, should I call moveUp() 2 times for the 2nd sprite and 3 times for the 3rd one? According to the documentation I should be able to change the Z directly. Many people mentioning on the forum it is not possible in Phaser, but I don't understand why is it not possible when the documentation suggest otherwise. By using group.children[index].z we can change the value of Z directly. It is there, it works By calling group.updateZ() we can update the Z values with new ones, not sure why is it necessary and it doesn't seem to have any effect anyway. Not sure how to use it. By calling group.sort(), according to the documentation we sort the rendering order using the Z value by default but we can change that by passing a new key like 'y' for example to use the value of Y to sort the order but I want exactly what it does by default. Sort the rendering order using the value of Z. But it doesn't work because it is override the value of Z. Also the sort() method is recommended to be used as the very last thing in the update function. I would imagine that is because in case we change the value it get updated at the end of the update. Everything suggest at some point, it was possible in Phaser even if it not any more for some reason. For example, I'm not sure why the sort() method overriding the Z value instead of using the value. Well, I was looking at some Phaser 3 examples yesterday to see if it going to improve and seems like we are going to be able to change in Phaser 3 the Z Depth directly by doing sprite.depth = value and sprite.zDepth = value (seen both in different examples). I believe Phaser 3 is about to release next Monday on the 12th of February, I hope it is going to be "improved" In Phaser 2 it feels way overcomplicated
  8. Hi. I'm new to Phaser and would like to ask for some help with sorting Z depth of sprites using a custom Z value. I know the same question have been asked a million times on the forum but in most case the replies are link to examples and tutorials that explains only that we need to add our sprites to a group and use the sort() method to get the sprites Z depth sorted. I understand that, but I'm really would like to use a custom Z values to sort my sprites. What I'm trying to do, after added all my sprites to a group, I loop through all the children in the group and set their Z value manually, after run the sort() method on the group and I was hoping it is going to sort the Z depth but it does not. This is my code: create: function(){ for(var i = 0; i <= 50; i++){ group.children[i].z = 100; } for(var i = 51; i <= 100; i++){ group.children[i].z = 120; } }, update: function(){ group.sort(Phaser.Group.SORT_ASCENDING); } According to the documentation, If my understanding is correct, the sort() method should use the Z value of each children by default to sort the rendering order. But it is not the case. What seems to happening instead, it override the Z values of the children with their index value. For example, as you can see in my code I set the z value of children[5] to be 100, but what the sort() method seem to be doing is replace 100 with the index number which is 5. If I check the value of Z it return 5 and not 100. If I don't run group.sort() it solves the problem, if I check the value it returns 100 as I would expect, but it does not seem to sort the rendering order without running the sort() method on the group. In most game engines I have been using, there was a very simple, straight forward way to get this done. Normally, all need to be done is set the Z-Depth value but it seem to be not that simple in Phaser. Am I missing something? According to the documentation I think my code should work but it doesn't. I would appreciate any help. Thank you.
  9. Hi. I'm new to phaser and to this forum. I have a problem that I would like to ask for some help with. I'm trying to import a level from a JSON file exported from a 3rd party level editor that is not meant to be used with Phaser or any other 3rd party engine. It is just me trying to use the JSON coming from the editor to load the level in Phaser and I have some problem with rotation and scale of the sprites. The level editor rotate the sprites around a center point and scale the sprites from the origin point. In Phaser, I set the position of the anchor point to match the position of the origin point and set the position of the pivot point to match the position of the center point for each sprite and it works for getting the position and the rotation of the sprites but when I scale a sprite in the editor, it does not appear right in Phaser. This is how it looks like in the editor: And this is how it looks like in Phaser after import: Notice the distance between the two sprites. It does not match and I think it is because in the editor the sprite is scaled from the top left corner of the sprite (origin/anchor point) while in phaser it is scaled from the center of the sprite (pivot point). At least If I don't change the position of the pivot point, the scale and position works but then rotation is off because in the editor the sprite is rotated around the center point which is in the middle by default. In any case I can't find a solution to this. I can't get the scale match without messing up the rotation or the rotation without messing up the scale because of the two points. When I check the values, everything seems to match. Position, rotation, scale but it still does not look the same in Phaser. I hope someone did have the same problem with rotating and scaling sprites in Phaser and already figured a solution. What I would like to know specifically, is there any way to rotate a sprite around a middle point without changing the position of the anchor and pivot point or is there any way to scale a sprite from the anchor point instead of the pivot point? Because the problem seems to be in Phaser the sprites are scaled and rotated around the pivot point but in this case I need to scale it and rotate it in two separated points to get the same result as in the level editor. I would appreciate any help. Thank you.