paquiquinho Posted February 2, 2017 Share Posted February 2, 2017 Hey everyone, I've been lurking around this forums for a while now, getting all kinds of helpful tips for using Phaser and whatnot. However, I am now quite stumped, which lead me to finally making an account to ask for your help! Here's the deal: I'm working on a very simple top down shooter (wasd to move, shoot with mouse) at the moment and since my target platform is the web, I went with Phaser. While I'm a decent coder and have worked with the likes of Unity or Game Maker before, I'd never coded a game with the web in mind. The thing is, the way I envisioned this working is you get a fixed sprite (with walk animation) as your player object and you rotate it to face the mouse so you can shoot in that direction. This is where my experience with Phaser started falling apart. I started with arcade physics, which I quickly found out wouldn't work properly since rotation is not an option there. So I changed to P2 and that's where all hell broke loose. You see, I can't make my player shoot at the pointer for the life of me! This should be fairly trivial and I had it implemented in a prototype I made with Game Maker so I don't think I should be wasting all this time with this. Which then leads us to the title: Is Phaser the right engine for me? I don't really need physics (I just need to move to the sides a fixed amount every time a key is held down plus the shooting) so P2 is super overkill I think at this stage. What would the more experienced of you out there recommend? -Stick to Phaser's P2, even though it's a lot more than what I really need? -Change engine? If so, to what? -Am I just looking at my problem wrong? Link to comment Share on other sites More sharing options...
rgk Posted February 2, 2017 Share Posted February 2, 2017 Just so you know rotation works with arcade physics. https://phaser.io/examples/v2/sprites/sprite-rotation Most likely if you making a reasonable game for the web, phaser is right for you. I do agree p2 seems like over kill. Link to comment Share on other sites More sharing options...
paquiquinho Posted February 2, 2017 Author Share Posted February 2, 2017 12 minutes ago, rgk said: Just so you know rotation works with arcade physics. https://phaser.io/examples/v2/sprites/sprite-rotation The problem with this is that it doesn't rotate the hitbox as far as I can tell. So if I have a rectangular sprite, when I rotate it, it messes up hit detection. I was designing around this at first by only having square sprites but that's a compromise that I just can't make. Link to comment Share on other sites More sharing options...
samme Posted February 3, 2017 Share Posted February 3, 2017 Did you try http://phaser.io/docs/2.6.2/Phaser.Weapon.html#fireAtPointer or http://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.html#moveToPointer? You can often use a square or circular body shrunk slightly to cover most of the sprite and still get a believable effect. Link to comment Share on other sites More sharing options...
Recommended Posts