vmars316 Posted October 15, 2014 Share Posted October 15, 2014 Hello & Thanks; I need some help with my first project: //=================================== game.module( 'game.main' ) .body(function() { game.addAsset('pandaBlk.png'); game.addAsset('pandaOrg.png'); game.createScene('Main', { backgroundColor: 0xb9bec7, init: function() { // game.system.width(480); // game.system.height(640); var pandaBlk = new game.Sprite('pandaBlk.png').center().addTo(this.stage); pandaBlk.visible = true; pandaBlk.position.set(1, 20); //var pandaOrg = new game.Sprite('pandaOrg.png').center().addTo(this.stage); // pandaOrg.position.set(1, 150); // pandaOrg.visible = true; //var tweenPrb = new game.Tween(pandaBlk.position); // tweenPrb.to({x:200}, 1000); // tweenPrb.repeat(2); // tweenPrb.yoyo(); // pandaBlk.scale.set(-1,1); // tweenPrb.start(); } //game.start(); }); }); //=================================== Everything in // (comments), doesn't work. What I want to happen is for pandaBlk.png and pandaOrg.png(starts out as invisible)to traverse from left to right and back to starting point.When pandaBlk returns to starting point, it becomes invisibleAnd then pandaOrg becomes visible and traverses from left to right and back to starting point.Then pandaOrg becomes invisible and pandaBlk becomes visible and continues transversing. Eventually, there will be a Shooter to target only pandaOrg . Eventually, there will be three more sets of Blk/Org creatures. Things I need to know are:Where can I find (docs) valid values for:?// tweenPrb.to({x:200}, 1000);// tweenPrb.repeat(2);// tweenPrb.yoyo();// pandaBlk.scale.set(-1,1);// tweenPrb.start(); Where does game.system.width(480); belong ? Thanks Quote Link to comment Share on other sites More sharing options...
Stephan Posted October 16, 2014 Share Posted October 16, 2014 Hi vm, The canvas size should be placed in the config.js file like so:pandaConfig = { name: 'MyPandaGame', version: '0.0.0', system: { width: 600, height: 460, },};Your tween runs fine over here. I do notice that you are mixing up some stuff:var tweenPrb = new game.Tween(pandaBlk.position); tweenPrb.to({x:200}, 1000); tweenPrb.repeat(2); tweenPrb.yoyo(); pandaBlk.scale.set(-1,1); //THIS ISN'T TWEEN CODE! tweenPrb.start();I just added various tween examples for the panda fiddler. I will upload them tonight so you can have a look at them. Tween demo is now available at: http://vermeire.home.xs4all.nl/panda/index.html Quote Link to comment Share on other sites More sharing options...
vmars316 Posted October 20, 2014 Author Share Posted October 20, 2014 Stephan,Tween demo is now available at: http://vermeire.home...anda/index.htmlThanks, I am stepping thru your examples. 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.