fuzzyworld

godot-shooter / commit

Removed a lot of logging statements and added logging statements for setting the destination.

ad6f22a5cb03a3fcfa8849bcea87e4efe2a99c5a · Pavel Safronov · 2023-11-02 14:13:58 -0700 · parents 50483a82eec8

Removed a lot of logging statements and added logging statements for setting the destination.
Speeding up enemies.
Random changes to filtering.
 Bullet.gd           | 2 --
 CharacterTheme.tres | 3 ++-
 Enemy.gd            | 6 +-----
 Player.tscn         | 6 ++++--
 World.gd            | 3 +++
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Bullet.gd b/Bullet.gd
index 1cb6e6a..17d71d2 100644
--- a/Bullet.gd
+++ b/Bullet.gd
@@ -14,7 +14,6 @@ func _physics_process(delta: float) -> void:
 	position += transform.y * speed * delta
 	
 func on_expiration():
-	Utils.log("killing bullet")
 	queue_free()
 
 func on_bullet_body_entered(body):
@@ -22,7 +21,6 @@ func on_bullet_body_entered(body):
 	var players = tree.get_nodes_in_group("player")
 	var player = players[0]
 	if body.has_method("hurt") && body != player:
-		Utils.log("removing bullet")
 		body.hurt()
 		var se = SmallExplosion.instance()
 		get_parent().add_child(se)
diff --git a/CharacterTheme.tres b/CharacterTheme.tres
index c8671d0..52dfe6b 100644
--- a/CharacterTheme.tres
+++ b/CharacterTheme.tres
@@ -3,8 +3,9 @@
 [ext_resource path="res://assets/Unique.ttf" type="DynamicFontData" id=1]
 
 [sub_resource type="DynamicFont" id=1]
-size = 24
+size = 30
 use_mipmaps = true
+use_filter = true
 font_data = ExtResource( 1 )
 
 [resource]
diff --git a/Enemy.gd b/Enemy.gd
index 8dd0993..c694f80 100644
--- a/Enemy.gd
+++ b/Enemy.gd
@@ -7,7 +7,7 @@ const Utils = preload("res://Utils.gd")
 const Explosion = preload("res://Explosion.tscn")
 const Smoke = preload("res://Smoke.tscn")
 
-export var move_speed = 25
+export var move_speed = 40
 export var health = -1
 export var max_health = 10
 export var is_targeted = false
@@ -56,11 +56,9 @@ func _physics_process(_delta: float) -> void:
 func hurt():
 	if dead:
 		return
-	Utils.log("zombie is hurt, health was ", health)
 	health -= 1
 	var smoke = Smoke.instance()
 	var smoke_pos = get_damage_point_on_body()
-	Utils.log("smoke pos", smoke_pos)
 	smoke.position = smoke_pos
 	add_child(smoke)
 	if health <= 0:
@@ -69,7 +67,6 @@ func hurt():
 func kill():
 	if dead:
 		return
-	Utils.log("zombie is dead")
 	dead = true
 	$Graphics/Alive.hide()
 	$CollisionPolygon2D.queue_free()
@@ -80,7 +77,6 @@ func kill():
 	emit_signal("enemy_killed")
 
 func _on_death_explosion_finished():
-	Utils.log("removing zombie after explosion finished")
 	$AnimationPlayer.play("fade_out")
 
 func get_damage_point_on_body() -> Vector2:
diff --git a/Player.tscn b/Player.tscn
index e99caba..969e601 100644
--- a/Player.tscn
+++ b/Player.tscn
@@ -59,14 +59,15 @@ margin_bottom = 40.0
 color = Color( 0, 0, 0, 1 )
 
 [node name="Panel" type="Panel" parent="CanvasLayer/CenterContainer/DeathScreen"]
-margin_right = 199.0
-margin_bottom = 115.0
+margin_right = 250.0
+margin_bottom = 150.0
 mouse_filter = 2
 
 [node name="Label" type="Label" parent="CanvasLayer/CenterContainer/DeathScreen/Panel"]
 anchor_right = 1.0
 margin_top = 50.0
 margin_bottom = 14.0
+theme = ExtResource( 5 )
 text = "Game Over"
 align = 1
 valign = 1
@@ -76,6 +77,7 @@ anchor_top = 1.0
 anchor_right = 1.0
 anchor_bottom = 1.0
 margin_top = -20.0
+theme = ExtResource( 5 )
 text = "Restart"
 
 [node name="Camera2D" type="Camera2D" parent="."]
diff --git a/World.gd b/World.gd
index d0da9d7..39ce60a 100644
--- a/World.gd
+++ b/World.gd
@@ -31,6 +31,8 @@ func add_new_enemy(should_be_visible: bool = false) -> void:
 func _input(event: InputEvent) -> void:
 	if event is InputEventScreenTouch:
 		if event.pressed && !$Player.dead:
+			Utils.log("event position", event.position)
+			Utils.log("to_global(event.position)", to_global(event.position))
 			set_destination(to_global(event.position))
 
 func _process(_delta: float) -> void:
@@ -48,6 +50,7 @@ func _process(_delta: float) -> void:
 		$Player.velocity = Vector2.ZERO
 
 func set_destination(pos: Vector2) -> void:
+	Utils.log("setting destination to ", pos)
 	destination = pos
 	is_destination_set = true
 	$Destination.position = pos