diff options
| -rw-r--r-- | Bullet.gd | 5 | ||||
| -rw-r--r-- | HUD.tscn | 10 | ||||
| -rw-r--r-- | HealthBar.gd | 6 | ||||
| -rw-r--r-- | Wordart.gd | 7 | ||||
| -rw-r--r-- | assets/wordart.png | bin | 0 -> 990940 bytes | |||
| -rw-r--r-- | project.godot | 4 |
6 files changed, 29 insertions, 3 deletions
@@ -5,7 +5,10 @@ var velocity = Vector2() var target = Vector2.ZERO #var player = load("") var shot = false; +var screen_size +func _ready(): + screen_size = get_viewport_rect().size func _physics_process(delta): target = get_global_mouse_position() @@ -19,6 +22,8 @@ func _physics_process(delta): collision.collider.free() if velocity == Vector2(0.0, 0.0): queue_free() + if position.x > screen_size.x or position.x < 0 or position.y > screen_size.y or position.y < 0: + queue_free() @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://HealthBar.gd" type="Script" id=1] +[ext_resource path="res://Wordart.gd" type="Script" id=2] +[ext_resource path="res://assets/wordart.png" type="Texture" id=3] [node name="HUD" type="CanvasLayer"] @@ -38,3 +40,9 @@ margin_left = 1272.0 margin_right = 1280.0 margin_bottom = 14.0 text = "0" + +[node name="Wordart" type="Sprite" parent="."] +position = Vector2( 626, 372 ) +scale = Vector2( 0.171967, 0.186029 ) +texture = ExtResource( 3 ) +script = ExtResource( 2 ) diff --git a/HealthBar.gd b/HealthBar.gd index ae4ce42..91a5b8e 100644 --- a/HealthBar.gd +++ b/HealthBar.gd @@ -4,11 +4,11 @@ extends ProgressBar # Declare member variables here. Examples: # var a = 2 # var b = "text" - +signal player_dead # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + connect("player_dead", get_node("/root/Main/HUD/Wordart"), "_on_player_dead") # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -16,3 +16,5 @@ func _ready(): # pass func _on_player_hit(delta): value -= delta * 20 + if value == 0: + emit_signal("player_dead") diff --git a/Wordart.gd b/Wordart.gd new file mode 100644 index 0000000..6204e10 --- /dev/null +++ b/Wordart.gd @@ -0,0 +1,7 @@ +extends Sprite + +func _ready(): + visible = false + +func _on_player_dead(): + visible = true diff --git a/assets/wordart.png b/assets/wordart.png Binary files differnew file mode 100644 index 0000000..a4030d1 --- /dev/null +++ b/assets/wordart.png diff --git a/project.godot b/project.godot index a6eab52..035fc3a 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,10 @@ window/size/height=720 window/stretch/mode="2d" window/stretch/aspect="keep" +[global] + +fonts=false + [gui] common/drop_mouse_on_gui_input_disabled=true |
