Skip to content

MousePointer

Divided by Zer0 edited this page Mar 9, 2022 · 7 revisions

MousePointer

Extends: Area2D

Description

This handles the mouse pointer collision shape 2D interactions It is used for detecting when a card and its elements is being hovered As we cannot rely on Control node relevant signals due to Godot bugs such as:

Constants Descriptions

MOUSE_RADIUS

const MOUSE_RADIUS: int = 2

The amount of radius in pixels that the mouse collision area

This const is sometimes looked-up by other nodes to determine their own properties

Property Descriptions

current_focused_card

var current_focused_card: Card

The card that is currently highlighted as a result of this mouse cursor hovering over it.

overlaps

var overlaps: Array

The card that is currently highlighted as a result of this mouse cursor hovering over it. The amount of cards the cursor is hovering. We're using our own Array instead of get_overlapping_areas() because those are updated every tick, which causes glitches when the player moves the mouse too fast.

Instead we populate according to signals,which are more immediate

is_disabled

var is_disabled: bool
  • Setter: set_disabled

The card that is currently highlighted as a result of this mouse cursor hovering over it. The amount of cards the cursor is hovering. We're using our own Array instead of get_overlapping_areas() because those are updated every tick, which causes glitches when the player moves the mouse too fast.

Instead we populate according to signals,which are more immediate When set to false, prevents the player from disable interacting with the game.

Method Descriptions

determine_global_mouse_pos

func determine_global_mouse_pos() -> Vector2

We're using this helper function, to allow our mouse-position relevant code to work during integration testing Returns either the adjusted global mouse position or a fake mouse position provided by integration testing

disable

func disable() -> void

Disables the mouse from interacting with the board

enable

func enable() -> void

Re-enables the mouse interacting with the board

forget_focus

func forget_focus() -> void

set_disabled

func set_disabled(value) -> void
Clone this wiki locally