• Content Count

  • Joined

  • Last visited

About scion.miyazaki

  • Rank

Recent Profile Visitors

535 profile views
  1. Hello @lunafromthemoon Dis ... tu es francaise ? Congratulations for your project.
  2. Hello, I bought WaveForms and it's very very good (I recommend it to everyone). Link is: I need your help to adapt the grids. Indeed, waveforms is only using this size: 800 x 600 but my game size is : 1122x665 You can check the attach file to see my problem. Can you help me? (I have a idea: apply a background transparent and remove the blue. And after that use a other image by CSS but I still don't know how to do this) Thank you
  3. Hello @in mono, thank you for your reply. I will test it !
  4. @in mono, thank you fro your reply ^^ I have big image and this image's size is 1499 x 2667px So I created my Phaser application with that size : var game = new Phaser.Game(1499, 2667, Phaser.CANVAS, "phaser-example", {preload:Onpreload,create:Oncreate,update:Onupdate,render:Onrender}); And I insert the background like that : bg1 = game.add.tileSprite(0, 0, 1499, 2667, "bg1"); Everything was ok because after that I changed the canvas size by CSS. Exemple : canvas { width: 659px; height: 1172px; } I didn't have any problem with that method until yesterday. Indeed, I create a Button on my Phaser Application and that Button didn't work! After many test, I found the reason: After Resize the canvas, click and hover stop to work. You can test that BUG. Example: 1) Get this example : 2) And change the zoom of your canvas by CSS like that: canvas { zoom: 0.5; } 3) Click and Hover stop work ! lol I would like to setGameSize() method like that ... game.scale.setGameSize(659, 11172); ... but I doesn't know how resize my background (I think that is impossible). So I must to recreate my application with Good size. My problem is : I don't know what size I must to use. Indeed, before that BUG I didn't care of application size because the canvas size was egal to devise size but now I can't do that. So what's is the good size?
  5. Hello everyone, I am beginner on Phaser and I am looking for the Good practices to create a Phaser's Application. Now I am making a Mobile Application, but I still don't know what is the Good Size for a Application on Portrait Mode (I want a High Definition for my application). Thanks you so much
  6. Hello, I have a little problem and I need your help. I am new in Phaser and I want to know How can I send a projectile to a target? In the Phaser's website there are many examples and it's very simple to test it. I want to send projectile to a target like this example : Shoot The Pointer (link) Me website test is : here (link) But I would like to add the gravity effect, like this : here (link) I don't know how to do that. Can you correct the code ? SCENE_WIDTH = 1024;SCENE_HEIGHT = 674;var game = new Phaser.Game(SCENE_WIDTH, SCENE_HEIGHT, Phaser.CANVAS, 'container', { preload: preload, create: create, update: update, render: render });function preload() { game.load.image('bullet', 'assets/gfx/bullet.png'); game.load.image('ground', 'assets/gfx/ground.png'); game.load.spritesheet('explosion', 'assets/gfx/explosion.png', 128, 128); game.load.image('a', 'assets/sprites/firstaid.png');};var SHOT_DELAY;var BULLET_SPEED;var NUMBER_OF_BULLETS;var GRAVITY;var gun;var bulletPool;var ground;var explosionGroup;var fpsText;var lastBulletShotAt;var target;function create() { // Set stage background color game.stage.backgroundColor = 0x4488cc; // Define constants SHOT_DELAY = 300; // milliseconds (10 bullets/3 seconds) BULLET_SPEED = 800; // pixels/second NUMBER_OF_BULLETS = 20; GRAVITY = 980; // 980 pixels/second/second target = game.add.sprite(700, 400, 'a'); // Create an object representing our gun gun = game.add.sprite(50, game.height - 64, 'bullet'); // Set the pivot point to the center of the gun gun.anchor.setTo(0.5, 0.5); // Create an object pool of bullets bulletPool =; for(var i = 0; i < NUMBER_OF_BULLETS; i++) { // Create each bullet and add it to the group. var bullet = game.add.sprite(0, 0, 'bullet'); bulletPool.add(bullet); // Set its pivot point to the center of the bullet bullet.anchor.setTo(0.5, 0.5); // Enable physics on the bullet game.physics.enable(bullet, Phaser.Physics.ARCADE); // Set its initial state to "dead". bullet.kill(); } // Turn on gravity game.physics.arcade.gravity.y = GRAVITY; // Create some ground ground =; for(var x = 0; x < game.width; x += 32) { // Add the ground blocks, enable physics on each, make them immovable var groundBlock = game.add.sprite(x, game.height - 32, 'ground'); game.physics.enable(groundBlock, Phaser.Physics.ARCADE); groundBlock.body.immovable = true; groundBlock.body.allowGravity = false; ground.add(groundBlock); } // Create a group for explosions explosionGroup =; // Simulate a pointer click/tap input at the center of the stage // when the example begins running. game.input.activePointer.x = game.width/2; game.input.activePointer.y = game.height/2 - 100; // Show FPS game.time.advancedTiming = true; fpsText = game.add.text( 20, 20, '', { font: '16px Arial', fill: '#ffffff' } );};function shootBullet() { // Enforce a short delay between shots by recording // the time that each bullet is shot and testing if // the amount of time since the last shot is more than // the required delay. if (lastBulletShotAt === undefined) lastBulletShotAt = 0; if ( - lastBulletShotAt < SHOT_DELAY) return; lastBulletShotAt =; // Get a dead bullet from the pool var bullet = bulletPool.getFirstDead(); // If there aren't any bullets available then don't shoot if (bullet === null || bullet === undefined) return; // Revive the bullet // This makes the bullet "alive" bullet.revive(); // Bullets should kill themselves when they leave the world. // Phaser takes care of this for me by setting this flag // but you can do it yourself by killing the bullet if // its x,y coordinates are outside of the world. bullet.checkWorldBounds = true; bullet.outOfBoundsKill = true; // Set the bullet position to the gun position. bullet.reset(gun.x, gun.y); bullet.rotation = gun.rotation; // Shoot it in the right direction bullet.body.velocity.x = Math.cos(bullet.rotation) * BULLET_SPEED; bullet.body.velocity.y = Math.sin(bullet.rotation) * BULLET_SPEED;};function update() { if (game.time.fps !== 0) { fpsText.setText(game.time.fps + ' FPS'); } game.physics.arcade.collide(bulletPool, ground, function(bullet, ground) { // Create an explosion getExplosion(bullet.x, bullet.y); // Kill the bullet bullet.kill(); }, null, game); // Rotate all living bullets to match their trajectory bulletPool.forEachAlive(function(bullet) { bullet.rotation = Math.atan2(bullet.body.velocity.y, bullet.body.velocity.x); }, game); // Aim the gun at the pointer. // All this function does is calculate the angle using // Math.atan2(yPointer-yGun, xPointer-xGun) gun.rotation = game.physics.arcade.angleBetween(gun, target); //// gun.rotation = game.physics.arcade.angleToPointer(gun); // Shoot a bullet if (game.input.activePointer.isDown) { shootBullet(); }};// Try to get a used explosion from the explosionGroup.// If an explosion isn't available, create a new one and add it to the group.// Setup new explosions so that they animate and kill themselves when the// animation is complete.function getExplosion(x, y) { // Get the first dead explosion from the explosionGroup var explosion = explosionGroup.getFirstDead(); // If there aren't any available, create a new one if (explosion === null) { explosion = game.add.sprite(0, 0, 'explosion'); explosion.anchor.setTo(0.5, 0.5); // Add an animation for the explosion that kills the sprite when the // animation is complete var animation = explosion.animations.add('boom', [0,1,2,3], 60, false); animation.killOnComplete = true; // Add the explosion sprite to the group explosionGroup.add(explosion); } // Revive the explosion (set it's alive property to true) // You can also define a onRevived event handler in your explosion objects // to do stuff when they are revived. explosion.revive(); // Move the explosion to the given coordinates explosion.x = x; explosion.y = y; // Set rotation of the explosion at random for a little variety explosion.angle = game.rnd.integerInRange(0, 360); // Play the animation'boom'); // Return the explosion itself in case we want to do anything else with it return explosion;};function render () { // game.debug.text(game.time.physicsElapsed, 32, 32); // game.debug.body(player); //game.debug.bodyInfo(player, 16, 24);}