0
$\begingroup$

How to disable the cursor. I'm using this script that disables the course view more as I can click the menus even without viewing the cursor.

import bge
from bge import render


def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner

    bge.render.showMouse(False)

main()
$\endgroup$
1
  • $\begingroup$ It's the intended behavior, that only hide the cursor. Rephrase your question, your problem is with your logic of whatever you doing. $\endgroup$ Nov 14, 2017 at 0:41

1 Answer 1

1
$\begingroup$

Your code hides the cursor. Nothing more nothing less. It just contains quite a lot of unnecessary "decoration".

This is the core of the code:

import bge
bge.render.showMouse(False)

As it says it hides the cursor.

It does not make your game ignore the mouse input. You didn't mentioned how your game deals with mouse input. Therefore you get a very generic answer:

  • let your logic ignore the mouse input

When you provide more details you might get a more specific answer that fits your current situation.

Recommendation

... the cursor to be disabled to prevent the game from clicking other menu buttons ...

I suggest you disable "clicking". There are many options to do so:

  • remove the clickable object (when you need clicking again - add another clickable object)

  • add a sensor that indicate if clicking is active or not e.g. via property enter image description here

  • switch states to enable/disable clicking enter image description here enter image description here

$\endgroup$
3
  • $\begingroup$ Right. There is Logic Bricks which activates the visibility of the course in the same way as this script just changing to True. When the player clicks on new game I need the cursor to be disabled to prevent the game from clicking other menu buttons avoiding bugs ... Logic Bricks -> Always + Script (this script). $\endgroup$
    – Júnior
    Nov 14, 2017 at 11:48
  • 1
    $\begingroup$ I added three recommendations $\endgroup$
    – Monster
    Nov 15, 2017 at 9:10
  • $\begingroup$ Interesting. I did not know I could use state and motion to solve this. Thank you very much! $\endgroup$
    – Júnior
    Nov 16, 2017 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .