• Content count

  • Joined

  • Last visited

  • Days Won


enpu last won the day on July 18

enpu had the most liked content!


About enpu

  • Rank
    Advanced Member
  • Birthday 04/21/1985

Contact Methods

  • Website URL
  • Twitter
  • Skype

Profile Information

  • Gender
  • Location

Recent Profile Visitors

5,412 profile views
  1. enpu

    Sprite hitTest a point?

    Hi @momenimum Welcome to Panda 2 forum! So you want to hit test point against sprite that has circle hit area? You should be able to do that by just calculating the distance between the point and your sprite. If the distance is same or lower than the radius of your circle, then your point is inside the circle. var point = new game.Vector(100, 100); var dist = point.distance(sprite.position); if (dist <= sprite.hitArea.radius) { // Point is inside the circle }
  2. enpu

    Any idea what this error means?

    The error means that you are trying to stop sound that is not playing or that is already stopped. Though it should only try to stop sound that is playing, so it feels like a bug. What iOS version are you using? Do you have any code in your game where you are calling stop method of Sound or Music?
  3. enpu

    Drawing order of sprites

    There is second parameter in addTo function, which you can use to define the index where the sprite will be added in the array: sprite.addTo(container, 0); // Add to container at index 0 (which is first in the array) You can also swap positions of two sprites in the array: sprite1.swap(sprite2); // Swap positions of sprite1 and sprite2 in children array So there are lots of ways to change the drawing order.
  4. enpu

    Drawing order of sprites

    How it is hard to use? Each container has children property, which is just a basic JavaScript array containing all objects (other containers, sprites, graphics etc) added to it. First object in the array will be renderer first, and so on. You can reorder that array in any way you want, even use your own sorting function. For example here i am sorting all objects added to a container every frame, based on their y position, so that lowest y is on top: game.createScene('Main', { init: function() { this.container = new game.Container(); this.contaienr.addTo(this.stage); // Add objects to the container }, sort: function(a, b) { return a.y > b.y ? 1 : -1; }, update: function() { this.container.children.sort(this.sort); } });
  5. enpu

    Fonts and setFont()

    Good question. Font name and font filename are different things. You can have font named Arial in a filename font.fnt. You should be able to set the font name in the software that you use to generate the fonts. If you look inside the fnt file, the name should be defined as "face": When you load more than one font, you can set the font in a text using setFont function or as a parameter like this: // Create text using Arial font var text = new game.Text('Hello', { font: 'Arial' }); You can also set default font in your config. All texts that you create and do not define the font, will use the default font: game.config = { text: { defaultFont: 'Arial' } }; // If multiple fonts loaded, this will use the default font var text = new game.Text('Hello');
  6. enpu

    Drawing order of sprites

    You could have all the cards in same container. Then if you want to move one card in to top, you could use toTop function: sprite.toTop(); Removing the sprite and adding it back would do the same.
  7. enpu

    Drawing order of sprites

    You can use containers as layers. game.createScene('Main', { init: function() { var layer1 = new game.Container(); layer1.addTo(this.stage); // Everything in layer2 will be rendered in top of layer1 var layer2 = new game.Container(); layer2.addTo(this.stage); } });
  8. enpu

    Start Scene Question

    Yeah if that scene is going to contain something else, than just that setScene function, then makes sense.
  9. enpu

    Start Scene Question

    No i mean your scene code: game.createScene('MainR1', { init: function() { game.system.setScene('Menu'); } }); That makes no sense. You have scene that just changes to another scene. But if that's still in progress, then nothing
  10. enpu

    Start Scene Question

    You code looks absolutely fine. Except your MainR1 scene doesn't make much sense.
  11. enpu

    Start Scene Question

    Keep them coming What you are mostly doing in your game.config, is that you are setting class attributes. Those can be set anywhere in your code, not just in game.config So this code sets startScene attribute in System class to string Test. game.config = { system: { startScene: 'Test' } }; Which is exactly same as this code: game.System.startScene = 'Test'; game.config is just a more handy way to defined those attributes.
  12. enpu

    Set Storage ID outside config?

    Well you are not overriding anything there. That's just basic JavaScript, you can't set property into object that's undefined. game.config.storage.id = 'myid'; // Error because storage object is not definfed game.config.storage = {}; // Define storage object game.config.storage.id = 'myid'; // Set property id to storage object
  13. enpu

    Set Storage ID outside config?

    Well you can define just an empty storage object in your config file, then your game.config.storage.id = 'gameR1'; line should work. But my example should work also, really no big difference.
  14. enpu

    Set Storage ID outside config?

    Ah. You are trying to set property id to game.config.storage object, which you have not defined. game.config.storage = { id: 'gameR1' };
  15. enpu

    Set Storage ID outside config?

    Looks good to me. So how does it not work? Do you get any error message?