1 decade ago by silverspectro
Hi everybody,
I've a bit of a problem ( like it isn't obvious enough ), i would like to do some animation before my title screen. For this i wanted to use AnimationSheets, but infortunately, i've been unable to make it work outside an entity.
I've checked the documentation and it is possible apparently...
I'm doing something wrong but i don't know what.
here's my code :
When i run this everything is fine, there is just one problem, the animation doesn't start...my sprite is drawn on the screen, but there isn't the rest of the animation, like if it was stuck at the first image...
If anybody have any idea, i'd be very happy to hear it
thank you very much ! ^^
I've a bit of a problem ( like it isn't obvious enough ), i would like to do some animation before my title screen. For this i wanted to use AnimationSheets, but infortunately, i've been unable to make it work outside an entity.
I've checked the documentation and it is possible apparently...
I'm doing something wrong but i don't know what.
here's my code :
IntroScreen = ig.Game.extend({ animSheet: new ig.AnimationSheet ( 'media/welfring.png', 30, 30 ), init: function() { ig.input.bind( ig.KEY.X, 'start'); }, update: function() { var walk= new ig.Animation( this.animSheet, 0.2, [1,2,3,2]); if(ig.input.pressed ('start')){ ig.system.setGame(StartScreen) } this.parent(); }, draw: function() { var walk= new ig.Animation( this.animSheet, 0.2, [1,2,3,2]); walk.update(); this.parent(); walk.draw( ig.system.width/2, ig.system.height/2 ); } });
When i run this everything is fine, there is just one problem, the animation doesn't start...my sprite is drawn on the screen, but there isn't the rest of the animation, like if it was stuck at the first image...
If anybody have any idea, i'd be very happy to hear it
thank you very much ! ^^