HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.98k stars 439 forks source link

FlxSprite animations don't work the same for cpp targets #130

Closed gamedevsam closed 12 years ago

gamedevsam commented 12 years ago

I'm having an issue where my "sword slash" animation doesn't end on the same frame when compiled in cpp as it does when compiled for Flash. This is causing an odd visual artifact and I can't figure out what's causing it. The animation handling code is the same for both, it must be some kind of drawing issue. Could you help me figure it out Zaphod?

You can trigger the animation by pressing 'SPACE' or 'C' on the keyboard.

You can see the animation ending correctly on the Flash Target here: http://www.sambatista.com/_secret/Haxe/HaxePlatformer/

But when I compile for the cpp target the Sprite ends on the first frame of the animation. You can get the source here: http://www.sambatista.com/_secret/Haxe/HaxePlatformer/HaxePlatformer.zip

The sprite is located in "Source/game/actors/playerstates/PlayerStateSlashGround".

Thanks!

Beeblerox commented 12 years ago

@crazysam I'll try to find out there is the problem

Beeblerox commented 12 years ago

@crazysam That was relatively easy to find :) The size of image is "wrong". It's width should be 260 * 3 = 780 px (but you have 779 px). It is not important on flash target, but on cpp or neko it shouldn't be less than "number of frames in a row multiplied by frameWidth". The same applies to height (number of frames in column multiplied by frameHeight)

gamedevsam commented 12 years ago

You know... half the reason I use HaxeFlixel is so I can tap into your awesome brain xD

Thanks a bunch dude!