0 Favourites

Change mouse cursor

  • In game maker you can change the mouse cursor to a sprite is there any way to do that in construct2?

  • One way is to use any sprite you wish and just set the sprite x = Mouse.X and sprite y = Mouse.Y every tick.

  • Yes, but then the cursor will still exist over the sprite. I too wonder if cursor replacement is possible.

  • I have wondered this too.

    It would be particularly useful in games where you "place" a sprite on the screen, such as Tower Defenses and RTS type games.

  • If there was an option to hide the cursor - like in CC - then using the sprite way would work. As it is, see THIS post and response from Ashley regarding a similar request.

  • Ok try this..

    My Sprites ive added called poweroff and reset.

    Hand relates to mouse set cursor style hand.

    1) Mouse | Cursor is over poweroff | mouse | set cursor to hand

    2) System | else | Mouse | Set cursor from sprite "Your Sprite" Sprite

    3) Mouse | Cursor is over reset | mouse | set cursor to hand

    4) repeating step 3 for all other objects you need to select from.

    Note: Otherwise mouse is always set to your sprite anywhere else

    Which works in all browsers as well.

  • Set mouse curser to none hides the mouse.

    Set mouse curser from sprite to change to your own

    For more information see

    scirra.com/manual/114/mouse

  • For "Set mouse cursor from sprite" is there a way to set it back to the default mouse? Like if there's a UI element that changes your mouse sprite to put down a building, it would change your mouse to the building sprite, and once you create the building it would change it back to whatever the default mouse cursor is?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • IcePotato There's the 'Mouse: Set cursor style' action. You can set it to 'Normal'.

  • you can set a global variable for mouseover and then a button click for your building and set the global variable to 1. and when ever its set to 1 by using cursor is over building and inverting it you can change the type of cursors by setting them from sprite and also setting that sprite's x, y coordinate to the mouse and choose another mouse button like the right button when ever clicked it changes back the mouse cursor to the usual one you have along with setting the building cursor to lout of layout or something. i hope it helped you, otherwise i can send you a little demonstration with the help of a construct file..there might be other simple ways to do it but i figured this out for my own game..

  • I found this post and it helped me discover a new solution to the same issue.

    I think that there's a new functionality on Construct that may aid.

    You can now use the following logic:

    When Mouse Cursor is over "Object 1" -> Mouse Set Cursor to "Hand"

    If you don't want your mouse stuck as a hand then you must add an inverse condition:

    When Mouse Cursor is Over "Background" AND Mouse cursor is NOT over "Object 1" -> Mouse Set Cursor to "Normal"

  • Just set Mouse: set cursor to None, and then have a sprite follow your mouse.x and mouse.y every tick.

  • So if you are trying to set your mouse cursor to a sprite right now you may be running into issues with it on IE & Chrome. It may not let you or only let you set it once, along with that you may want your mouse cursor to be animated and treated better as a object with properties a mouse might not be able to give.

    First things first create your mouse cursor image.

    Then once you have that made you will need to import it into construct 2 as a sprite object.

    Load the image where ever you have saved it into the actual sprite object, if you have it animated you will want to look at the animation bar at the bottom and import them that way by right clicking and by file, or just manually adding each frame of animation.

    You will of course need to import the construct 2 mouse plugin object into your project some where

    Next thing you will need to do is create a on start of layout event, in that event you need set the mouse cursor style to None.

    Then after that you need to have it create your mouse image sprite object on the top layer x = mouse.x: y = mouse.y.

    The final step is to have it always update to the mouse's position. So you create a on every tick event, and in it you create a action to set position of your sprite object to mouse.x & mouse.y

    l

  • "5 years later" thanks guys!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
195 16,198
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
96 57,361
bitworks's avatar
bitworks
Unread hot topic
90 77,102
leonhard's avatar
leonhard