Search the Community
Showing results for tags 'oninputover'.
-
So I have two event listeners in my game which work great drop.events.onDragStart.add(this.onDragStart, this); drop.events.onDragStop.add(this.onDragStop, this); But the callback only gets trigggered when the click takes place over the sprite. I want the event to trigger if the pointer is already down and then it moves over the sprite, is there any way to do that? One solution would be to use onInputOver drop.events.onInputOver.add(this.onInputOver, this); But that won't tell the sprite to be dragged, Is there a way to manually trigger events in Phaser? EDIT Ok I found a solution that works use onInputOver and manually start the drag. onInputOver: function(sprite, pointer){ if(pointer.isDown){ sprite.input.startDrag(pointer); } },
-
- ondragstop
- input
-
(and 4 more)
Tagged with:
-
When using v2.4.7 I was able to use onInputOver to change the button's tint. Now, in v2.4.8 the onInputOver is no longer triggered. Also, the mouse pointer no longer turns into a finger pointer on mouse over. Is anyone else experiencing these issues with the Button in v2.4.8? Example of code: ClassX = function() { ... this.button = game.add.button(100, 1000, null, actionOnClick, null, 2, 1, 0); this.button.onInputOver.add(this.mouseOver, this); }; ClassX.prototype.mouseOver = function() { this.someSprite.tint = 0x88d5ea; };
- 3 replies
-
- oninputover
- button
-
(and 1 more)
Tagged with:
-
The Phaser buttons seem to have a bug, as onInputOver doesn't fire for a short time after any part of the game area is clicked. This becomes a problem very often for me, since I'm making a menu for my game and when I click on 'New game' button for instance, 3 save file buttons pop up and if I move my mouse over one of them the highlighting effect doesn't appear. And I also have a UI that shows the description of what the button does to the player on mouse over, which doesn't appear in this situation since the onInputOver hasn't fired. You might be thinking that perhaps I'm holding the click down as I move the mouse, but no, I have let go of the click even before moving the mouse. I made a simple code to test if this happens even in simple situations, to check if my own code isn't somehow creating this behaviour and yes it still the case. Here is the code, a video with audio cues on when I click and how the button highlighting doesn't happen after the click. https://www.youtube.com/watch?v=Hzdh4tl8DF8 var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() { game.load.spritesheet('main_menu_game', 'assets/menu_items/main_menu_game.png', 128, 40);}function create() { var button; button = game.add.button(30, 30, 'main_menu_game', function () { }, this, 1, 0); button.events.onInputOver.add(function () { }, this); button.events.onInputOut.add(function () { }, this); button = game.add.button(200, 80, 'main_menu_game', function () { }, this, 1, 0); button.events.onInputOver.add(function () { }, this); button.events.onInputOut.add(function () { }, this);}function update() {}