When im debugging the code it says its running the correct animations on my spritesheet but for some reason the sprite doesnt change, its probably just some silly mistake on my part but i cant for the life of me locate it!
Any help wouyld be greatly appreciated!
Code:
My button animation class: http://pastebin.com/RsCb46mT
My button class: http://pastebin.com/nCvJysiv
My Gameworld: htt p://past ebin.com /T786mEN4
Any help would be greatly appreciated!
I may be wrong, I am not at a computer right now, but I think your Spritebatches draw is wrong. You are only changing the output position of the button, not the position where you read it on the texture, could it be?
Hmm you might be on to something here, im gonna give it a look!
Hmm no everything is as it should be i think at that part ![:confused: :confused:](https://community.monogame.net/images/emoji/twitter/confused.png?v=9)
You should comment some parts of the code, so you will be able to find where the problem lies by a sort of dichotomy method
Yeah thats actually what im doing right now, but since there is no error pr say its a bit difficult. I guess its just a matter of me not being entirely sure how all of my code works together right now, as this setup is kinda an experiment where im taking something from each of 2 ways of which to instantiate objects with animations.
first of all, your third link is not written correctly, you have a random space in there.
Now, I can say with 99% certainty that itâs not some MonoGame-behind-the-scenes problem.
You said that you debugged the code.
Sooo I guess you set a breakpoint right before the _spriteBatch.Draw(), right?
And you checked that the output position and the position from which you read the texture are correct?
If not 100% certain do it again and go back from there. I am pretty sure spritebatch does what it is supposed to do, so somewhere in the code you donât update the readout position for the next sprite correctly.
Sorry for being so vague, hard to tell whatâs the problem.
Add a breakpoint to your PlayAnimation method. I cant see where you set your currentState variable, but I have a feeling that you missed that one, this is why your animations will never play.
And just a side-note: maybe you should reorganize your AHeroClassBtn Update method to remove the unnecessary Intersect validation and shorten the code.
Kosmoâ>
Yeah all the value at spritebbatch.draw seems to be right, but im tracing the route all the way now and hope i find what im missing that way.
Kuzâ>
Glad you mentioned it as the currentState variable was something i used for the âold wayâ i did it before deciding to be creative, its not doing anything so should have deleted it long ago, thanks ![:stuck_out_tongue: :stuck_out_tongue:](https://community.monogame.net/images/emoji/twitter/stuck_out_tongue.png?v=9)