Skip to content

Commit

Permalink
Show pentagram in center
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumlamm committed Apr 17, 2024
1 parent 2fdec9e commit 5400c75
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/scripts/pentagram.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ func activate_combo() -> void:
combo_done.emit(combo)
combo = []

func calculate_center_position(event: InputEvent):
return event.position if "position" in event else get_viewport().get_visible_rect().size / 2
func center_position() -> Vector2:
return get_viewport().get_visible_rect().size / 2

func show_pentagram(center_pos):
func show_pentagram():
visible = true
image.position = center_pos - image.size * image.scale * 0.5
multiline.add_point(center_pos)
image.position = center_position() - image.size * image.scale * 0.5

func hide_pentagram():
visible = false
Expand Down Expand Up @@ -73,7 +72,9 @@ func get_position_of_event(event: InputEvent):
func _input(event: InputEvent) -> void:
if event.is_action("summon") and event.is_pressed() != is_active:
if event.is_pressed():
show_pentagram(calculate_center_position(event))
show_pentagram()
var start_pos = event.position if "position" in event else center_position()
multiline.add_point(start_pos)
else:
hide_pentagram()

Expand Down

0 comments on commit 5400c75

Please sign in to comment.