Animated Sprite In Window (Fixed)

Status
Not open for further replies.

Yin

Veteran
Veteran
Joined
Jul 18, 2012
Messages
133
Reaction score
50
First Language
English
Primarily Uses
N/A
Hello JS Coders,


I've been trying to make a sprite animate in a window for the longest time and have not been able to get it working. I assume I am doing something wrong with the creation of the sprite itself.


this.updateBitmap() is the function that shows the sprite on the window. (It sets this.bitmap to this.frame). I assume somewhere in here is where it goes wrong.


The sprite itself won't even show up! Also note that if I use var pic = bitmap, the image shows in its entirety as well as cut into the blt. 


This is what pic prints when using var pic = bitmap





This is what prints when var pic = new Bitmap(w, h)





So now I'm wondering if my blt is wrong somehow because it shows one way and the other way it doesn't. I'm confused as to if I'm supposed to wait for pic to load because it's using an already loaded bitmap.


I then have my update method set to run this code:
 


Sprite_MenuAnimations.prototype.updateBitmap = function() {
this.bitmap = this.frames[this.frame];
};


This seems to work out (When I use the var pic = bitmap), but the previous image (from the animation) doesn't go away.


When using pic = bitmap, this seems to load the blt as well as the spritesheet itself. (If you look close enough, you can see the blt'd frames on row 3 col 3)





Which is an undesired effect. I just want the blt to show. 


Any help on this would be appreciated. I hope I have provided enough details to receive help on this!


Fixed! Thanks to Tsukihime for realizing my error.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I will close this, but please don't edit your post when it's fixed and set everything to strikethrough.  We keep posts around after they're resolved so others who have the same (or similar) questions can benefit from your thread, and strikethrough makes it a bit hard to read (and for the same reason, if you had an error, it's a good idea to say what it was, just so others can see the solution).
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top