Jump to content

Panda 2 development


enpu
 Share

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.

Link to comment
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.  }}
Link to comment
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!

Link to comment
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};
Link to comment
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;
Link to comment
Share on other sites

  • enpu unpinned this topic

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...