Jump to content

Search the Community

Showing results for tags 'mouseover hover mouse moving sprites collision'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. So I'm having some troubles while trying to swap two Sprites; 1. When the mouse is over the sprite 2. When the mouse isn't over the sprite Everything is working fine while moving the Pointer, I'm using a group that contains many sprites sprite.inputEnabled = true; sprite.events.onInputOver.add(over, this); sprite.events.onInputOut.add(nover, this); function over(sprite){ sprite.loadTexture("spriteTargeted", 0); sprite.over = true; } function nover(sprite){ sprite.loadTexture("spriteNotTargeted", 0); sprite.over = false; } Those sprites will be falling from the top of the screen, if the pointer IS MOVED over one of those sprites, they will be swaped correctly. The problems If the pointer is PLACED ('Not Targeted' sprite will be displayed) in one pixel without being moved and one of those falling sprites collides with the mouse pointer, the 'Targeted Sprite' would not be displayed and the 'Targeted' sprite will remain displayed. If the pointer is PLACED over one sprite ('Targeted Sprite will be displayed) and the pointer remains without any other iteration, the falling sprite will leave the pointer 'boundingBox' the 'Not Targeted' sprite would not be displayed and the 'Targeted' sprite will remain displayed. If the pointer is PLACED over one sprite ('Targeted Sprite will be displayed) and the user ALT+TAB to any other window and move the pointer, when you ALT+TAB back, the 'Targeted Sprite' will remain. I Found a solution looping over all those childrens and checking if the Pointer coordinates are inside the 'boundingbox' of one of those sprites and then swapping the sprites but its quite hard-coded and many calculations are being used when the group contains too many elements. Is there any efficient method to solve this problem? Thank you
×
×
  • Create New...