From 0c0674dc05d71ab156b7077f4415b78135d7c1cc Mon Sep 17 00:00:00 2001 From: perivesta <> Date: Sun, 9 Jul 2023 15:45:42 +0200 Subject: more sprites --- Scripts/Checkpoint.gd | 8 ++++---- Scripts/car_behaviour.gd | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'Scripts') diff --git a/Scripts/Checkpoint.gd b/Scripts/Checkpoint.gd index d8c671e..565afef 100644 --- a/Scripts/Checkpoint.gd +++ b/Scripts/Checkpoint.gd @@ -3,15 +3,15 @@ extends Node2D var was_visited = false -@onready var sprite : Sprite2D = $Sprite2D - func set_was_visited(visited: bool): was_visited = visited if(visited): - hide() +# $Sprite2Dopen.hide() + $Sprite2Dclosed.show() else: - show() + $Sprite2Dclosed.hide() +# $Sprite2Dopen.show() # TODO change the sprite to indicate the change func _on_area_2d_body_entered(body): diff --git a/Scripts/car_behaviour.gd b/Scripts/car_behaviour.gd index 8c22bf3..1a69b37 100644 --- a/Scripts/car_behaviour.gd +++ b/Scripts/car_behaviour.gd @@ -29,7 +29,10 @@ func _ready(): func _physics_process(delta): if not driving: + $Sprite2D.hide() return + + $Sprite2D.show() # Code for getting the next desired direction based on the environment set_interest() -- cgit From 317e16b1f99036275ac27f850314df5a965526a9 Mon Sep 17 00:00:00 2001 From: perivesta <> Date: Sun, 9 Jul 2023 15:53:42 +0200 Subject: thank u ice very cool --- Scripts/Checkpoint.gd | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'Scripts') diff --git a/Scripts/Checkpoint.gd b/Scripts/Checkpoint.gd index 565afef..119419a 100644 --- a/Scripts/Checkpoint.gd +++ b/Scripts/Checkpoint.gd @@ -6,14 +6,9 @@ var was_visited = false func set_was_visited(visited: bool): was_visited = visited - if(visited): -# $Sprite2Dopen.hide() - $Sprite2Dclosed.show() - else: - $Sprite2Dclosed.hide() -# $Sprite2Dopen.show() - # TODO change the sprite to indicate the change - + $Sprite2Dclosed.visible = visited + $Sprite2Dopen.visible = !visited + + func _on_area_2d_body_entered(body): - hide() set_was_visited(true) -- cgit