Aerion Posted October 28, 2017 Share Posted October 28, 2017 (edited) Hi folks. How do I get my character to walk and attack at the same time with 2 separate character atlas files? For instance, when you're walking, you press a key & while holding the walking keys, you can swing your sword WHILE walking at the same time through 2 separate but similar animation atlases. Thanks! ~M Edited October 28, 2017 by Mythros Link to comment Share on other sites More sharing options...
Aerion Posted October 28, 2017 Author Share Posted October 28, 2017 Does anyone know? Link to comment Share on other sites More sharing options...
Aerion Posted October 29, 2017 Author Share Posted October 29, 2017 Can someone please help? Thank You much! ~M Link to comment Share on other sites More sharing options...
Secretmapper Posted October 29, 2017 Share Posted October 29, 2017 Your question is too vague/general to answer. I'm assuming you have 2 animation atlas (one walking and one attacking). You can move the sprite while having the attacking animation, but that's it - unless you have a 'attacking while walking' animation. Link to comment Share on other sites More sharing options...
Aerion Posted October 29, 2017 Author Share Posted October 29, 2017 Yes @Secretmapper I'm using 2 animation atlases. Link to comment Share on other sites More sharing options...
Andy R Posted October 29, 2017 Share Posted October 29, 2017 afaik sprites can't be associated to 2 sprites sheet (if by atlas you mean spritesheet). you have to merge both animations in same spritesheet and then call the frames when you need it Link to comment Share on other sites More sharing options...
Aerion Posted October 29, 2017 Author Share Posted October 29, 2017 You can't just flip-flop? Or maybe trick it and change the sprite's alpha to 0 and switch to the 2nd sprite then after the attack set THAT alpha to 0 and switch back to the original sprite? I need a demo example that can do this. Link to comment Share on other sites More sharing options...
Skeptron Posted October 29, 2017 Share Posted October 29, 2017 You should look at Spine if you want to combine animations. Definitely the best way to do it. Link to comment Share on other sites More sharing options...
Aerion Posted October 29, 2017 Author Share Posted October 29, 2017 @Skeptron What is spine? Link to comment Share on other sites More sharing options...
Skeptron Posted October 29, 2017 Share Posted October 29, 2017 http://fr.esotericsoftware.com/ Link to comment Share on other sites More sharing options...
Aerion Posted October 30, 2017 Author Share Posted October 30, 2017 Thank you but this doesn't really help.. no offense. ~M Link to comment Share on other sites More sharing options...
Skeptron Posted October 30, 2017 Share Posted October 30, 2017 Well, if you used Spine you could combine all of your animations (walk and attack, run and block etc. etc.), and you would have only one atlas with just the body parts, not all the frames of all the animations. Infinite animation fluidity with infinite combinations. Link to comment Share on other sites More sharing options...
Aerion Posted October 30, 2017 Author Share Posted October 30, 2017 Again, thanks bro but it doesn't really help if I cannot afford it... Can someone please help that deals with atlases & animations? Thanks ~M Link to comment Share on other sites More sharing options...
Secretmapper Posted October 31, 2017 Share Posted October 31, 2017 Combine your atlas to one, otherwise you'll have performance issues. If you want something easy though, you can switch out your texture atlas using `loadTexture` sprite.loadTexture(key, frame, stopAnimation)https://phaser.io/docs/2.6.2/Phaser.Sprite.html That is, you can have the sprite, then when walking change the texture with loadTexture, and when attacking change it again with loadTexture. Again, I encourage you to combine these and just use multiple animations (attacking animation, walking animation) However, note that it will always look like it's walking OR attacking, it can't be both - Think about it, your images sprite sheets are walking and attacking, no game engine will magically make it look like it's doing both. Unless you use a skeletal animation system like Spine, DragonBones, or Creature Link to comment Share on other sites More sharing options...
Aerion Posted November 8, 2017 Author Share Posted November 8, 2017 I just wanna walk and swing a sword. Link from Legend of Zelda series is a PERFECT idea of what I want to do here. As long as it can be done easily & free that's all I care about. An example would be great! <3 Thank you SO MUCH! <3 ~M Link to comment Share on other sites More sharing options...
samme Posted November 9, 2017 Share Posted November 9, 2017 You need to do one of these: create a new atlas/spritesheet with all the frames use two sprites and switch between them by toggling exists use one sprite and switch between textures with loadTexture Capitaine Herlock 1 Link to comment Share on other sites More sharing options...
BitOfGold Posted November 9, 2017 Share Posted November 9, 2017 Or, (just an idea) you can have two sprites as layers over each other: one is for the lower body (running) one is for the upper body over it (fighting) Link to comment Share on other sites More sharing options...
Secretmapper Posted November 12, 2017 Share Posted November 12, 2017 On 11/9/2017 at 5:52 AM, Mythros said: I just wanna walk and swing a sword. Link from Legend of Zelda series is a PERFECT idea of what I want to do here. As long as it can be done easily & free that's all I care about. An example would be great! <3 Thank you SO MUCH! <3 ~M The original Zelda doesn't walk and attack at the same time though. Can you link a gameplay video of the specific installment you mean? Also, as I mentioned already, what you need to do is have a special/separate 'attacking while walking' animation. No engine can magically combine both, other than through clever tricks that would be harder for a beginner. For examlple, BitOfGold's idea might work for you, but now you are using two sprites to represent one while keeping them in sync and do all physics at the same time. Much easier and faster to just make the art Link to comment Share on other sites More sharing options...
Recommended Posts