• Content count

  • Joined

  • Last visited

  1. trevb

    Hover effect when dragging

    Cheers guys, I couldn't use WebGL as it seems to push the Macs a bit hard (Retina displays) although it's fine on my PC so I opted to group the dropzones so that I can iterate through them quickly on drag update and it seems to have done the trick. I don't like putting loops in update functions personally but it seems it was necessary. Trev
  2. trevb

    Hover effect when dragging

    Thanks for your feedback samid737, I'll have a look into the options you've given me! Cheers - Trev
  3. trevb

    Hover effect when dragging

    Hi all, I'm pretty new to this framework and have been failing to come up with a viable solution - was hoping you guys could help me out? I am building an Phaser application where I have the ability to drag a sprite over the top of another sprite and drop it onto the sprite below it, at which stage my code will create a relationship with the dropped sprite and the sprite it was dropped on. I am not using any physics for this. This should add some context to the problem but the 'drop' is not the question I want answered. Whilst dragging over the sprite I would like to alter the dragged sprite's scale to show the user that it is being detected as hovering over something it can drop into. I could iterate through the sprites on screen and check whether the coordinates of the dragged sprite hit another sprite but that would be terribly inefficient to put in the onDragUpdate function. I'm looking for an alternative where I can raycast (or similar) from the sprite's x/y drag position from the dragged sprite downwards and see if it hits another sprite. Any ideas as the docs are a bit thin in this area? I've created a JS Fiddle to help demonstrate: Many Thanks - Trev
  4. Hi All, I'm after a little bit of advice about performance on Mac computers. My dev machine is a Windows PC with a standard 72dpi 1080p monitor but my boss has an iMac with a 144dpi screen. I also have a 96dpi iMac to test on. The Windows PC @ full screen runs silky smooth The iMac 96dpi manages to give a smooth experience of Phaser at full screen but the Safari browser menus start lagging The iMac 144dpi screen crashes completely at full screen needing a full machine restart By full screen I mean filling up the browser viewport. The 144dpi Mac performance issues were happening with the browser as a small window of approx 1080p resolution. I am using this code to set the scale of my game: this.gameWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); this.gameHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); = new Phaser.Game(this.gameWidth, this.gameHeight, Phaser.AUTO, 'game', { preload: this.preload, create: this.create, update: this.update, render: this.render }); Please note, dragging Safari onto a 72dpi screen that is attached to these Mac's makes them run silky smooth again. I had a quick search and found a handy little thing called devicePixelRatio which I've temporarily used to resize the canvas by dividing the gameWidth and gameHeight by it. This creates acceptable performance on all machines but now the iMac understandably has some space around the canvas. this.gameWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0) / devicePixelRatio; this.gameHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) / devicePixelRatio; = new Phaser.Game(this.gameWidth, this.gameHeight, Phaser.AUTO, 'game', { preload: this.preload, create: this.create, update: this.update, render: this.render }); My question is - what's the best way to get Phaser working on these high dpi screens? Many Thanks - Trev