Beocro Posted July 27, 2015 Report Share Posted July 27, 2015 Hey everyone! Normally I wouldn't post on the forums for a problem, but I've been trying to figure this out for quite a while with no dice. I've been trying to render the Grey Guy using Trixt0r's Java-Spriter library with the Java2D method, but for some reason, the head and his hair aren't wanting to be rendered correctly.(That black blob on his chest is the 'hair') They just won't stay in the right positions. I really don't know what to do. Could there be a bug in the library code, or did I just mess up somewhere (most likely)? Does anyone know what could cause this? I'm fairly sure I duplicated the code from the examples exactly, so I won't post the code unless I really need to. Hopefully someone can help me, progress on my game has been halted while I try to figure this out. :) Here's the Spriter project+files if you want to inspect them: http://filz.us/2ztZNote: I did PM Trixt0r about this a few days ago and haven't gotten any response, so I'm hoping the community can help me out. JohnnyType 1 Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted July 28, 2015 Report Share Posted July 28, 2015 Hi Beocro, I'm not a programmer, so can't help from that end... but what about an un-edited version of the grey guy... does that work properly (assuming you added the hair yourself.) Thanks. -Mike at BrashMonkey Quote Link to comment Share on other sites More sharing options...
Beocro Posted July 28, 2015 Author Report Share Posted July 28, 2015 It does appear to be working fine... Strange. Maybe it is something to do with character mapping? I used character mapping in the first one. I'll test it. Quote Link to comment Share on other sites More sharing options...
Beocro Posted July 28, 2015 Author Report Share Posted July 28, 2015 I figured it out! It was the fact that I scaled the head and hair, I think Trixt0r's library might not handle that correctly (which would be surprising) or I made some kind of mistake in the rendering code (more likely). I'll try to figure it out and will return with the results. Quote Link to comment Share on other sites More sharing options...
Trixt0r Posted July 28, 2015 Report Share Posted July 28, 2015 Sorry, I did see your message, but forgot to answer back -.- Are you using the Java2D renderer, I implemented or your own? If not mine, can I see the code? Is the character rendered correctly with LibGDX, Slick2D and LWJGL? - Trixt0r Quote Link to comment Share on other sites More sharing options...
Beocro Posted July 28, 2015 Author Report Share Posted July 28, 2015 I sort of copied your library over to my engine. I never tested your example, so I will when I get home. Quote Link to comment Share on other sites More sharing options...
Beocro Posted July 30, 2015 Author Report Share Posted July 30, 2015 Sorry it took so long to respond! I got a little busy. ^-^" I just tested scaling in your example with Java2D, and it seems to work perfectly fine. Obviously, I messed something up when copying it over. I'll see if I can figure out what I did wrong. Quote Link to comment Share on other sites More sharing options...
Beocro Posted July 31, 2015 Author Report Share Posted July 31, 2015 I figured it out! I have absolutely no idea why this worked, but I was trying to adjust values to get it to render correctly and happened to fix it. I simply replaced this code in my Drawer implementation's draw() method: int height = -(int)(sprite.getHeight()*object.scale.y);graphics.drawImage(sprite, (int)newX, (int)newY-height, (int)(sprite.getWidth()*object.scale.x), height, null); with this: graphics.drawImage(sprite, (int)newX, (int)(newY+sprite.getHeight()), (int)(sprite.getWidth()*object.scale.x), (int)(-sprite.getHeight()*object.scale.y), null);//Note the lack of *object.scale.y in the Y position. I assume it was my mistake with my implementation anyway, but at least I got it working, although I am still perplexed about how this fixed it. Quote Link to comment Share on other sites More sharing options...
Trixt0r Posted July 31, 2015 Report Share Posted July 31, 2015 Good job. Yes. The Java2D renderer renders the animation not correctly ( the Slick2D renderer also), while LibGDX and LWJGL do it properly. The problem is, that the y-axis in Java2D is inverted while in Spriter it is not. I will push the fix today. Thanks for figuring it out. - Trixt0r Beocro 1 Quote Link to comment Share on other sites More sharing options...
Trixt0r Posted July 31, 2015 Report Share Posted July 31, 2015 Its fixed, but the problem, was the fact, that Math.signum has been called on the scaling, which is removed now. - Trixt0r 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.