From 882ad36b8ba1fdc5040f157245b8a28c5b699804 Mon Sep 17 00:00:00 2001 From: Enzo Cranford Date: Thu, 3 Oct 2024 07:39:22 +0200 Subject: [PATCH] feat: rework spawning system & fix player collisions --- scenes/classes/character.gd | 2 ++ scenes/levels/level.gd | 24 ++++++++++++++++-------- scenes/levels/level.tscn | 23 ++++++----------------- scenes/main.tscn | 2 -- scenes/players/crosshair.tscn | 1 + scenes/players/player.gd | 2 -- scenes/players/player.tscn | 3 ++- scenes/zombie/zombie.tscn | 4 +++- 8 files changed, 30 insertions(+), 31 deletions(-) diff --git a/scenes/classes/character.gd b/scenes/classes/character.gd index 0aabb6d..5819bbe 100644 --- a/scenes/classes/character.gd +++ b/scenes/classes/character.gd @@ -4,6 +4,8 @@ class_name Character extends CharacterBody2D @export var speed: float = 40.0 @export var sprite_frames: Array[SpriteFrames] +@export var display_name: String + func _enter_tree() -> void: $AnimatedSprite2D.sprite_frames = sprite_frames.pick_random() diff --git a/scenes/levels/level.gd b/scenes/levels/level.gd index cba0a77..b5f5e9a 100644 --- a/scenes/levels/level.gd +++ b/scenes/levels/level.gd @@ -1,16 +1,20 @@ extends Node2D -@export var zombies_num: int = 2 -@export var players: int = 2 +@export var num_characters: int = 2 +@export var num_players: int = 2 @export var zombie_scene: PackedScene @export var player_scene: PackedScene -@export var spawn_points: Node +@export var character_height: int = 34 @export var colors: Array[Color] +@export var spawn_offset: Vector2 = Vector2(50, 10) +@export var base_height: int = 360 var characters: Array[Character] +@onready var num_zombies: int = num_characters - num_players + @onready var finish_line: Area2D = $Finish @@ -23,11 +27,11 @@ func _ready() -> void: func spawn_characters() -> void: - for i in zombies_num: + for i in num_zombies: var zombie = zombie_scene.instantiate() zombie.name = "Zombie " + str(i + 1) characters.append(zombie) - for i in players: + for i in num_players: var player = player_scene.instantiate() player.number = i player.name = "Player" + str(i) @@ -39,9 +43,13 @@ func spawn_characters() -> void: characters.shuffle() - var points := spawn_points.get_children() - for i in points.size(): - characters[i].position = points[i].position + var total_characters: int = num_zombies + num_players + for i in num_zombies + num_players: + var available_height = base_height - spawn_offset.y + var spacing = available_height / total_characters + 1 + var y_position = spawn_offset.y + i * spacing + + characters[i].position = Vector2(spawn_offset.x, y_position) add_child(characters[i]) diff --git a/scenes/levels/level.tscn b/scenes/levels/level.tscn index 720fa46..582cd3d 100644 --- a/scenes/levels/level.tscn +++ b/scenes/levels/level.tscn @@ -8,14 +8,13 @@ [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_i32s4"] normal = Vector2(-1, 0) -[node name="Level" type="Node2D" node_paths=PackedStringArray("spawn_points")] +[node name="Level" type="Node2D"] script = ExtResource("1_lble1") -zombies_num = 1 -players = 3 +num_characters = 6 zombie_scene = ExtResource("2_f4kno") player_scene = ExtResource("4_g23f4") -spawn_points = NodePath("SpawnPoints") colors = Array[Color]([Color(0, 0.53712, 0.935348, 1), Color(0.802953, 0.221948, 0.278697, 1), Color(0.83882, 0.579958, 0.142823, 1), Color(0.740961, 0.265187, 0.677605, 1)]) +spawn_offset = Vector2(50, 64) [node name="Background" type="TileMapLayer" parent="."] tile_map_data = PackedByteArray("AAAAAAAAAAAIAAYAAAAAAAEAAAAMAAcAAAAAAAIAAAAAAAMAAAAAAAMAAAALAAEAAAAAAAQAAAABAAIAAAAAAAUAAAAAAAEAAAAAAAYAAAAKAAYAAAAAAAcAAAAMAAMAAAAAAAgAAAAGAAcAAAAAAAkAAAAGAAcAAAAAAAoAAAAOAAMAAAAAAAsAAAAIAAYAAAAAAAwAAAAHAAMAAAAAAA0AAAAPAAMAAAAAAA4AAAAKAAUAAAAAAA8AAAAAAAMAAAAAABAAAAAIAAMAAAAAABEAAAAEAAYAAAAAABIAAAAJAAYAAAAAABMAAAAJAAIAAAAAABQAAAADAAAAAAAAABUAAAAIAAIAAAAAABYAAAAHAAMAAAABAAAAAAAIAAUAAAABAAEAAAAPAAcAAAABAAIAAAAPAAAAAAABAAMAAAADAAEAAAABAAQAAAADAAUAAAABAAUAAAABAAMAAAABAAYAAAAOAAIAAAABAAcAAAAIAAIAAAABAAgAAAAGAAUAAAABAAkAAAAFAAYAAAABAAoAAAAMAAMAAAABAAsAAAAIAAUAAAABAAwAAAAMAAYAAAABAA0AAAADAAYAAAABAA4AAAAOAAEAAAABAA8AAAABAAQAAAABABAAAAAAAAAAAAABABEAAAAJAAcAAAABABIAAAAMAAMAAAABABMAAAABAAUAAAABABQAAAAOAAUAAAABABUAAAADAAcAAAABABYAAAAIAAIAAAACAAAAAAAFAAYAAAACAAEAAAALAAYAAAACAAIAAAAOAAUAAAACAAMAAAANAAUAAAACAAQAAAALAAYAAAACAAUAAAADAAcAAAACAAYAAAAJAAcAAAACAAcAAAABAAEAAAACAAgAAAAOAAQAAAACAAkAAAAAAAIAAAACAAoAAAADAAUAAAACAAsAAAAHAAQAAAACAAwAAAAHAAMAAAACAA0AAAAIAAcAAAACAA4AAAAFAAIAAAACAA8AAAAPAAYAAAACABAAAAAJAAQAAAACABEAAAAFAAIAAAACABIAAAAHAAEAAAACABMAAAAPAAIAAAACABQAAAAIAAQAAAACABUAAAAEAAEAAAACABYAAAAEAAUAAAADAAAAAAAKAAUAAAADAAEAAAAGAAMAAAADAAIAAAAJAAMAAAADAAMAAAAFAAIAAAADAAQAAAAGAAUAAAADAAUAAAAJAAEAAAADAAYAAAAMAAEAAAADAAcAAAABAAUAAAADAAgAAAAOAAQAAAADAAkAAAANAAQAAAADAAoAAAAPAAQAAAADAAsAAAANAAIAAAADAAwAAAANAAUAAAADAA0AAAAFAAAAAAADAA4AAAAGAAIAAAADAA8AAAADAAAAAAADABAAAAAPAAAAAAADABEAAAAPAAAAAAADABIAAAAAAAAAAAADABMAAAANAAcAAAADABQAAAACAAUAAAADABUAAAAGAAIAAAADABYAAAAOAAQAAAAEAAAAAAANAAAAAAAEAAEAAAAIAAYAAAAEAAIAAAAMAAYAAAAEAAMAAAAPAAUAAAAEAAQAAAAIAAIAAAAEAAUAAAADAAYAAAAEAAYAAAALAAMAAAAEAAc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nAAgAAAAJAAIAAAAnAAkAAAALAAYAAAAnAAoAAAALAAcAAAAnAAsAAAAAAAcAAAAnAAwAAAAHAAEAAAAnAA0AAAAKAAYAAAAnAA4AAAAFAAYAAAAnAA8AAAAHAAUAAAAnABAAAAAPAAAAAAAnABEAAAAMAAAAAAAnABIAAAAMAAUAAAAnABMAAAAOAAcAAAAnABQAAAAJAAAAAAAnABUAAAAKAAYAAAAnABYAAAAHAAAAAAA=") @@ -23,21 +22,11 @@ tile_set = ExtResource("4_em7cp") [node name="Finish" type="Area2D" parent="."] position = Vector2(578, 10) +collision_mask = 2 metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Finish"] shape = SubResource("WorldBoundaryShape2D_i32s4") -[node name="SpawnPoints" type="Node" parent="."] - -[node name="Spawn" type="Node2D" parent="SpawnPoints"] -position = Vector2(50, 50) - -[node name="Spawn2" type="Node2D" parent="SpawnPoints"] -position = Vector2(50, 140) - -[node name="Spawn3" type="Node2D" parent="SpawnPoints"] -position = Vector2(50, 230) - -[node name="Spawn4" type="Node2D" parent="SpawnPoints"] -position = Vector2(50, 320) +[node name="Node2D" type="Node2D" parent="."] +position = Vector2(50, 620) diff --git a/scenes/main.tscn b/scenes/main.tscn index 9f465ed..298c667 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -9,8 +9,6 @@ [node name="Main" type="Node"] [node name="Level" parent="." instance=ExtResource("1_js5b6")] -zombies_num = 2 -players = 2 [node name="GUI" type="Control" parent="."] process_mode = 3 diff --git a/scenes/players/crosshair.tscn b/scenes/players/crosshair.tscn index 83ddd43..dc72a3f 100644 --- a/scenes/players/crosshair.tscn +++ b/scenes/players/crosshair.tscn @@ -14,6 +14,7 @@ region = Rect2(97, 49, 14, 14) [node name="Crosshair" type="Area2D"] z_index = 200 +collision_mask = 2 script = ExtResource("1_gycjl") speed = 120.0 diff --git a/scenes/players/player.gd b/scenes/players/player.gd index 16843c3..31acf1e 100644 --- a/scenes/players/player.gd +++ b/scenes/players/player.gd @@ -7,8 +7,6 @@ extends Character @export var crosshair_color: Color -var display_name: String - var speed_boost diff --git a/scenes/players/player.tscn b/scenes/players/player.tscn index 2584d24..fbc30c5 100644 --- a/scenes/players/player.tscn +++ b/scenes/players/player.tscn @@ -6,10 +6,11 @@ [ext_resource type="SpriteFrames" uid="uid://baufp5u5muwll" path="res://resources/zombie_3_frames.tres" id="4_mstxp"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_5wrs1"] -size = Vector2(34, 68) +size = Vector2(32, 64) [node name="Player" type="CharacterBody2D" groups=["players"]] z_index = 100 +collision_layer = 2 script = ExtResource("1_fff2d") run_boost = 48.0 speed = 32.0 diff --git a/scenes/zombie/zombie.tscn b/scenes/zombie/zombie.tscn index 517e268..c04f9b0 100644 --- a/scenes/zombie/zombie.tscn +++ b/scenes/zombie/zombie.tscn @@ -6,12 +6,14 @@ [ext_resource type="SpriteFrames" uid="uid://baufp5u5muwll" path="res://resources/zombie_3_frames.tres" id="4_kcvoe"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_6al3e"] -size = Vector2(40, 64) +size = Vector2(32, 64) [node name="Zombie" type="CharacterBody2D"] +collision_layer = 2 script = ExtResource("1_7wpk0") speed = 32.0 sprite_frames = Array[SpriteFrames]([ExtResource("2_8m1jv"), ExtResource("3_rc68x"), ExtResource("4_kcvoe")]) +display_name = "Zombie" metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."]