diff --git a/core/Cursor.gd b/core/Cursor.gd index 487e5a1..80a6824 100644 --- a/core/Cursor.gd +++ b/core/Cursor.gd @@ -81,7 +81,7 @@ func resetCast(bFull = false): CastResult.clear() hoveredObjects.clear() if bFull: - if (hoveredObject and hoveredObject.has_method("on_unhover")): + if (hoveredObject != null and hoveredObject.has_method("on_unhover")): hoveredObject.on_unhover() hoveredObject = null hoveredSticker = null diff --git a/prefab/solid_sticker.tscn b/prefab/solid_sticker.tscn index b4730f5..a58bd3e 100644 --- a/prefab/solid_sticker.tscn +++ b/prefab/solid_sticker.tscn @@ -9,6 +9,7 @@ region = Rect2(384, 64, 288, 224) [sub_resource type="GDScript" id="GDScript_uqtu8"] script/source = "@tool extends Sprite2D +var OutlineMat:ShaderMaterial = preload(\"res://shaders/shaderMaterial_Outline.tres\") @export_group(\"Sticker Detection Shape\") @export var StickerShape :Shape2D: @@ -44,6 +45,22 @@ extends Sprite2D $StaticBody2D/CollisionShape2D.rotation = CollisionRotation $StaticBody2D/CollisionShape2D.queue_redraw() +func on_released(): + print(self,\" released\") + +func on_click(): + print(self,\" clicked\") + +func on_hover(): + material = OutlineMat + queue_redraw() + +func on_unhover(): + material = null + queue_redraw() + +func on_grab(_offset:Vector2=Vector2(0.0,0.0)): + pass " [sub_resource type="RectangleShape2D" id="RectangleShape2D_ep5ck"]