diff --git a/bg/cursor/cursor_arrow.png b/bg/cursor/cursor_arrow.png new file mode 100644 index 0000000..d2666c4 Binary files /dev/null and b/bg/cursor/cursor_arrow.png differ diff --git a/bg/cursor/cursor_arrow.png.import b/bg/cursor/cursor_arrow.png.import new file mode 100644 index 0000000..94d92d0 --- /dev/null +++ b/bg/cursor/cursor_arrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://co4a7u0pxeuu2" +path="res://.godot/imported/cursor_arrow.png-016e6bb68d2c04d904ff82ec5ee50aba.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://bg/cursor/cursor_arrow.png" +dest_files=["res://.godot/imported/cursor_arrow.png-016e6bb68d2c04d904ff82ec5ee50aba.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/bg/cursor/cursor_drag.png b/bg/cursor/cursor_drag.png new file mode 100644 index 0000000..78d0d1d Binary files /dev/null and b/bg/cursor/cursor_drag.png differ diff --git a/bg/cursor/cursor_drag.png.import b/bg/cursor/cursor_drag.png.import new file mode 100644 index 0000000..07d436d --- /dev/null +++ b/bg/cursor/cursor_drag.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dxajv5y5s8q28" +path="res://.godot/imported/cursor_drag.png-829f8f6b9f9953dc61691149f4688a11.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://bg/cursor/cursor_drag.png" +dest_files=["res://.godot/imported/cursor_drag.png-829f8f6b9f9953dc61691149f4688a11.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/bg/cursor/cursor_pointing_hand.png b/bg/cursor/cursor_pointing_hand.png new file mode 100644 index 0000000..d25c95c Binary files /dev/null and b/bg/cursor/cursor_pointing_hand.png differ diff --git a/bg/cursor/cursor_pointing_hand.png.import b/bg/cursor/cursor_pointing_hand.png.import new file mode 100644 index 0000000..6e70240 --- /dev/null +++ b/bg/cursor/cursor_pointing_hand.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bha0hd2b7y73m" +path="res://.godot/imported/cursor_pointing_hand.png-12dd2a74777853d26a51801a2b407a4b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://bg/cursor/cursor_pointing_hand.png" +dest_files=["res://.godot/imported/cursor_pointing_hand.png-12dd2a74777853d26a51801a2b407a4b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/main.gd b/main.gd index 02e8f50..cc8b5ef 100644 --- a/main.gd +++ b/main.gd @@ -1,14 +1,16 @@ extends Node -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. +const CURSOR_ARROW := preload("res://bg/cursor/cursor_arrow.png") +const CURSOR_POINTING_HAND := preload("res://bg/cursor/cursor_pointing_hand.png") +const CURSOR_DRAG := preload("res://bg/cursor/cursor_drag.png") -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass +func _ready(): + Input.set_custom_mouse_cursor(CURSOR_ARROW) + Input.set_custom_mouse_cursor(CURSOR_POINTING_HAND, Input.CURSOR_POINTING_HAND) + Input.set_custom_mouse_cursor(CURSOR_DRAG, Input.CURSOR_DRAG) + func _on_main_menu_enter_level(): $BGMPlayer.play() diff --git a/objects/card/card.gd b/objects/card/card.gd index 8bb67e1..b3676ec 100644 --- a/objects/card/card.gd +++ b/objects/card/card.gd @@ -34,6 +34,7 @@ func _on_mouse_release(): last_occupied_area = entered_area entered_area.set_card(self) emit_signal("put") + Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) $SFXPutDown.play() # prints("card", $Word.get_word(), "put at", entered_area.name, "at global_position", global_position, "when origin global_position at", origin_global_position) else: @@ -85,7 +86,8 @@ func _process(delta: float) -> void: _on_mouse_release() if is_dragging: have_deal_on_mouse_release = false - global_position = get_global_mouse_position() + global_position = get_global_mouse_position().round() + Input.set_default_cursor_shape(Input.CURSOR_DRAG) func on_card_entered(area: Block) -> void: is_card_entered += 1 @@ -115,9 +117,11 @@ func get_word() -> String: func _on_mouse_entered(): $CardBackSprite.animation = "highlighted" + Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) func _on_mouse_exited(): $CardBackSprite.animation = "default" + Input.set_default_cursor_shape(Input.CURSOR_ARROW) func set_victory(v: bool): $Word.set_victory(v) diff --git a/objects/card_base/card_base.gd b/objects/card_base/card_base.gd index 4f03e87..036de2e 100644 --- a/objects/card_base/card_base.gd +++ b/objects/card_base/card_base.gd @@ -38,6 +38,7 @@ func draw_card(): return set_card_count(card_count - 1) $SFXPickUp.play() + Input.set_default_cursor_shape(Input.CURSOR_DRAG) new_card_node = Card.instantiate() new_card_node.set_word($Word.get_word()) new_card_node.set_position(position) @@ -101,9 +102,11 @@ func _process(delta) -> void: func _on_mouse_entered(): mouse_on = true if $AnimatedSprite2D.animation == "default": - $AnimatedSprite2D.animation = "highlighted" + $AnimatedSprite2D.animation = "highlighted" + Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) func _on_mouse_exited(): mouse_on = false if $AnimatedSprite2D.animation == "highlighted": $AnimatedSprite2D.animation = "default" + Input.set_default_cursor_shape(Input.CURSOR_ARROW) diff --git a/project.godot b/project.godot index 670ccf5..6c26cb8 100644 --- a/project.godot +++ b/project.godot @@ -24,6 +24,7 @@ window/size/resizable=false window/stretch/mode="viewport" window/stretch/scale=4.0 window/stretch/scale_mode="integer" +mouse_cursor/custom_image="res://bg/cursor/cursor_arrow.png" [rendering]