Gyldstrand Posted January 13, 2016 Share Posted January 13, 2016 Abandoned. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 13, 2016 Share Posted January 13, 2016 I had code just for that thing somewhere. I'll try to find it. And when that thing will be merged https://github.com/pixijs/pixi.js/pull/2237 you'll be able to remove huge number of lines from your code. That is the patch for fixing crop and rotations of texture, you said that crop isnt working right, so im gonna fix it again. That patch contains class GroupD8 which is handling all rotations and reflections in 8 directions. Quote Link to comment Share on other sites More sharing options...
Gyldstrand Posted January 13, 2016 Author Share Posted January 13, 2016 Will that work with a sprite sheet or is it for rotating a single image? Quote Link to comment Share on other sites More sharing options...
mattstyles Posted January 13, 2016 Share Posted January 13, 2016 Thats some crazy logic going on! Will make maintenance/improvements fun! Why not simply sum the movement inputs and then get your direction from that? This way an x++ and an x-- (D and A) simply cancel each other out resulting in 0 movement along the x axis. This will result in 9 states for your sprite, which is far easier to manage than all those conditionals. Sounds like you'll probably need to keep track of your current state and the last state so that when you hit the idle state (no key presses, or, more accurate, no forces—if you are summing forces then hitting all keys will result in 0 force) you check the last state and play the idle animation related to that last state. If you only had one idle animation then there would be no need to keep track of the last state. Quote Link to comment Share on other sites More sharing options...
Gyldstrand Posted January 13, 2016 Author Share Posted January 13, 2016 Every time I tried one of the simple methods I would get problems when multiple directions are pressed so I started force feeding it code. If I use 1 idle animation with all the idle frames wouldn't I still have to set it in the same spots as the current individual ones and specify the frame start and end? I don't really want the directions to cancel each other out cause that causes a lot of random stops in the player movement. Also looking for a way to continue an animation cycle through direction changes. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted January 13, 2016 Share Posted January 13, 2016 5 hours ago, Gyldstrand said: I don't really want the directions to cancel each other out cause that causes a lot of random stops in the player movement. I'm not following, why random stops in movement? The movement is controlled by the keypresses, doesnt really matter if you sum forces after gathering keypresses or stop forces from occurring whilst gathering keypresses. At the end of gathering input your character is in 1 of only 9 possible movement states (4 cardinal directions, 4 diagonal directions and 1 stopped/idle state), it can only ever be in 1 of those states so your animation code becomes simpler—just display the animation associated with the state. Shame you abandoned the project, on to better/new things hopefully. Quote Link to comment Share on other sites More sharing options...
Gyldstrand Posted January 13, 2016 Author Share Posted January 13, 2016 I just deleted what I had to start again. Back to studying the RPG Maker MV files. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 14, 2016 Share Posted January 14, 2016 Im studying them too, by the way Quote Link to comment Share on other sites More sharing options...
Gyldstrand Posted January 14, 2016 Author Share Posted January 14, 2016 Just give me your brain when you're done. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.