HELP! Mouse cursor problem.

0 favourites
  • 8 posts
From the Asset Store
Mouse cursor is something that the player controls and sees all the time, that's why it is so important to make it cool!
  • Hi, I'm pretty much almost done with my game, but there's something wrong with my mouse cursor. I have it set to a custom cursor from a sprite which has 18 frames. Every tick it sets to frame 0 and when clicking stuff with specific IDs it changes its frame accordingly and when clicking anywhere on screen back to frame 0. It was working fine until this morning when booting up my game in the debugger the cursor wasn't changing frames! I checked my code but it seems nothing has change since. Is there something wrong is this a bug? or maybe I have to use multiple event sheets? (all my code for the whole game is in one event sheet). I need to fix this because many of my events work by clicking objects with the cursor set to a specific frame.

  • hi NoaBluecat can you upload a capx?

  • Every tick it sets to frame 0

    If this event is after any other event that sets the frame, you won't see any frame change.

    Do you need to set it every tick?

  • https://www.dropbox.com/s/g4i09rv739jcxo1/Problem.capx?dl=0 Here's the .capx, also have a backup plan involving global variables as replacement conditions for the events that need the cursor frame. I also noticed in the debugger according to it it is changing frames when the cursor is over something, but on the display the cursor is not changing, this is weirding me out more.

  • Think I've found a solution to the problem, going to start coding it in and see if it works.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • IT WORKED!! Can't believe how simple the solution was. Turned out that I also had to set the frame I wanted it to be on every tick, not once. I can breath a sigh of relief. Basically, I changed it so that when clicking an item it changed a string variable inside the custom cursor sprite. Then made two every tick events: one that set the mouse cursor to the custom sprite, and the other with an added condition for setting up the frame of the custom sprite to 0 (that condition is basically strVariable == " ") then copying the latter while changing the condition for every other frame in the custom courser sprite.

    It can get a bit long depending on the amount of frames (I have 18) but it is really simple and effective.

  • Setting such a simple thing every tick is not a very good way of doing it.

    You should do something like:

    on click

    -- mouse is over sprite ---> set cursor frame to id

    --else --> set cursor frame to 0

    There is no need for an every tick event here and you should avoid using those events as much as possible and just use it when you have to.

  • Setting such a simple thing every tick is not a very good way of doing it.

    You should do something like:

    on click

    -- mouse is over sprite ---> set cursor frame to id

    --else --> set cursor frame to 0

    There is no need for an every tick event here and you should avoid using those events as much as possible and just use it when you have to.

    That sounds simpler than what I did, thank you! But it is pretty late into the development and the deadline for my game is litteraly tomorrow, so I'm keeping it as it is for now as long as it works. I'll definitely try this on my next project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)