enpu Posted February 17, 2014 Share Posted February 17, 2014 Do you have a feature that you would like to have in Panda.js? Post your requests here or use GitHub issue tracker. Quote Link to comment Share on other sites More sharing options...
gregmax17 Posted February 17, 2014 Share Posted February 17, 2014 I don't know if this is implemented or not (haven't looked through the docs fully), but I would like to the engine to load only the assets needed for the current (or soon to be) scene. Maybe a property to set whether this behavior is turned on or off. If its on, its possible to set a fade in/out time of the current scene, to fade into the loader, load the assets, then fade into the new scene. The fade time (and color?) could either be instant or a set time. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 17, 2014 Author Share Posted February 17, 2014 Dynamic loading between scenes is not supported, but that's a good idea!Will add this to the 1.2 milestone (or if i'm fast enough, will be at 1.1). Thanks! Quote Link to comment Share on other sites More sharing options...
enpu Posted February 17, 2014 Author Share Posted February 17, 2014 It was actually easier than i though, i just pushed new version with dynamic loader into develop branch on GitHub:https://github.com/ekelokorpi/panda.js/tree/develop Download and test it. Here is example on how it works:http://www.pandajs.net/tutorials/example-13/ Quote Link to comment Share on other sites More sharing options...
Skwal Posted February 19, 2014 Share Posted February 19, 2014 I have a suggestion Instead of repeating all the images path like this:// Load imagesgame.addAsset('images/image1.png'); game.addAsset('images/image2.png'); game.addAsset('images/image3.png'); SceneGame = game.Scene.extend({ init: function() { var sprite = new game.Sprite(100, 100, "images/image1.png"); sprite = new game.MovieClip([ game.Texture.fromImage('images/image1.png'), game.Texture.fromImage('images/image2.png'), game.Texture.fromImage('images/image3.png') ]); // etc... } }); It would be nice if the addAsset() function would also return the path so we could store for future uses. That way if we need to change the assets path or filename, we don't need to change everywhere in the code. Something like this would be nice:// Load imagesvar img1 = game.addAsset('images/image1.png'); var img2 = game.addAsset('images/image2.png'); var img3 = game.addAsset('images/image3.png'); SceneGame = game.Scene.extend({ init: function() { var sprite = new game.Sprite(100, 100, img1); sprite = new game.MovieClip([ game.Texture.fromImage(img1), game.Texture.fromImage(img2), game.Texture.fromImage(img3) ]); // etc... } });[edit] I like gregmax17's even more (see below) Skwal 1 Quote Link to comment Share on other sites More sharing options...
gregmax17 Posted February 19, 2014 Share Posted February 19, 2014 or maybe giving it an reference id?game.addAsset('img1', 'images/image.png');// later on...var img1 = game.Texture.fromImage('img1'); Skwal 1 Quote Link to comment Share on other sites More sharing options...
enpu Posted February 19, 2014 Author Share Posted February 19, 2014 Hi, That's good idea! Just pushed new core.js into develop branch, that returns path in addAsset function.Will implement the reference id later. Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 would you consider additional tween interpolations such as Bezier and Catmull? Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Absolutely! I was thinking about to replace tween module with this one:https://github.com/sole/tween.js/ What do you think? Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 Absolutely! I was thinking about to replace tween module with this one:https://github.com/sole/tween.js/ What do you think? I was using sole's Tween until I found that tweens are not synced and there's no grouping. Look at https://github.com/sole/tween.js/pull/88 The suggested mod kinda works, but for some reasons I get out of sync animations anyway on the long run. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Damn that sucks! I will try out if i can fix that. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 I just created new branch tween with sole's Tween engine:https://github.com/ekelokorpi/panda.js/tree/tween Can you test it and see if you can get tweens out of sync, because i can't get. There is ready scene with two repeating sprite tweens with different durations. Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 did you apply the fixes from the PR I linked above? Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Yes, and changed tween engine to use game.Timer.time Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 This is probably the best demo to test syncing game.module( 'game.scenes').require( 'engine.scene').body(function() {SceneGame = game.Scene.extend({ backgroundColor: 0x808080, init: function() { var sprite, tween; // Sprite 1 sprite = new game.Sprite(0, game.system.height / 2, 'media/logo.png', { anchor: {x: 0.5, y: 0.5} }); tween = new game.Tween(sprite.position) .to({y: 0}, 500) .repeat(Infinity) .yoyo(true) .start(); this.stage.addChild(sprite); // Sprite 2 sprite = new game.Sprite(game.system.width, game.system.height / 2, 'media/logo.png', { anchor: {x: 0.5, y: 0.5} }); tween = new game.Tween(sprite.position) .to({y: 0}, 500) .repeat(Infinity) .yoyo(true) .delay(200) .start(); tween.delay(0); this.stage.addChild(sprite); // Sprite 3 sprite = new game.Sprite(game.system.width / 2, game.system.height / 2, 'media/logo.png', { anchor: {x: 0.5, y: 0.5} }); tween = new game.Tween(sprite.position) .to({y: 0}, 500) .repeat(Infinity) .yoyo(true) .delay(100) .start(); tween.delay(0); this.stage.addChild(sprite); }});});Everything seems to work as expected (except for a very bad tearing... I've never seen it so pronounced, but maybe I just have too many chrome tabs opened ) As long as you keep tween grouping like before, I'm in for the new system The problem would be to keep up with the main repo updates maybe. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Great! What do you mean by bad tearing? Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 Tearing PS: there's a flaw in the above sync demo, if the duration is really low the delay(0) could be executed too late. So maybe a delayOnlyOnStart option would be desirable. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 sprite = new game.Sprite(game.system.width / 2, game.system.height / 2, 'media/logo.png', { anchor: {x: 0.5, y: 0.5}});tween = new game.Tween(sprite.position) .to({y: 0}, 500) .repeat(Infinity) .yoyo(true) .delay(100) .start();tween.delay(0);this.stage.addChild(sprite);I don't understand, why do you set delay twice there? Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 Delay is applied at each iteration, if you want delay only on start I think you have to zero it right after the start. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Oh now i see! Just pushed new commit with delayOnStart() implemented. Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 you are unstoppable also .delay(100, true); would work, but either way is good for me. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Fixed now both works. Quote Link to comment Share on other sites More sharing options...
cubiq Posted February 20, 2014 Share Posted February 20, 2014 actually, don't you think the delay should be on start only by default? it's really not a big deal, just saying. Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Yep! Right again, i actually first though that it would only delay on start. Fixed:// Delay on start.delay(500)// Repeat delay.delay(500, true) Quote Link to comment Share on other sites More sharing options...
enpu Posted February 20, 2014 Author Share Posted February 20, 2014 Also changed game.Timer to use milliseconds instead of seconds. 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.