Santiago Posted January 13, 2018 Share Posted January 13, 2018 Hello, I'm doing a fighting videogame and I'm using Arcade Physics. since it's not possible to use multiple bodies with Arcade I'm trying to figure out how to update the bodies of my charecter (for complex positions I'll use more than 1 body to make it) once a key is down and when is up go back to the idle body. One of the possibilities I had in count and I tryied witout success is checking the current frame animation and adding some new invisible sprites like collliders and destroying it after the next frame. The first problem I had with it is that working on Update function it creates me a lot more extra sprites that waste resources, and had no success deletting it once the frame changes, I used this code: if (this.viking.animations.currentAnim.name == 'attack') { this.p = game.add.sprite(this.viking.x, this.viking.y, 'feet'); this.player.add(this.p); this.p.body.setSize(22,11,29,78); } if (this.p != undefined && this.viking.animations.currentFrame.name != "ataque_1"){ this.p.destroy(); } The second possibility but I did not try is adding all the sprites I need to the player group and when I need it "activate" it with some property and check collisions with those invisible sprites, but I think will require a lot of resources that are no need it because there are a lot of animations and almost each animation needs +2 sprites for it, or if it can be another more efficent way to do this I don't know it yet. If anyone can help contributing another technique I could usem any idea or any help to do what I got in mind I'll be glad for it. Link to comment Share on other sites More sharing options...
Santiago Posted January 18, 2018 Author Share Posted January 18, 2018 bump Link to comment Share on other sites More sharing options...
Capitaine Herlock Posted January 18, 2018 Share Posted January 18, 2018 Hi, I am actually using this tool for my spritesheet https://www.leshylabs.com/apps/sstool/ Link to comment Share on other sites More sharing options...
samid737 Posted January 18, 2018 Share Posted January 18, 2018 You don't need to add sprites during update for that. You can try adding the relevant child sprites during create, then enable their physics bodies for some frame: You could do the same using A group. Link to comment Share on other sites More sharing options...
Recommended Posts