diff --git a/entities/ant_master.tscn b/entities/ant_master.tscn index c479e89..faf9956 100644 --- a/entities/ant_master.tscn +++ b/entities/ant_master.tscn @@ -9,3 +9,4 @@ script = ExtResource( 1 ) [node name="PheromoneMap" parent="." instance=ExtResource( 2 )] width = 1000 height = 1000 +pheromone_cleaning_radius = 0 diff --git a/entities/base_ant.gd b/entities/base_ant.gd index c05b434..fca1939 100644 --- a/entities/base_ant.gd +++ b/entities/base_ant.gd @@ -70,7 +70,6 @@ func hit(direction: Vector2): set_state(State.HURTING) func die(): - # print("Ant die!") rotation = 0.0 # PI/2.0 emit_signal("ant_dead") set_state(State.DEAD) diff --git a/entities/enemy_npc_ant.tscn b/entities/enemy_npc_ant.tscn index 2a23d76..11d313d 100644 --- a/entities/enemy_npc_ant.tscn +++ b/entities/enemy_npc_ant.tscn @@ -17,7 +17,10 @@ speed = 40 [node name="interaction_field" parent="base_ant" index="1"] collision_layer = 0 -collision_mask = 3 +collision_mask = 2 + +[node name="CollisionPolygon2D" parent="base_ant/interaction_field" index="0"] +polygon = PoolVector2Array( -15, -34.4474, -2.5, -4.97369, 5, -4.97369, 17.5, -34.4474 ) [node name="Default" parent="base_ant" index="2"] visible = false diff --git a/entities/pheromone_map.gd b/entities/pheromone_map.gd index 74b5cff..406238b 100644 --- a/entities/pheromone_map.gd +++ b/entities/pheromone_map.gd @@ -9,7 +9,7 @@ export var cell_height = 10 export var cell_width = 10 export var PHEROMONE_INCREMENT = 0.1 export var debug_mode = false -export var pheromone_cleaning_radius = 2 # radius for cleaning pheromones in a grid (e.g.: if 2, cleans in a 2x2 square) +export var pheromone_cleaning_radius = 1 # radius for cleaning pheromones in a grid (e.g.: if 2, cleans in a 2x2 square) # each cell stores pheromones var cells = [] var nonzero_cells = [] @@ -63,7 +63,7 @@ func add_pheromone(position: Vector2, increment: float = PHEROMONE_INCREMENT): cells[cell_index[0]][cell_index[1]] = clamp(cells[cell_index[0]][cell_index[1]] + increment, 0, 0.5) if not pheromones.has(cell_index): var new_particles = _pheromone.instance() - new_particles.position = position + new_particles.position = get_cell_position(cell_index[0], cell_index[1]) pheromones[cell_index] = new_particles add_child(new_particles) #update() @@ -71,8 +71,8 @@ func add_pheromone(position: Vector2, increment: float = PHEROMONE_INCREMENT): func remove_pheromone(position: Vector2): var cell_index = get_cell_index(position) if cell_index != null: - for i in range(-pheromone_cleaning_radius, pheromone_cleaning_radius): - for j in range(-pheromone_cleaning_radius, pheromone_cleaning_radius): + for i in range(-pheromone_cleaning_radius, pheromone_cleaning_radius + 1): + for j in range(-pheromone_cleaning_radius, pheromone_cleaning_radius + 1): var y_index: int = cell_index[0] + i var x_index: int = cell_index[1] + j cells[y_index][x_index] = 0.0 diff --git a/entities/todeskaefer.tscn b/entities/todeskaefer.tscn index 3fe04be..b5af2d7 100644 --- a/entities/todeskaefer.tscn +++ b/entities/todeskaefer.tscn @@ -121,7 +121,7 @@ shape = SubResource( 4 ) [node name="BiteArea" type="Area2D" parent="."] collision_layer = 0 -collision_mask = 19 +collision_mask = 18 [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BiteArea"] position = Vector2( -0.351671, 0 ) @@ -129,6 +129,7 @@ scale = Vector2( 1.70334, 1 ) polygon = PoolVector2Array( -5, -12, -9, -21, 10, -21, 6, -12 ) [node name="SenseArea" type="Area2D" parent="."] +visible = false collision_layer = 0 collision_mask = 19 diff --git a/levels/game_logic.gd b/levels/game_logic.gd index 5298e84..8f4ae04 100644 --- a/levels/game_logic.gd +++ b/levels/game_logic.gd @@ -3,7 +3,7 @@ extends Node2D export var _player_mode = true onready var _player = $AntMaster/player onready var _camera = $camera - +var _num_ants: int = 0 func set_player_mode(val: bool): if _player: @@ -15,7 +15,7 @@ func set_player_mode(val: bool): func _ready(): set_player_mode(true) - _update_ant_no() + _init_ant_no() func _process(delta): if Input.is_action_just_pressed("pause_menu") && !get_tree().paused: @@ -46,10 +46,10 @@ func hide_menu(): get_tree().paused = false -func _update_ant_no(): +func _init_ant_no(): var ants = get_tree().get_nodes_in_group("ants") - var num_ants = len(ants) - $HUD/AntNo.text = str(num_ants) + _num_ants = len(ants) + $HUD/AntNo.text = str(_num_ants) func _management_loop(_delta): @@ -76,8 +76,9 @@ func _on_main_menu_Button_pressed() -> void: func _on_AntMaster_ant_spawn() -> void: - _update_ant_no() - + _num_ants += 1 + $HUD/AntNo.text = str(_num_ants) func _on_AntMaster_ant_dead() -> void: - _update_ant_no() + _num_ants -= 1 + $HUD/AntNo.text = str(_num_ants) diff --git a/levels/production_levels/intro_level.tscn b/levels/production_levels/intro_level.tscn index 962826d..f314130 100644 --- a/levels/production_levels/intro_level.tscn +++ b/levels/production_levels/intro_level.tscn @@ -118,6 +118,14 @@ total_resources = 100.0 position = Vector2( 1072.26, 68.2646 ) total_resources = 100.0 +[node name="coins27" parent="Items" instance=ExtResource( 1 )] +position = Vector2( 1120, 905 ) +total_resources = 100.0 + +[node name="coins28" parent="Items" instance=ExtResource( 1 )] +position = Vector2( 1256, 913 ) +total_resources = 100.0 + [node name="coins16" parent="Items" instance=ExtResource( 1 )] position = Vector2( 956.401, 105.895 ) total_resources = 100.0 @@ -235,7 +243,7 @@ position = Vector2( 1174.5, 897.202 ) position = Vector2( 1194.66, 900.031 ) [node name="enemy_npc_ant23" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 1047.83, 914.293 ) +position = Vector2( 228, 659 ) [node name="enemy_npc_ant24" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 1219.3, 964.144 ) @@ -259,10 +267,10 @@ position = Vector2( 1222.46, 811.975 ) position = Vector2( 1278.7, 819.54 ) [node name="enemy_npc_ant31" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 978.883, 894.841 ) +position = Vector2( 251, 665 ) [node name="enemy_npc_ant32" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 999.036, 897.669 ) +position = Vector2( 278, 622 ) [node name="enemy_npc_ant33" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 942.821, 910.044 ) @@ -277,11 +285,29 @@ position = Vector2( 1147.88, 947.167 ) position = Vector2( 1212.04, 909.476 ) [node name="enemy_npc_ant37" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 1176.98, 891.539 ) +position = Vector2( 249, 597 ) [node name="enemy_npc_ant38" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 1213.73, 743.455 ) +[node name="enemy_npc_ant69" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1189, 778 ) + +[node name="enemy_npc_ant70" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1214, 703 ) + +[node name="enemy_npc_ant71" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1213, 671 ) + +[node name="enemy_npc_ant72" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1200, 635 ) + +[node name="enemy_npc_ant73" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1161, 598 ) + +[node name="enemy_npc_ant74" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 1193, 593 ) + [node name="enemy_npc_ant39" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 1201.62, 955.652 ) @@ -304,7 +330,7 @@ position = Vector2( 1204.78, 803.483 ) position = Vector2( 1238.37, 790.755 ) [node name="enemy_npc_ant46" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 992.318, 897.669 ) +position = Vector2( 194, 630 ) [node name="enemy_npc_ant47" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 1196.05, 738.152 ) @@ -340,7 +366,28 @@ position = Vector2( 1226.55, 858.534 ) position = Vector2( 1246.7, 861.362 ) [node name="enemy_npc_ant58" parent="EnemyAntMaster" instance=ExtResource( 15 )] -position = Vector2( 1151.79, 846.836 ) +position = Vector2( 87, 690 ) + +[node name="enemy_npc_ant62" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 60, 697 ) + +[node name="enemy_npc_ant63" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 69, 766 ) + +[node name="enemy_npc_ant64" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 82, 790 ) + +[node name="enemy_npc_ant65" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 347, 861 ) + +[node name="enemy_npc_ant68" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 343, 918 ) + +[node name="enemy_npc_ant66" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 392, 859 ) + +[node name="enemy_npc_ant67" parent="EnemyAntMaster" instance=ExtResource( 15 )] +position = Vector2( 442, 860 ) [node name="enemy_npc_ant59" parent="EnemyAntMaster" instance=ExtResource( 15 )] position = Vector2( 1218.21, 806.312 )