0 votes

Im trying to make the mouse cursor change depending on where is located on the screen.

I only need it to change in relation to the X axis.
I have tried several ways but without luck.
Is there a way that is possible ?

    extends Sprite
onready var Arrow = get_node("Arrow")
onready var LeftArrow = get_node("Left Arrow")
onready var RightArrow = get_node("Right Arrow")

var MainMouse = Arrow
var LeftMouse = LeftArrow
var RightMouse = RightArrow

func _ready():
    pass

func _process(delta):
    position = get_global_mouse_position()


func _input(event):

   # Mouse in viewport coordinates.
    if event is InputEventMouseMotion and event.position > Vector2(1600,0):
        print("Mouse Motion at: ", event.position)
        MainMouse.visible = true
        LeftMouse.visible = false
        RightMouse.visible = false

    elif event is InputEventMouseMotion and event.position > Vector2(200,''):
        pass
#       MainMouse.visible = false
#       LeftMouse.visible = false
#       RightMouse.visible = false
    elif event is InputEventMouseMotion and event.position > Vector2(200,0):
        pass
#       MainMouse.visible = false
#       LeftMouse.visible = false
#       RightMouse.visible = false

Scene with script

in Engine by (28 points)

1 Answer

0 votes
by (191 points)

I have already added this but unfortunately, it only works with static png.
I wanted to make the animated arrow that is different depending if you are on the sides or if you are in the center using a mouse.tscn as each of the 3 mouse cursor have animation.

I managed to make the animation work for 1 mouse cursor, but I'm not able to make it change to any of the other two :'(

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.