Honestly, I do not know where to start. I’m just trying to make a mario style side scroller, with a character that can fire a weapon, and pick up items. First I started with Phaser 2, thinking it was a good way to start. I could not have been more wrong. What happens was I used arcade physics, but was limited in what I could do, so I tried ninja without realizing it doesn’t even work. Then I tried p2 and successfully got my character to fire a weapon and walk with the keyboard, but the on screen controller for mobile only moves the player once, and doesn’t animate as it walks. Also, collideworldbounds doesn’t even work in p2. So, after days of staring at my screen trying to win a losing battle, I decided I should just learn phaser3. Now I have even more problems. I cannot even get my Jason file player to work, as it was working totally fine in phaser 2. Working in tiled makes no sense to me, as I swapped out sprites, but then nothing appears when I load my game, but the physics collisions exist. I am going crazy trying to make the computer do what it is supposed to. I’m not sure if it’s a joke or what when I hear this framework makes developing a game easy. Also half the time when I change something, I have to clear the cache and reload my game thru wamp to get rid of old assets, and other times that doesn’t even work and they are still there. Very thoroughly confused about literally everything to do with phaser and tiled. I am following all the tutorials. -.-
What’s your issue exactly?
Give a change to this tutorial: https://www.youtube.com/watch?v=wDOym-mXxO4&list=PLitFP8FdScfHcJQ-kDmm0i6aOhinVO7ND
It was very elucidating to me.
Let’s just start with the json file player, once I figure that I will trouble shoot the tiled map more. I get an error saying “cannot read property ‘frame’ of undefined” yet ALL I’m doing is swapping out the png spritesheet of the player, and the json file that worked in phaser 2. I am using an existing mario style platformer with an established player, and script for animations already in create function. I’m just swapping the graphic and it gives me an error.
Hello @Ross_Evan, what did you use for making your player json and png ?
If it’s Texture-Packer, you need to export it again with phaser 3 settings.
Ah I did not know that, how do I do that? I am using texturepacker. I sort of resolved the problem by cheating. Essentially took the player’s sprite sheet, and then overplayed my character frames in illustrator, dropped the original layer opacity to 0. I used the exact same json file as the original, so it sort of works but needs tweaking. There seems to be many many compatibility issues between versions, almost to the point that now I have to completely re figure out how to do just about everything.
Hey again @Ross_Evan, yea unfortunataly it’s totally different but yet simple as before with phaser3.
It has changed a lot, uses eventemitter3 for most events. It’s one the core plugins that’s required. And a lot to see, i believe there are a lot’s of basic tutorials online, you should atleast go through one finish it, and when ever you stuck somewhere, look for phaser3-examples, look up for documentation (which is quite usefull for me always) and also like you did with this, search and ask questions from here. And i believe in really short time, you will figure this out everthing
For your problem, you can look up this link from Texture-Packer. Also here is the option for phaser-3:
Just put every images like you did before and select this option from Convert to framework option. After that in your preload
function:
this.load.atlas('player', 'player.png', 'player.json');
And inside your game, just create your player as Phaser.GameObjects.Sprite
also create your anims from config like this and then on your player object just call,
player.anims.play('YOUR_ANIM_NAME');
Hope this would be helpful
Thank you so much for taking the time to write all this. I’m responding months later because I have gotten pretty involved with this, now I have a new slew of problems haha . It did work, thanks for showing me that option for phaser 3
Pain
If you’re going to make something with quality you must start from your development setup. You’ve started from nothing, that’s why you’re going to crazy.
I can help you with Phaser 3 template if you’re using ES6 or TypeScript. It will automatically rebuild and reload your page in miliseconds after you’ll press save. And it’s not an empty template so you can do things based on example in it. And if you’re okay with OOP and MVC design pattern it will be more easy for you.