1
votes

I've been working on a new game, and I just put in my first animation, an explosion.

The problem is this. The explosions spritesheet is 1200x100, made up of 12 100x100 frames. The explosion animates fine EXCEPT the origin is behaving strange. I want the explosion to be centered, so I specify 50, 50 as I've done on previous games in the past. This centers in the Y direction but in the X direction its only moved slightly.

After some fiddling I noticed that if I put the origin as 600, 50 (half the spritesheets width) it centers correctly. This makes no sense. I've used this animation code before and never had this problem. I've ensured the values are all being passed correctly, and the destination and source rectangles look to be correct... I am STUMPED!!

I tested Monogame and there is something going on between XNA vs monogame. I've made this sample for anyone whos interested to download and inspect for themselves. As you'll see, in the XNA version the black dot is in the middle as it should be, but on the monogame version its way off center.

Not sure whats causing this. Rectangle or spritebatch.draw differences? or perhaps its the way the textures are processed using the monogame content project. Any help is greatly appreciated!!!

To run this you'll need xna 4.0 installed as well as monogame 3.0 http://www.filedropper.com/testanimation

http://monogame.codeplex.com/releases/view/102870

1
Are you using MonoGame or XNA? Is the behavior identical in both? The origin is supposed to be taken from the sourcerectangle I believe, so this might be a bug in MonoGame. It would be surprising to find this kind of bug in MonoGame, but still.Asik
Using monogame. Thats the last thing i was thinking was that maybe it was a monogame bug. Though as i said, the rectangles look correct, and as u said, it would be surprising to find something like this. I'm gonna test anyway, cause the old game that it works fine with was XNAHardycore
What is the Animation.Initialize method doing?craftworkgames
Posted the initialization code along with the constructors though as you'll see theres nothing particularly interesting going on here. I'm gonna test the code with XNA instead of monogame and see what that yeilds. Will report back!Hardycore
I've put together a test file that anyone can download and see for themselves what i'm experiencing.Hardycore

1 Answers

0
votes

Well I've figured it out!

Seems it was a problem with the content builder in the 3.0 monogame release. Today the 3.0.1 release came out, so I uninstalled 3.0 and installed 3.0.1.

I then ran the project, the problem still remained. So i opened my content project, rebuilt all my content, copied over the files and tries again, problem solved!!! :D

TY Dr. Asik for spurring me into the right direction! :)