clean some code

This commit is contained in:
Lucas 2024-07-29 23:14:07 +02:00
parent 9e5e97dff6
commit aa2a234bc9
2 changed files with 18 additions and 1 deletions

View file

@ -81,7 +81,7 @@ func resetCast(bFull = false):
CastResult.clear() CastResult.clear()
hoveredObjects.clear() hoveredObjects.clear()
if bFull: if bFull:
if (hoveredObject and hoveredObject.has_method("on_unhover")): if (hoveredObject != null and hoveredObject.has_method("on_unhover")):
hoveredObject.on_unhover() hoveredObject.on_unhover()
hoveredObject = null hoveredObject = null
hoveredSticker = null hoveredSticker = null

View file

@ -9,6 +9,7 @@ region = Rect2(384, 64, 288, 224)
[sub_resource type="GDScript" id="GDScript_uqtu8"] [sub_resource type="GDScript" id="GDScript_uqtu8"]
script/source = "@tool script/source = "@tool
extends Sprite2D extends Sprite2D
var OutlineMat:ShaderMaterial = preload(\"res://shaders/shaderMaterial_Outline.tres\")
@export_group(\"Sticker Detection Shape\") @export_group(\"Sticker Detection Shape\")
@export var StickerShape :Shape2D: @export var StickerShape :Shape2D:
@ -44,6 +45,22 @@ extends Sprite2D
$StaticBody2D/CollisionShape2D.rotation = CollisionRotation $StaticBody2D/CollisionShape2D.rotation = CollisionRotation
$StaticBody2D/CollisionShape2D.queue_redraw() $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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ep5ck"]