Search the Community

Showing results for tags 'Mobile'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 373 results

  1. Slow performance on mobile

    Hi for all. I'm trying to create application for mobile devices. I have some troubles with tag <meta name='viewport'>: 1. I have 59-60 fps if i set attribute content like this: content='initial-scale=no,width=device-width,initial-scale=1'; but images looks blured. 2. Images looks great if i set attribute content like this: content='initial-scale=no,width=device-width,initial-scale=' + 1 / window.devicePixelRatio; but i have 15 fps. I set options.resolution = window.devicePixelRatio || 1 for both cases;
  2. [Construct 2] Basket Slam Dunk

    Hello again community, I want to show you this little success for me, Basket Slam Dunk, has been the game that has played the most of all that I have done. It has more than 100,000 games played, a record for me. It is a casual game, easy to play and playable on any device. You have to throw the player and put in the basket, very easy to play, and with unlockable balls. I hope you like it Link : https://html5.GameDistribution.com/1e114557c82349ffa04089dcbfb0605b/
  3. Hello, I want to show you my latest game created with Construct 3, a casual game designed for children. It is very easy to play, and playable from any device. We must prevent the Martians from reaching the earth, with one of our small and stubborn heroes XD. You can use the touch screen or keyboard arrows to play. Link: https://html5.GameDistribution.com/d450f69ec01248119ed50f202d09ab27/
  4. Phaser poor performance on mobile

    Hi guys! So I am trying to create a mobile racing game in Phaser. But the game has really poor performance on mobile. I tried to reduce a lot of things in the game and test if I get a better performance, but so far no success. What I have so far after reducing everything to absolute minimum is a sprite of a car (79x160 png image), a sprite for the background (100150 png) and in the update function I only scroll the background adding to the background y some value to move it down. I am running the game in CANVAS mode. Any thoughts what might be happening, or any tips or tricks that will improve the performance? Thanks!
  5. [Phaser] Lost in Jungle

    Hi! I'm releasing my new game, called Lost in Jungle! How many days can you survive in a misty jungle full of monsters? Play this turn-based game and find out in your desktop or mobile! Play it for free at: http://www.minzaogames.com
  6. [solved] Mobile viewport inconsistency

    Hey. I need help, I've been banging my head against this for hours. I've been scaling my game to fit screens on all devices, while maintaining the asset ratios. The game size increases so the controls work where ever you touch. I've run into an issue with Android/Chrome and itch.io. I'm not sure if it's specific to the browser, or the site, or mobile. It might be a full screen mobile issue all together, but I'm testing it on itch and an android with chrome. The first time the game loads it scales and works perfectly. Then, if I refresh the page or visit it later this happens: The game gets put into the view port ratio set in Itch, and doesn't adjust like it should in fullscreen. This being 640x960. 2:3 ratio, the screen has a higher Y axis. This causes the white bar at the bottom which is unresponsive to the touch controls. I've removed the padding in CSS: <style> html { margin:0; padding:0; } body { margin: 0; padding: 0; } #canvasholder { width: 99vw; height: 99vh; margin: 0 auto; } </style> and my canvas code looks something like this: // ~A Canvas and Game Setup aspect_ratio = window.innerWidth / window.innerHeight; testWidth = 960 * aspect_ratio; //if the aspect ratio stretches the Y axis if (testWidth <= 640) { var canvasWidth = 640; var canvasHeight = 640/aspect_ratio; } // else if it stretches the X axis else { var canvasWidth = 960 * aspect_ratio; var canvasHeight = 960; } //test versions //var canvasWidth = 640; //var canvasHeight = 960; var game = new Phaser.Game(canvasWidth, canvasHeight, Phaser.CANVAS, 'game', { preload: preload, create: create, update: update }); function create() { // ~2.1 Game Scaling game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.refresh(); Maybe I've over complicated the original solution? This worked the way I intended on Desktop tests. You can test it yourself here: https://flopshotqq.itch.io/screen-scale-test Thanks so much, any help is appreciated.
  7. Playniax game engine

    Hi guys,This will be the place where I will keep you up to date you on the latest Playniax game engine called Pyro! You can find it onitch.io Pyro is ideal for building 2D games and other interactive graphical driven applications. Pyro apps run on WINDOWS, OSX, LINUX, IOS, ANDROID and HTML5! And... It's FREE! Here is a game made with Pyro
  8. Hello, Helloween Madness highscore based game is available for licensing. It was never published before, so exclusive license is also available. PM me for details.
  9. I am looking for someone that can build / brand an HTML 5 game that can be used on our website during Christmas. We may build several games.
  10. Hi guys! First time poster here. I wanted to share my upcoming HTML5 mobile game, Pocket City. Screenshot: Animated Gfycat link: - https://gfycat.com/gifs/detail/ColorlessWatchfulHydra Thanks so much to PhotonStorm for creating Phaser! I've been using it for a year and a half on this game and it has been a blast to work with. My goal is to create a mobile city building game that has the depth and gameplay of traditional desktop city builders, but with a modern mobile interface. My plan is to release for iOS and Android, then if things go well, perhaps PC. Here's some links if you guys want to stay updated: Blog: https://blog.pocketcitygame.com Twitter: https://twitter.com/pocketcitygame/ Facebook: https://www.facebook.com/pocketcitygame Instagram: https://instagram.com/pocketcity Youtube: https://www.youtube.com/c/pocketcitygame Thanks for taking a look!
  11. Choppy tweens on mobile (Cordova)

    Hi all, I have a game which I've turned in to a cordova app. Gamephysics with collision are working smooth, but when I am using tweens it sometimes lags a little bit. I am using Crosswalk and are testing on a Sony Xperia Z3. I've tried removing all backgrounds and animation and left only one sprite doing the tweens, but the lags remain. Everything is smooth on the desktop browser. Anybody got any tips on improving the performance?
  12. Hi everybody, This topic is here to list known mobile apps using Babylon.js. Could you mention the one you know ? Thanks !
  13. Hello, Just finished my new game "Ball&Roll". It's my first attempt to use 3D assets with 2D engine. Playable link: http://powerthemes.eu/ballroll The game is still open for exclusive licensing.
  14. When I drag my finger out of the viewport then back in, its registered as a 2nd touch and zooming kicks in. I'm trying to register for "leaving" events but none of them are firing. I have this $("#canvas").on("mouseout touchleave dragleave touchcancel", function(e) { alert("touch out!"); }); This problem exists with Android and iOS. This works on desktop browsers though. Does anyone know which event I need to use?
  15. Phaser simple Game lags on mobile

    Hi, I am new to phaser as well as game designing. I created my first game as hobby using phaser. it is working fine in desktop but lags very bad on mobile devices. Images I am using for game is very small. game is smaller that 2mb. I am attaching my main.js file hope someone can help me. thanks var buttetSpwanSpeed; var bulletSpeed; var enemySpwanSpeed; var enemySpeed; var golis; var enemies; var enemyLoop; var scoreText; var powers; var bulletSize; setStart(); //game phaser var game=new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.WebGL,""); var BootState={ //loding accets preload: function(){ this.load.image('LodingScreen', 'assets/desimulga.png'); this.load.image('background', 'assets/blue.png'); }, create: function(){ game.state.start("LoadingState"); }, }; var LoadingState={ //loding acc preload: function(){ bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; LodingScreen=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY,'LodingScreen'); LodingScreen.anchor.setTo(0.5); LodingScreen.scale.setTo(0.5,0.5); this.load.image('spaceship', 'assets/player.png'); this.load.image('goli', 'assets/bullet.png'); //load ememies this.load.image('enemy1', 'assets/enemies/enemy1.png'); this.load.image('enemy2', 'assets/enemies/enemy2.png'); this.load.image('enemy3', 'assets/enemies/enemy3.png'); this.load.image('enemy4', 'assets/enemies/enemy4.png'); this.load.image('enemy5', 'assets/enemies/enemy5.png'); this.load.spritesheet('power1', 'assets/power/bulletUp.png',34,33,4); this.load.image('restart', 'assets/restart.png'); this.load.spritesheet('blast', 'assets/explosion.png',400,400,8); game.load.audio('fire', 'assets/music/bullet.mp3'); game.load.audio('killed', 'assets/music/killed.mp3'); //game.load.audio('bg_music', 'assets/music/background.mp3'); game.load.audio('death_music', 'assets/music/death.mp3'); game.load.audio('start_music', 'assets/music/start.mp3'); }, create: function(){ game.time.events.add(Phaser.Timer.SECOND * 2, function(){ bg.kill(); LodingScreen.kill(); game.state.start("PreGameState"); },this); }, }; var PreGameState={ //loding accets create: function(){ game.scale.refresh(); bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; Startb=this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'TAP TO START' , { fontSize: '32px', fill: 'yellow' }); Startb.anchor.setTo(0.5); Startb.scale.setTo(0.5,0.5); ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.4,'spaceship'); ship.scale.setTo(0.4); ship.anchor.setTo(0.5); game.physics.arcade.enable(ship); bg.inputEnabled=true; start_music = game.add.audio('start_music'); start_music.allowMultiple = true; start_music.addMarker('start_music', 0, 30); bg.events.onInputDown.add(function(){ bg.inputEnabled=false; Startb.kill(); start_music.play("start_music"); // game.physics.arcade.moveToXY(ship, this.game.world.centerX, this.game.world.height*0.8, 300, 3000); // game.add.tween(ship).to( { y: game.world.height*0.8 }, 3000, Phaser.Easing.Sinusoidal.InOut, true); var tween = game.add.tween(ship).to({ x: [this.game.world.centerX, this.game.world.width*0, this.game.world.width, this.game.world.centerX], y: [this.game.world.height*0.4, this.game.world.height*0.5, this.game.world.height*0.6, this.game.world.height*0.8], }, 2000,Phaser.Easing.Quadratic.Out, true).interpolation(function(v, k){ return Phaser.Math.bezierInterpolation(v, k); }); game.time.events.add(Phaser.Timer.SECOND * 2, function() { bg.kill(); ship.kill(); game.state.start("GameState"); } ,this); }, this); }, }; var GameState={ //loding accets preload: function(){ }, create: function(){ //background this.background=this.game.add.tileSprite(0,0,600,300,'background'); this.background.height = game.height; this.background.width = game.width; this.background.inputEnabled=true; this.background.input.enableDrag(true); this.background.input.startDrag = function(pointer) { pointer.shipStart = new Phaser.Point(GameState.ship.x, GameState.ship.y); Phaser.InputHandler.prototype.startDrag.call(this, pointer); }; this.background.input.updateDrag = function(pointer) { GameState.ship.x = pointer.shipStart.x - pointer.positionDown.x + pointer.x; GameState.ship.y = pointer.shipStart.y - pointer.positionDown.y + pointer.y; GameState.background.x=0; GameState.background.y=0; }; //ship this.ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.8,'spaceship'); this.ship.scale.setTo(0.4); this.ship.anchor.setTo(0.5); game.physics.arcade.enable(this.ship); // this.ship.inputEnabled=true; // this.ship.input.enableDrag(true); //score this.scoreText = this.game.add.text(16, 16, 'Kills: 0', { fontSize: '32px', fill: '#fff' }); //background Music // music = game.add.audio('bg_music'); //music.play('', 0, 1, true); //bullet sound bullet_sound = game.add.audio('fire'); bullet_sound.allowMultiple = true; bullet_sound.volume=0.5; bullet_sound.addMarker('fire', 0, 0.5); //Killed sound killed_sound = game.add.audio('killed'); killed_sound.allowMultiple = true; killed_sound.addMarker('killed', 0, 0.5); //death music death_music = game.add.audio('death_music'); death_music.allowMultiple = true; death_music.addMarker('death_music', 0, 10); //groups of bullets and enemies golis=game.add.group(); enemies=game.add.group(); powers=game.add.group(); //fire bullet loop fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); //this.game.input.onTap.add(fireBullet, this); //create ememy loop enemyLoop=game.time.events.loop(Phaser.Timer.SECOND*1/enemySpwanSpeed, createEnemy, this); //change ememy speed and enemy spwan speed loop enemySpeedLoop=game.time.events.loop(Phaser.Timer.SECOND*1.5, changeEnemySpeed, this); //give powerup powerUp=game.time.events.loop(Phaser.Timer.SECOND*20, powerFun, this); }, update: function(){ //scrolling background this.background.tilePosition.y+=2; //keybord control if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) { this.ship.y-=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { this.ship.y+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { this.ship.x+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { this.ship.x-=2; } //dont go out if(this.ship.y<0+this.ship.height/2) { this.ship.y=0+this.ship.height/2; } if(this.ship.y>this.game.world.height-this.ship.height/2) { this.ship.y=this.game.world.height-this.ship.height/2; } if(this.ship.x<0+this.ship.width/2) { this.ship.x=0+this.ship.width/2; } if(this.ship.x>this.game.world.width-this.ship.width/2) { this.ship.x=this.game.world.width-this.ship.width/2; } //check for collisions game.physics.arcade.overlap(golis,enemies,b_e_collide,null,this); game.physics.arcade.overlap(this.ship,enemies,s_e_collide,null,this); game.physics.arcade.overlap(this.ship,powers,s_power1_collide,null,this); }, }; //setting start game conditions function setStart(){ buttetSpwanSpeed=2; bulletSpeed=2000; enemySpwanSpeed=1; enemySpeed=300; score=0; bulletSize=1.2 } //fire bullet function function fireBullet(){ goli=this.game.add.sprite(this.ship.x,this.ship.y-this.ship.height/2,'goli'); goli.anchor.setTo(0.5); goli.scale.setTo(bulletSize,1); goli.checkWorldBounds = true; goli.outOfBoundsKill = true; //adding to group golis.add(goli); game.world.moveDown(goli); game.physics.arcade.enable(goli); goli.body.collisonWorldBounds=true; goli.body.velocity.y=-bulletSpeed; bullet_sound.play("fire"); } //create enemy function function createEnemy(){ enemyNo=game.rnd.integerInRange(1, 5); x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); enemy=this.game.add.sprite(x1,10,'enemy'+enemyNo); enemy.anchor.setTo(0.5); enemy.scale.setTo(0.4); enemy.checkWorldBounds = true; enemies.add(enemy); enemy.outOfBoundsKill = true; game.physics.arcade.enable(enemy); enemy.body.collisonWorldBounds=true; enemy.angle=90; enemy.no=enemyNo; //moving enemy angleRedian=game.physics.arcade.moveToXY(enemy, x2, this.game.world.height+enemy.height, enemySpeed,0); angleDegree=angleRedian*57.2958; enemy.angle=90+angleDegree; } //runs when bullet collide to enemy function b_e_collide(goli,enemy){ //blast blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',30,false,true); //killing goli.kill(); enemy.kill(); //update scores if(enemy.no<4) { score+=1; killed_sound.play('killed'); } this.scoreText.text = 'Kills: ' + score; } //runs when ship collide to enemy function s_e_collide(ship,enemy){ blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',10,false,true); ship.kill(); enemy.kill(); //music.stop(); this.scoreText.kill(); death_music.play("death_music"); game.time.events.remove(fireLoop); game.time.events.add(Phaser.Timer.SECOND * 2, function() { fianlScore = this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'KILL: '+score, { fontSize: '32px', fill: 'yellow' }); fianlScore.anchor.setTo(0.5); gameOverText = this.game.add.text(this.game.world.centerX,this.game.world.centerY - fianlScore.height, 'GAME OVER', { fontSize: '32px', fill: 'red' }); gameOverText.anchor.setTo(0.5); //restart button restart=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY + fianlScore.height+10,'restart'); restart.anchor.setTo(0.5); restart.scale.setTo(0.05,0.05); restart.inputEnabled = true; restart.events.onInputDown.add(restartGame, this); game.time.events.stop(); }, this); } //runs when ship collide power1 function s_power1_collide(ship,power){ power.kill(); game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/10, fireBullet, this); game.time.events.add(Phaser.Timer.SECOND * 10, function(){ game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); },this); } function changeEnemySpeed() { if(enemySpeed<=900) { enemySpeed+=5; } if(enemySpwanSpeed<=3) { enemySpwanSpeed+=0.025; } enemyLoop.delay=Phaser.Timer.SECOND*1/enemySpwanSpeed; } //send power up function powerFun() { x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); power=this.game.add.sprite(x1,10,'power1'); power.anchor.setTo(0.5); var shine=power.animations.add('shine'); power.animations.play('shine',5,true,true); power.checkWorldBounds = true; power.outOfBoundsKill = true; powers.add(power); game.physics.arcade.enable(power); power.body.collisonWorldBounds=true; game.physics.arcade.moveToXY(power, x2, this.game.world.height+power.height, 400,0); powerDelay=game.rnd.integerInRange(20,35); powerUp.delay=Phaser.Timer.SECOND*powerDelay; } function restartGame(){ setStart(); game.time.events.start(); game.state.start("PreGameState"); } game.state.add("GameState",GameState); game.state.add("BootState",BootState); game.state.add("LoadingState",LoadingState); game.state.add("PreGameState",PreGameState); game.state.start("BootState"); main.js
  16. Phaser Game Lag In Mobile

    Hi, I am new to phaser as well as game designing. I created my first game as hobby using phaser. it is working fine in desktop but lags very bad on mobile devices. Images I am using for game is very small. game is smaller that 2mb. I am attaching my main.js file hope someone can help me. thanks var buttetSpwanSpeed; var bulletSpeed; var enemySpwanSpeed; var enemySpeed; var golis; var enemies; var enemyLoop; var scoreText; var powers; var bulletSize; setStart(); //game phaser var game=new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS,"gamearea"); var BootState={ //loding accets preload: function(){ this.load.image('LodingScreen', 'assets/desimulga.png'); this.load.image('background', 'assets/blue.png'); }, create: function(){ game.state.start("LoadingState"); }, }; var LoadingState={ //loding acc preload: function(){ bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; LodingScreen=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY,'LodingScreen'); LodingScreen.anchor.setTo(0.5); LodingScreen.scale.setTo(0.5,0.5); this.load.image('spaceship', 'assets/player.png'); this.load.image('goli', 'assets/bullet.png'); //load ememies this.load.image('enemy1', 'assets/enemies/enemy1.png'); this.load.image('enemy2', 'assets/enemies/enemy2.png'); this.load.image('enemy3', 'assets/enemies/enemy3.png'); this.load.image('enemy4', 'assets/enemies/enemy4.png'); this.load.image('enemy5', 'assets/enemies/enemy5.png'); this.load.spritesheet('power1', 'assets/power/bulletUp.png',34,33,4); this.load.image('restart', 'assets/restart.png'); this.load.spritesheet('blast', 'assets/explosion.png',400,400,8); game.load.audio('fire', 'assets/music/bullet.mp3'); game.load.audio('killed', 'assets/music/killed.mp3'); //game.load.audio('bg_music', 'assets/music/background.mp3'); game.load.audio('death_music', 'assets/music/death.mp3'); game.load.audio('start_music', 'assets/music/start.mp3'); }, create: function(){ game.time.events.add(Phaser.Timer.SECOND * 2, function(){ bg.kill(); LodingScreen.kill(); game.state.start("PreGameState"); },this); }, }; var PreGameState={ //loding accets create: function(){ game.scale.refresh(); bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; Startb=this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'TAP TO START' , { fontSize: '32px', fill: 'yellow' }); Startb.anchor.setTo(0.5); Startb.scale.setTo(0.5,0.5); ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.4,'spaceship'); ship.scale.setTo(0.4); ship.anchor.setTo(0.5); game.physics.arcade.enable(ship); bg.inputEnabled=true; start_music = game.add.audio('start_music'); start_music.allowMultiple = true; start_music.addMarker('start_music', 0, 30); bg.events.onInputDown.add(function(){ bg.inputEnabled=false; Startb.kill(); start_music.play("start_music"); // game.physics.arcade.moveToXY(ship, this.game.world.centerX, this.game.world.height*0.8, 300, 3000); // game.add.tween(ship).to( { y: game.world.height*0.8 }, 3000, Phaser.Easing.Sinusoidal.InOut, true); var tween = game.add.tween(ship).to({ x: [this.game.world.centerX, this.game.world.width*0, this.game.world.width, this.game.world.centerX], y: [this.game.world.height*0.4, this.game.world.height*0.5, this.game.world.height*0.6, this.game.world.height*0.8], }, 2000,Phaser.Easing.Quadratic.Out, true).interpolation(function(v, k){ return Phaser.Math.bezierInterpolation(v, k); }); game.time.events.add(Phaser.Timer.SECOND * 2, function() { bg.kill(); ship.kill(); game.state.start("GameState"); } ,this); }, this); }, }; var GameState={ //loding accets preload: function(){ }, create: function(){ //background this.background=this.game.add.tileSprite(0,0,600,300,'background'); this.background.height = game.height; this.background.width = game.width; this.background.inputEnabled=true; this.background.input.enableDrag(true); this.background.input.startDrag = function(pointer) { pointer.shipStart = new Phaser.Point(GameState.ship.x, GameState.ship.y); Phaser.InputHandler.prototype.startDrag.call(this, pointer); }; this.background.input.updateDrag = function(pointer) { GameState.ship.x = pointer.shipStart.x - pointer.positionDown.x + pointer.x; GameState.ship.y = pointer.shipStart.y - pointer.positionDown.y + pointer.y; GameState.background.x=0; GameState.background.y=0; }; //ship this.ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.8,'spaceship'); this.ship.scale.setTo(0.4); this.ship.anchor.setTo(0.5); game.physics.arcade.enable(this.ship); // this.ship.inputEnabled=true; // this.ship.input.enableDrag(true); //score this.scoreText = this.game.add.text(16, 16, 'Kills: 0', { fontSize: '32px', fill: '#fff' }); //background Music // music = game.add.audio('bg_music'); //music.play('', 0, 1, true); //bullet sound bullet_sound = game.add.audio('fire'); bullet_sound.allowMultiple = true; bullet_sound.volume=0.5; bullet_sound.addMarker('fire', 0, 0.5); //Killed sound killed_sound = game.add.audio('killed'); killed_sound.allowMultiple = true; killed_sound.addMarker('killed', 0, 0.5); //death music death_music = game.add.audio('death_music'); death_music.allowMultiple = true; death_music.addMarker('death_music', 0, 10); //groups of bullets and enemies golis=game.add.group(); enemies=game.add.group(); powers=game.add.group(); //fire bullet loop fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); //this.game.input.onTap.add(fireBullet, this); //create ememy loop enemyLoop=game.time.events.loop(Phaser.Timer.SECOND*1/enemySpwanSpeed, createEnemy, this); //change ememy speed and enemy spwan speed loop enemySpeedLoop=game.time.events.loop(Phaser.Timer.SECOND*1.5, changeEnemySpeed, this); //give powerup powerUp=game.time.events.loop(Phaser.Timer.SECOND*20, powerFun, this); }, update: function(){ //scrolling background this.background.tilePosition.y+=2; //keybord control if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) { this.ship.y-=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { this.ship.y+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { this.ship.x+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { this.ship.x-=2; } //dont go out if(this.ship.y<0+this.ship.height/2) { this.ship.y=0+this.ship.height/2; } if(this.ship.y>this.game.world.height-this.ship.height/2) { this.ship.y=this.game.world.height-this.ship.height/2; } if(this.ship.x<0+this.ship.width/2) { this.ship.x=0+this.ship.width/2; } if(this.ship.x>this.game.world.width-this.ship.width/2) { this.ship.x=this.game.world.width-this.ship.width/2; } //check for collisions game.physics.arcade.overlap(golis,enemies,b_e_collide,null,this); game.physics.arcade.overlap(this.ship,enemies,s_e_collide,null,this); game.physics.arcade.overlap(this.ship,powers,s_power1_collide,null,this); }, }; //setting start game conditions function setStart(){ buttetSpwanSpeed=2; bulletSpeed=2000; enemySpwanSpeed=1; enemySpeed=300; score=0; bulletSize=1.2 } //fire bullet function function fireBullet(){ goli=this.game.add.sprite(this.ship.x,this.ship.y-this.ship.height/2,'goli'); goli.anchor.setTo(0.5); goli.scale.setTo(bulletSize,1); goli.checkWorldBounds = true; goli.outOfBoundsKill = true; //adding to group golis.add(goli); game.world.moveDown(goli); game.physics.arcade.enable(goli); goli.body.collisonWorldBounds=true; goli.body.velocity.y=-bulletSpeed; bullet_sound.play("fire"); } //create enemy function function createEnemy(){ enemyNo=game.rnd.integerInRange(1, 5); x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); enemy=this.game.add.sprite(x1,10,'enemy'+enemyNo); enemy.anchor.setTo(0.5); enemy.scale.setTo(0.4); enemy.checkWorldBounds = true; enemies.add(enemy); enemy.outOfBoundsKill = true; game.physics.arcade.enable(enemy); enemy.body.collisonWorldBounds=true; enemy.angle=90; enemy.no=enemyNo; //moving enemy angleRedian=game.physics.arcade.moveToXY(enemy, x2, this.game.world.height+enemy.height, enemySpeed,0); angleDegree=angleRedian*57.2958; enemy.angle=90+angleDegree; } //runs when bullet collide to enemy function b_e_collide(goli,enemy){ //blast blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',30,false,true); //killing goli.kill(); enemy.kill(); //update scores if(enemy.no<4) { score+=1; killed_sound.play('killed'); } this.scoreText.text = 'Kills: ' + score; } //runs when ship collide to enemy function s_e_collide(ship,enemy){ blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',10,false,true); ship.kill(); enemy.kill(); //music.stop(); this.scoreText.kill(); death_music.play("death_music"); game.time.events.remove(fireLoop); game.time.events.add(Phaser.Timer.SECOND * 2, function() { fianlScore = this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'KILL: '+score, { fontSize: '32px', fill: 'yellow' }); fianlScore.anchor.setTo(0.5); gameOverText = this.game.add.text(this.game.world.centerX,this.game.world.centerY - fianlScore.height, 'GAME OVER', { fontSize: '32px', fill: 'red' }); gameOverText.anchor.setTo(0.5); //restart button restart=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY + fianlScore.height+10,'restart'); restart.anchor.setTo(0.5); restart.scale.setTo(0.05,0.05); restart.inputEnabled = true; restart.events.onInputDown.add(restartGame, this); game.time.events.stop(); }, this); } //runs when ship collide power1 function s_power1_collide(ship,power){ power.kill(); game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/10, fireBullet, this); game.time.events.add(Phaser.Timer.SECOND * 10, function(){ game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); },this); } function changeEnemySpeed() { if(enemySpeed<=900) { enemySpeed+=5; } if(enemySpwanSpeed<=3) { enemySpwanSpeed+=0.025; } enemyLoop.delay=Phaser.Timer.SECOND*1/enemySpwanSpeed; } //send power up function powerFun() { x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); power=this.game.add.sprite(x1,10,'power1'); power.anchor.setTo(0.5); var shine=power.animations.add('shine'); power.animations.play('shine',5,true,true); power.checkWorldBounds = true; power.outOfBoundsKill = true; powers.add(power); game.physics.arcade.enable(power); power.body.collisonWorldBounds=true; game.physics.arcade.moveToXY(power, x2, this.game.world.height+power.height, 400,0); powerDelay=game.rnd.integerInRange(20,35); powerUp.delay=Phaser.Timer.SECOND*powerDelay; } function restartGame(){ setStart(); game.time.events.start(); game.state.start("PreGameState"); } game.state.add("GameState",GameState); game.state.add("BootState",BootState); game.state.add("LoadingState",LoadingState); game.state.add("PreGameState",PreGameState); game.state.start("BootState"); main.js
  17. Input not reactivating on mobile

    Hello GameDevs, I am doing a turn-based board game as a college project for both desktop and mobile browsers using PhaserJS framework. However I have ran into a problem regarding the input on mobile. Here's a part of my code: function move (sprite){ //disabling input so the user can't interrupt the moving sprite game.input.enabled = false; //move the selected sprite to a blue tile game.physics.arcade.moveToObject(spriteSelecionado,sprite,60,600); //function to stop the sprite from moving permanently game.time.events.add(600, function () { //stops the sprite spriteSelecionado.body.velocity.x = 0; spriteSelecionado.body.velocity.y = 0; //clean the tiles used for moving the sprite movimentacao.callAll('kill'); /*This is where the problem resides. While on desktop browers it works just fine, the line above doesn't re-enable the input on mobile after a couple times it is used */ game.input.enabled = true; }, this); } I am currently disabling all the input while the moving sprite hasn't reached its destination so the player doesn't end up clicking midway on it and screwing up the game animations. After the turn ends, I reactivate the input so game continues. The problem is that this just works twice on mobile, If I try to move the game sprites twice all my Input stops responding. (if I click on the console whi
  18. Mobile canvas resolution

    Hi everyone, I'm currently makind VR apps with BabylonJS, and try to solve the issue of the canvas resolution. I've already found some discussions about this topic, oddly none seems to concern the same issue as I do (it's not about anti-aliasing, as far as I understand, it's more about hardware pixel and css pixel) If I open this playground in my phone : https://www.babylonjs-playground.com/#JPJB3A#2 (not VR, the question is the same for mobile VR and mobile non-VR applications) The pixels are too large. When watching the phone through Google Cardboard it's even worse. This playground https://www.babylonjs-playground.com/#JPJB3A#1 is much better, with hardwareScaling set to 0.25 It's fairly logical, because my phone has 4 hardware pixels per "layout pixel". 1) I'm using a ZTE Axon 7 phone, with 2500*1080 screen. A full screen canvas has width = 900px, height=450px in my browser. Do you encounter the same issues with your phone ? 2) Is there already an automatic built-in way to set the canvas resolution ? Like with the <meta> or something ? (ie : without adding resizing code in the app) 3) If no, should not we add some code to recognize the screen dpi an set the hardwareScaling accordingly ? So it work "out of the box" on mobile. Or is it to CPU-intensive to enforce x16 resolution ? Thanks a lot for you inputs ! Have a nice week-end PS : I've also tried the scenes from @davrous -interesting- article here : https://www.davrous.com/2017/07/07/from-zero-to-hero-creating-webvr-experiences-with-babylon-js-on-all-platforms/ , I'm 90% sure I have the same issues with the examples like Sponza scene, also the fact there are some textures ad lightning make it less obvious.
  19. What is the best practice in picking up this gesture, and infact gestures in general? I know that the Pinch-to-zoom is already implemented as the sorta camera radius increase/decrease on the universal and touch camera, however I want to use the gesture on an orthographic camera, so need to pick up the event. How?
  20. Hi everyone, We've been working on a 3d mobile RPG game for a few weeks using Babylon.js and what we've been continuously struggling with is how challenging it is to keep 60fps on mobile. Let me share the "game" here to show you what the scene looks like: https://xiaobaker.github.io/. Don't laugh. Some stats: We have a ground mesh with standard material We have 4 different kinds of environment objects, tree1, tree2, rock1, rock2. We created 50 meshes of them using mesh.createInstance(). We have up to around 10 active characters in the camera. Each character has 6 meshes. I don't think we can instance them because each of them will need its own bone animation (one day -_-). Under 50 draw calls in total Running this on iphone 6 with ios 10.3.3 gives under 40 fps. We are hoping to keep it at 60 with even more stuff we want to add later on. I'm not super experienced with graphics optimizations, so could really use some advice here. A few optimizations I'm thinking of: The environment objects never change position or anything. How can we optimize for that? They use different materials, so I can't just merge them. Also, freezeWorldMatrix() on instanced meshes seem to destroy the mesh. Currently in the inspector it shows that mesh selection is taking 9.4ms and render takes 13ms. How do we bring mesh selection down? Octree can bring mesh selection down to 4.5ms but still that's quite a bit. How do we debug what's happening in the 13ms of "render"? How do we debug webGL performance issues on mobile devices in general? Any general suggestions on how to optimize for a game like this? Any inputs are greatly appreciated!
  21. Hello, Gamers/Game Devs! I hope you all are having a wonderful day. I'd like to share with you a game I have been working on. Before 'publishing' it, I would like your feedback and any constructive ideas and suggestions you may have. Please either leave a comment or submit on the menu screen using the "Feedback/Bugs" button. Thank you to everyone who helps a fellow developer out! The URL is http://skrrt.ioAt the moment, there are no known bugs, so if you encounter un-excepted behavior please notify me and if possible, attach a screenshotPlease note: The game is multiplayer (each server can hold 50 players), however since it is still in testing phase there are also a few bots that will be there when others aren't.
  22. Phaser and CanvasInput problem

    Hi, I'm developing a mobile game, and I have a few fields that player needs to fill out, I use CanvasInput, but it causes a strange problem, that it zooms in to the game and changes the resolution and then the rest of a game disappears. Like on the screen:
  23. On mobile, when you want to scroll the page, you drag screen with one finger. However, when your finger is on canvas, you can't drag the page. If a canvas covers whole screen, there is no way to scroll the page. Is there a way to enable scrolling-dragging if canvas element is under the finger?
  24. Hello, I have seen some games on Android Play Store that are like 3 or 4MB in size with good performance and others are over 40MB with almost the same amount of graphics contents. Can anyone point me to resource(s) where I can learn about packaging tools and comparisons. I think I need to learn that stuff before planning and starting a project. What do you use yourself for mobile phones? Thanks
  25. [Phaser] Power The Blocks

    Hello, I made this game using Phaser. Please enjoy, all feedback welcome. Game Link: http://www.ninjagamedev.com/games/powertheblocks/