• Content Count

  • Joined

  • Last visited

  1. Staff0rd, I'm glad that my game gave you a little challenge. Yes, you can use the arrow keys, and also the W and S buttons. The clickable / tappable controls are for mobile users. All of the buttons can be held down. I'm planning on implementing a little help menu to make things clear. I created the game to be fully responsive, and it also displays a notice to rotate the device, when someone tries to play in portrait mode below 900px screen width. You have pause, mute and fullscreen buttons, and you can see your position on the level. And yes, the stars are positioned randomly on every play. The speed of the ghost increases a bit every second to add a little more difficulty, and I tried to imitate the effect of wobbling, so the ghost moves up and down by itself. The game also stores your best score and the mute state in local storage. I'm also planning to create some obstacles to be avoided and enemies that can attack you, and you would have to fight back. One problem I'm having is that there's no sound in Firefox at all, and Opera and Edge only play some of the sounds for some reason. I will try and fix these. Thank you for taking your time to experiment with my work.
  2. Hello, I have created a little game with Phaser, you can see it here:
  3. I have finally figured it out. The only things I needed were buttonUp.input.pointerOver() and This way when the button is being clicked or pointed on, the player goes up.
  4. Thank you for your answer! Yes, the function is in Update. I have already set controls for the keyboard cursors, but I also need buttons for touch devices. That is what I've been trying to implement unsuccessfully.
  5. I am trying to create movement controls for my game. I created an Up button, which, when held down, should make the player go upwards. The problem is that it only goes up once by 5 pixels when clicked. I tried to use isDown, but I don't know how to use it with buttons, only with keyboard controls. What is the correct way to do it? In CreatebuttonUp = game.add.button(16,, 'button_up', goUp, this, 0, 1);buttonUp.anchor.setTo(0, 1);buttonUp.fixedToCamera = true;In Update function goUp() { player.position.y -= 5;}
  6. Thank you for the support, it is working now as expected!
  7. Thank you very much for your help! Could you please tell me where should I insert your code? I inserted it in the boot section inside the create function as it is in the tutorial you referenced to, but I get this error: Uncaught TypeError: this.scale.setScreenSize is not a function.
  8. Hello everyone, I have developed a little game with Phaser with the help of the tutorials and examples on the official site. My problem is that I've been trying to make it responsive, but with no success. I have already read a few tutorials about it (like this:, but I'm quite new to programming and can't get it working any way. I managed to make the canvas responsive by setting its width to 100% and height to auto, but this way, all the mapping went crazy, the buttons' hitboxes don't get scaled with the canvas. As I researched, the way to do it is with Scale Manager, but the official documentation is a bit complicated for me. Everything I tried to do just messed up the game. I would be really grateful if someone could help me with it. You can see the game below. Thank you very much in advance. var bootState = { create: function() { game.physics.startSystem(Phaser.Physics.ARCADE); game.state.start('load'); }}var loadState = { preload: function() { loadingLabel = game.add.text(, 250, 'Loading...', {font: '26px Arial', fill: '#fff'}); loadingLabel.anchor.setTo(0.5, 0.5); game.load.image('sky', 'assets/sky.jpg'); game.load.image('star', 'assets/star.png'); game.load.spritesheet('dude', 'assets/dude.png', 50, 53); game.load.image('ground', 'assets/ground.png'); game.load.spritesheet('button_start', 'assets/button_start.png', 200, 80); game.load.spritesheet('button_restart', 'assets/button_restart.png', 80, 80); }, create: function() { game.state.start('menu'); }}var menuState = { create: function() { game.add.sprite(0, 0, 'sky'); game.add.tileSprite(0,,, 284, 'ground'); buttonStart = game.add.button(, 220, 'button_start', this.start, this, 0, 1); buttonStart.anchor.setTo(0.5, 0); }, start: function() { game.state.start('play'); }}var playState = { create: function() { sky = game.add.sprite(0, 0, 'sky'); sky.fixedToCamera = true; ground = game.add.tileSprite(0,, 2000, 284, 'ground');, 0, 2000, 600); player = game.add.sprite(100, - 150, 'dude'); game.physics.arcade.enable(player); player.anchor.setTo(1, 1); player.body.collideWorldBounds = true;; score = 0; stars =; stars.enableBody = true; for (i = 0; i < 10; i++) { star = stars.create(200 + i * 150, 200 + Math.random() * 200, 'star'); } scoreText = game.add.text(16, 16, 'Score: 0', {font: '32px Arial', fill: '#fff'}); scoreText.fixedToCamera = true; cursors = game.input.keyboard.createCursorKeys(); }, update: function() { game.physics.arcade.overlap(player, stars, this.collectStar, null, this); player.body.velocity.x = 150; if (player.position.x > - 100) { game.state.start('end'); } if (cursors.up.isDown) { player.position.y -= 5; } else if (cursors.down.isDown) { player.position.y += 5; } }, collectStar: function(player, star) { star.kill(); score += 10; scoreText.text = 'Score: ' + score; }}var endState = { create: function() { game.add.sprite(0, 0, 'sky'); game.add.tileSprite(0,,, 284, 'ground'); scoreLabel = game.add.text(465, 160, 'Score: ' + score, {font: '26px Arial', fill: '#fff'}); scoreLabel.anchor.setTo(0.5, 0); buttonRestart = game.add.button(465, 270, 'button_restart', this.restart, this, 0, 1); buttonRestart.anchor.setTo(0.5, 0.5); }, restart: function() { game.state.start('play'); score = 0; }}game = new Phaser.Game(930, 600, Phaser.AUTO, 'game');game.state.add('boot', bootState);game.state.add('load', loadState);game.state.add('menu', menuState);game.state.add('play', playState);game.state.add('end', endState);game.state.start('boot');