Phempt

Members
  • Content Count

    197
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Phempt

  1. Yeah, panda is awesome! BTW, about your questions: 1) you can create your animation with: var yourObject = new game.Animation( 'images/obj-1.png', 'images/obj-2.png', 'images/obj-3.png' );yourObject.animationSpeed = 0.1;yourObject.anchor.set(0.5, 0.5);yourObject.play();yourObject.loop=false;game.scene.stage.addChild(yourObject);This code play your animation only one time, and the last frame will be your final texture (in the example case, obj-3.png will be the static sprite). With : yourObject2 = new game.Animation( 'images/FINAL-Sprite.png' ); yourObject.onComplete(function(){ yourObject.textures = yourObject2.textures;});yourObject.play();You'll change the sprite of your object to a new one (in this case FINAL-Sprite.png) 2) I don't know if you can set a FPS limitation, sorry ^^ 3) maybe you want to use .textures function, see answer #1
  2. I forgot to say that I tried to insert some sprites with: /* BACKGROUND */ var backgroundMenu = new game.Sprite('objects/backgrounds/bg.png'); game.system.stage.addChild(backgroundMenu); var backgroundBubbles = new game.Sprite('objects/backgrounds/bubbbles-bg.png'); backgroundBubbles.scale.set(0.8,0.8); backgroundBubbles.position.y = 105; game.system.stage.addChild(backgroundBubbles); /* LOGO */ var logo = new game.Sprite('objects/logo/title.png'); logo.scale.set(0.8,0.8); logo.anchor.set(0, 0); logo.position.y = 20; game.system.stage.addChild(logo);
  3. Hello guys, is there a way to add sprite to the loading screen? I saw that I can change the loading screen using this method: game.Loader.inject({backgroundColor: 0xcccccc, initStage: function() { /* BACKGROUND */ this.bar = new game.Graphics(); this.bar.beginFill(0xffffff); this.bar.drawRect(0, 0, 260, 40); this.bar.position.x = game.system.width / 2 - (260 / 2); this.bar.position.y = game.system.height / 2 - (40 / 2); this.bar.scale.x = this.percent / 100; game.system.stage.addChild(this.bar); }, onPercentChange: function() { this.bar.scale.x = this.percent / 100; }});But I want to add a background and some sprites such as the logo. Can you help me? thanks a lot ^^
  4. Hello guys, is there a way to set the Z-Index property for objects? Now a new object has an high z-index than previously created objects. I need to set the highest z-index for some buttons like "sound on/off". Thank you.
  5. Sounds good! Thank you for your work with Panda and this tool
  6. Unfortunately I don't use CocoonJS, I'm using Phonegap. I'll try to create something for this wrapper. Thank you for your answer!
  7. Hello guys, is there the possibility to place a text area in PandaJS in order to save some input from the user? (for example nickname for highscore)
  8. Thank you for your help enpu, I didn't know the existance of .textures OT: Phonegap is really good with Panda.js this is my second project with Panda.js but phonegap (at the moment) is pretty good with no fps drop. My next project will contain collision and probably some physics, I'll inform you about the performance
  9. Fix'd, I added "function()" to onRepeat, I also added 3 animation array to define the right and left orientation. This is the working code: var blueBird = new game.Animation( 'elements/birds/blue-1.png', 'elements/birds/blue-2.png', 'elements/birds/blue-3.png', 'elements/birds/blue-4.png', 'elements/birds/blue-5.png', 'elements/birds/blue-6.png' ); var blueBirdRight = new game.Animation( 'elements/birds/blue-1.png', 'elements/birds/blue-2.png', 'elements/birds/blue-3.png', 'elements/birds/blue-4.png', 'elements/birds/blue-5.png', 'elements/birds/blue-6.png' ); var blueBirdReverse = new game.Animation( 'elements/birds/blue-1-reverse.png', 'elements/birds/blue-2-reverse.png', 'elements/birds/blue-3-reverse.png', 'elements/birds/blue-4-reverse.png', 'elements/birds/blue-5-reverse.png', 'elements/birds/blue-6-reverse.png' );blueBird.animationSpeed = 0.2;blueBird.play();blueBird.position.set(250, 100);game.scene.stage.addChild(blueBird);orientation = 1;var tween = new game.Tween(blueBird.position);tween.to({x:0}, 2000);tween.repeat();tween.onRepeat(function(){ if (orientation == 1){ blueBird.textures = blueBirdReverse.textures; orientation = 0; }else{ blueBird.textures = blueBirdRight.textures; orientation = 1; }});tween.yoyo();tween.start();
  10. Thank you enpu, I tried but I've this error: Uncaught SyntaxError: Unexpected token . The line is: tween.onRepeat({ blueBird.textures = blueBirdReverse.textures;});Any ideas? Thank you
  11. Hello enpu, thank you for your fast reply, I tried with: var blueBird = new game.Animation( 'elements/birds/blue-1.png', 'elements/birds/blue-2.png', 'elements/birds/blue-3.png', 'elements/birds/blue-4.png', 'elements/birds/blue-5.png', 'elements/birds/blue-6.png' ); blueBird.animationSpeed = 0.2; blueBird.play(); blueBird.position.set(250, 100); game.scene.stage.addChild(blueBird);var tween = new game.Tween(blueBird.position); tween.to({x:0}, 2000); tween.repeat(); tween.onRepeat({ var blueBird = new game.Animation( 'elements/birds/blue-1-reverse.png', 'elements/birds/blue-2-reverse.png', 'elements/birds/blue-3-reverse.png', 'elements/birds/blue-4-reverse.png', 'elements/birds/blue-5-reverse.png', 'elements/birds/blue-6-reverse.png' ); }); tween.yoyo(); tween.start();but nothing, it doesn't work, can you explain how to use onRepeat for my purpose? Thank you again, regards
  12. Hello, is there a simple way to reverse the sprite orientation using the Tween Repeat Reverse function? I've a bird that goes from 0 to 200 and from 200 to 0 (reverse repeat). I want to change the bird orientation while he's flying from 200 to 0. Is there a function for this? Thank you in advance
  13. At the moment is pretty good, but I'll say something about phonegap+pandajs when I'll start my new game that is more complicated.
  14. Ok the important thing is that through Phonegap it works I'm going to finish my first game using pandajs ^^
  15. I'm new in html5 game development. But I consider Panda.js a really good framework to start this adventure and, why not, continue with great games. I'm creating a simple game for iOS, using Phonegap as wrapper. I'm near the end of development, I'm talking with my friend (a designer) to optimize and create the final models and assets. Great work with Panda.js, enpu.
  16. Using Phonegap instead of Safari Mobile (iOS) it works. This is so strange, maybe a possible Panda.js bug or a Safari mobile limitation?
  17. Solved I used an array, but if you know a better method, please share
  18. Hello guys, I'm trying to spawn an object randomly from the bottom. I wrote this into the init function: createBaloon = function(){ randomNum = Math.floor(Math.random() * 320) + 1; console.log(randomNum); baloon = new game.Sprite('logo.png'); baloon.position.set(randomNum, 800); baloon.scale.set(0.2, 0.2); game.scene.stage.addChild(baloon); baloon.interactive = true; setTimeout("createBaloon();", 5000);}createBaloon(); baloon.touchstart = baloon.click = function() { game.audio.playSound('step'); this.remove(); }and this as update function: update: function() { if(baloon.position.y > '-150' ){ //console.log(baloon.position.y); baloon.position.y -= 100 * game.system.delta; // move sprite using delta time } else { baloon.remove(); } }it works and a lot of baloon are spawned. But there are 2 problems: 1) only the first one is clickable; 2) when a new baloon spawn, the previous one stop working (the update function not work on the new old one); Any idea?
  19. Hi guys, I'm working on a simple game for learning purpose only. I made a simple menĂ¹ (Main Scene), by pressing on "Button START" the Main Scene will change to the Game one. At the moment by pressing a button, the sprite moves in both direction, adding 10px to its current position and simultaneously a sound will be reproduced. For this last step, I used the game.audio.playSound('step') instruction, and it works. I tried to add a music in background for the Game Scene, but the music, on iOS, starts only after the first "touch" on the button. I used at the end of init function, this instruction:/* play audio */ game.audio.musicVolume = 0.1; game.audio.playMusic('music');This is the whole Game Scene code: game.createScene('Game', { backgroundColor: 0xff0000, init: function() { var logo = new game.Sprite('logo.png').center().addTo(this.stage); logo.interactive = true; var button = new game.Sprite('button.png'); button.position.set(100, 100); this.stage.addChild(button); button.interactive = true; button.touchstart = function () { //this.remove(); var newposx = logo.position.x + 10; //alert(newposx); var newposy = logo.position.y + 10; //alert(newposy); logo.position.set(newposx, newposy); this.stage.addChild(logo); game.audio.playSound('step'); } /* play audio */ game.audio.musicVolume = 0.1; game.audio.playMusic('music'); }});
  20. I solved the problem. There's an error in logo@2x.png name that cause the incorrect loading without "error". thank you
  21. Nice game a "little" hard the third lvl :'D
  22. Hello guys, I'm learning how to use Panda.js to create some simple game for iOS. I studied a lot the documentation and finally I create a first simple app that on click hide the image. This app contains the "resizeToFill: true" option for every iOS resolution. This is the config.js pandaConfig = { name: 'MyPandaGame', version: '0.0.0', system: { width: 320, height: 480, maxWidth: 320, maxHeight: 480, resizeToFill: true, retina: true }};This is the main.js game.module( 'game.main').require( 'engine.core').body(function() {game.addAsset('logo.png');game.createScene('Main', { backgroundColor: 0xb9bec7, init: function() { var logo = new game.Sprite('logo.png').center().addTo(this.stage); logo.interactive = true; logo.click = function () { this.remove(); } }});});unfortunately running this code on Safari (iOS) or through phonegap result in a black screen with blank loader (and no errors in console). Any suggestion?