garethquirke

Members
  • Content count

    6
  • Joined

  • Last visited

  1. I have a unorthodox style of my game states using the let keyword for each state. So I'll try this snippet in the boot stage of my game state, thanks for your help
  2. My game does not scale correctly when the browser loads the game while the window size is made smaller. Another scenario is while in game state, the game will resize correctly, If I try to make the window bigger once again the game will be made out of scale and not usable really. this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
  3. Solved in one line game.physics.arcade.setBounds(0, 120, 900, 500);
  4. Okay so I have a rectangle boundary and I have 4 circles. Each of which I want to collide within this boundary. Is there a way to collide each sprite within this boundary without using p2? var rectangleBoundary = new Phaser.Rectangle(0, 120, 900, 1800); var c1 = game.add.sprite(200, 350, 'qcircle'); var c2 = game.add.sprite(500, 190, 'qcircle'); var c3 = game.add.sprite(120, 30, 'qcircle'); var c4 = game.add.sprite(590, 120, 'qcircle');
  5. Solved this issue by replacing with: item.destroy(); Not sure if the example is outdated but oh well.
  6. I 've been following this example on the phaser website https://github.com/photonstorm/phaser-examples/blob/master/examples/groups/remove.js I get the error "Cannot read property 'visible' of undefined" when I remove one of the flasks from the list, I can't seem to see the problem in my code. let gameState = { preload: function () { // new game elements : flask and big flask game.load.image('flask', '/GameHub/Assets/flask.png',40,40); game.load.image('bigflask', '/GameHub/Assets/bigflask.png',180,180); game.load.image('rectangle', '/GameHub/Assets/rectangle.png'); }, create: function () { game.stage.setBackgroundColor(0xFFFFFF); items = game.add.group(); var item; for (var i = 0; i < 4; i++) { item = items.create(90, 16 + 90 * i, 'flask', i); item.name = 'flask' + i; item.inputEnabled = true; item.input.enableDrag(); item.input.enableSnap(90, 90, false, true); item.events.onDragStop.add(dropFlask, this); } var rectangle = game.add.sprite(390, 20, 'rectangle'); rectangle.scale.setTo(2.0, 3.0); var number = game.add.text(570, 30, '0'); var flask5 = game.add.sprite(490, 130, 'bigflask'); } And my drop function as follows: function dropFlask(item, pointer) { if (item.x < 90) { item.x = 90; } else if (item.x > 390){ items.remove(item); }}