krystianjjj Posted October 12, 2014 Share Posted October 12, 2014 Hello, I have started using panda js which is awesome. I got some questions to it. 1. Is it possible to remove animation just after playing it e.g. onComplete function does not work, at least I wasn' able to handle it?2. Is it posible to set framerate for game in config?3. If I run some animation onComplete of another animation there is a one blink of new animation at position x=0, y=0 (but the position of new animation is defined somwhere else). Thank you for answering those questions Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 12, 2014 Share Posted October 12, 2014 Yeah, panda is awesome! BTW, about your questions: 1) you can create your animation with:var yourObject = new game.Animation( 'images/obj-1.png', 'images/obj-2.png', 'images/obj-3.png' );yourObject.animationSpeed = 0.1;yourObject.anchor.set(0.5, 0.5);yourObject.play();yourObject.loop=false;game.scene.stage.addChild(yourObject);This code play your animation only one time, and the last frame will be your final texture (in the example case, obj-3.png will be the static sprite). With :yourObject2 = new game.Animation( 'images/FINAL-Sprite.png' ); yourObject.onComplete(function(){ yourObject.textures = yourObject2.textures;});yourObject.play();You'll change the sprite of your object to a new one (in this case FINAL-Sprite.png) 2) I don't know if you can set a FPS limitation, sorry ^^ 3) maybe you want to use .textures function, see answer #1 Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 13, 2014 Author Share Posted October 13, 2014 Thank you for an answer. With the second scenario I get an error in line 126 (Uncaught TypeError: object is not a function) yourObject = new game.Animation( 'pyt-short_000.png', 'pyt-short_001.png', 'pyt-short_002.png' ); yourObject.position.set(0, 0); yourObject.anchor.set(0.5, 0.5); yourObject.animationSpeed = 0.3; yourObject.play(); yourObject.loop = false; game.scene.addObject(yourObject); yourObject2 = new game.Animation( 'LFruits_sym1_00019.png' ); yourObject.onComplete(function(){ yourObject.textures = yourObject2.textures; }); yourObject.play();Anyway I got another question. Is it possible to wait for animation complete until the next code will be executed, or even execute some code with some delay regarding current animation. Lets say I have 3 fileds and I want to make an animation on three of them. Fitstly I would like to run animation on 1st one then in the middle of current animation run animation on 3rd field and then in the middle of second animation run animation on 2nd field. In all cases animation is the same. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 13, 2014 Share Posted October 13, 2014 That's a strange error. The only difference with my code is that I used game.scene.stage.addChild(yourObject); instead of game.scene.addObject(yourObject). You can check the frame number with currentFrame. http://www.pandajs.net/docs/classes/game.Animation.html#property_currentFrame Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 18, 2014 Author Share Posted October 18, 2014 Thank you, Phempt Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 18, 2014 Share Posted October 18, 2014 did you solve your problem? Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 19, 2014 Author Share Posted October 19, 2014 I have solved the problem using your sugestions. Currently I am trying to use Spine to mix animations. I would like to ask you if its possible to set zIndex for emitter and if its possible to make an emitter on BitmapText? Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 19, 2014 Share Posted October 19, 2014 This could be a question for @enpu btw in the past I opened a 3D about Z-Index:http://www.html5gamedevs.com/topic/9789-define-a-z-index-for-specific-spriteelements/ Try to adapt that code to your needs Quote Link to comment Share on other sites More sharing options...
enpu Posted October 19, 2014 Share Posted October 19, 2014 Here is example on using Spine:http://www.pandajs.net/snippets/abe10c596be2aeb660e7.html Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 19, 2014 Author Share Posted October 19, 2014 Hi enpu, the question was if its possible to use emitter on BitmapText? @phempt, thanks I will use that to set zIndex. Thank you for answering those questions, I am kind of new in dev games. Btw which is the best free editor for JS. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 19, 2014 Share Posted October 19, 2014 You mean use BitmapText as particle on emitter? I'm using Sublime Text:http://www.sublimetext.com/ Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 19, 2014 Author Share Posted October 19, 2014 I would like to particle some text in the game. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 19, 2014 Share Posted October 19, 2014 Yes that's a bit tricky one, but this should work:https://gist.github.com/ekelokorpi/092a83c41cfaa5ca4851 Quote Link to comment Share on other sites More sharing options...
krystianjjj Posted October 19, 2014 Author Share Posted October 19, 2014 Great I will try that. Thanks guys for your support Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.