enpu

Panda 2 development

Recommended Posts

Hi @enpu

 

Does 'gotoAndStop(frame)' still work with animations?

 

I've tried the new format and can't get it to work. I used gotoAndStop(), all the time in the previous version of Panda :)

 

I also think that 'fromFrames' was really useful.

 

Thank you in advance!

 

PS. setTexture(); doesn't seem to work either.

Share this post


Link to post
Share on other sites

Is it possible to resize a sprite in the 2.0 ?

I tried to do something like that but it doesn't worked:

game.createClass('Ground', 'Sprite',{  texture: "choco.png",  tint: 0xfff000,  init: function(type, x, y, width, height)  {    console.log("New Ground", type, x, y, width, height);    this.width = width; // Don't work.    this.height = height; // Don't work.  }}

Share this post


Link to post
Share on other sites

Hi guys

 

Does anyone know what the function used to listen for an orientation change is?

 

I've tried 'rotateScreen' but it doesn't seem to be working.

 

window.addEventListener('rotateScreen', rotateContainers);

Share this post


Link to post
Share on other sites

Hi @enpu

 

Just wondering if the syntax is still the same for this, as I can't seem to get it working ...

 

smileyPiece1.mousedown = smileyPiece1.touchstart = function(event) {

    console.log(event.target.x);
}
 
Thank you!

Share this post


Link to post
Share on other sites

Hi @enpu

 

Sorry, I forgot about the playground examples!

 

It looks quite different from the way I did things in 1.xx

 

I used event.target quite a bit, but in the examples it seems to favour using classes, with no mention of event.target.

 

I have no problem using classes to create my objects, but sometimes find it a bit unnecessary.

 

Sometimes I'd also like to use the same function on a number of sprites (I think I can inject the sprite with the function :) )

 

I think that event.target was quite convenient and wondering whether there is a chance of it coming back?

 

Thank you!

Share this post


Link to post
Share on other sites

It is not very different from 1.x, just function parameters are a bit different, and there is no need to define touch functions separately anymore.

 

Example:

var sprite = new game.Sprite('panda.png');sprite.interactive = true;sprite.mousedown = function(x, y, id, event) {    console.log(x, y); // Mouse/touch position    console.log(id); // Touch id (for multi-touch)    console.log(event); // Original mouse/touch event};

Share this post


Link to post
Share on other sites

Hi @enpu

 

Thank you for the explanation :)

 

... but what if I wanted to do something like this ...

 

touchTest = function(x, y, id, event) {

    event.target.rotation = 0.5*Math.PI;

};
 
smileyPiece1.mousedown = smileyPiece1.touchstart = touchTest;
smileyPiece2.mousedown = smileyPiece2.touchstart = touchTest;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.