Jump to content

Where can I find (docs) valid values for tweenPrb.repeat(2); etc..


vmars316
 Share

Recommended Posts

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 invisible

And 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 ? 

post-11026-0-52648300-1413414780.pngpost-11026-0-35992900-1413414799.png

Thanks

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...