From 162a5b485e27dc726a5a03633adcaaf5a8b0716a Mon Sep 17 00:00:00 2001 From: Jakob Feldmann Date: Tue, 7 Jun 2022 17:26:01 +0200 Subject: [PATCH] Simple turret tracks player in limited angles --- src/Actors/Blobby/Blobby.gd | 1 + src/Actors/Enemies/Machines/Turret.gd | 60 +++++++++- src/Actors/Enemies/Machines/Turret.tscn | 6 +- .../Enemies/Machines/TurretStateMachine.gd | 18 ++- src/Levels/Level02.tscn | 84 ------------- src/Levels/Level03.tscn | 61 ---------- src/Levels/LevelTemplate.tscn | 113 ------------------ src/Levels/Plattforms Level.tscn | 10 +- src/Levels/StaticBody2D.gd | 16 --- src/Levels/Tween.gd | 16 --- 10 files changed, 81 insertions(+), 304 deletions(-) delete mode 100644 src/Levels/Level02.tscn delete mode 100644 src/Levels/Level03.tscn delete mode 100644 src/Levels/LevelTemplate.tscn delete mode 100644 src/Levels/StaticBody2D.gd delete mode 100644 src/Levels/Tween.gd diff --git a/src/Actors/Blobby/Blobby.gd b/src/Actors/Blobby/Blobby.gd index 8437561..abd5dfd 100644 --- a/src/Actors/Blobby/Blobby.gd +++ b/src/Actors/Blobby/Blobby.gd @@ -11,6 +11,7 @@ onready var camera_tween = $Camera2D/ShiftTween onready var camera = $Camera2D # TODO Too much speed through midair boosting +# TODO Walljump of of enemies/object not only walls # When the Enemy stomp AREA enters the enemy collision area -> stomp diff --git a/src/Actors/Enemies/Machines/Turret.gd b/src/Actors/Enemies/Machines/Turret.gd index ff0a075..3f8f1e8 100644 --- a/src/Actors/Enemies/Machines/Turret.gd +++ b/src/Actors/Enemies/Machines/Turret.gd @@ -3,8 +3,24 @@ extends KinematicBody2D # Declare member variables here. Examples: # var a: int = 2 # var b: String = "text" -onready var raycast: RayCast2D = $RayCast2D +onready var sightline: RayCast2D = $RayCast2D onready var turret_state_machine = $TurretStateMachine +onready var lock_on_timer = $LockOnTimer +onready var turret_animation = $AnimationPlayer.get_animation("Turret Rotation") +# Derives the freedom from the number of bald head eagles +onready var angle_of_freedom = deg2rad( + turret_animation.track_get_key_value( + 0, turret_animation.track_get_key_count(0) - 1 + ) +) +onready var original_rotation = rotation +onready var rotation_speed_divider = 80 +# TODO causes oscilation +onready var min_rotation_speed = deg2rad(0.3) + +var prey = null +# Ray that goes from the turret to the target +var target_ray # Called when the node enters the scene tree for the first time. @@ -13,7 +29,43 @@ func _ready() -> void: func searching(): - if raycast.is_colliding(): + if sightline.is_colliding(): # The collider returns not the area or body it hit, but the parent of them - if raycast.get_collider().is_in_group("player"): - print_debug("player found") + var collider = sightline.get_collider() + if collider.is_in_group("player"): + prey = collider + + +func start_locking(): + target_ray = RayCast2D.new() + add_child(target_ray) + target_ray.enabled = true + target_ray.exclude_parent = true + target_ray.set_cast_to(to_local(prey.position)) + $AnimationPlayer.stop(false) + + lock_on_timer.start() + + +func is_locked_on_target(): + return lock_on_timer.is_stopped() + + +func shooting(): + target_ray.cast_to = to_local(prey.position) + var target_angle = target_ray.cast_to.angle_to(sightline.cast_to) + var rotation_speed = max( + min_rotation_speed, abs(target_angle / rotation_speed_divider) + ) + if abs(target_angle) < min_rotation_speed: + rotation = rotation - target_angle + else: + rotation = rotation - rotation_speed * sign(target_angle) + rotation = clamp( + rotation, original_rotation, original_rotation + angle_of_freedom + ) + if sightline.is_colliding(): + # The collider returns not the area or body it hit, but the parent of them + var collider = sightline.get_collider() + if collider.is_in_group("player"): + prey = collider diff --git a/src/Actors/Enemies/Machines/Turret.tscn b/src/Actors/Enemies/Machines/Turret.tscn index bfe68d7..20f6a1a 100644 --- a/src/Actors/Enemies/Machines/Turret.tscn +++ b/src/Actors/Enemies/Machines/Turret.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://src/Actors/Enemies/Machines/TurretStateMachine.gd" type="Script" id=4] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 108.869, 37.2448 ) +extents = Vector2( 108.869, 37.8566 ) [sub_resource type="Animation" id=2] resource_name = "Turret Rotation" @@ -35,6 +35,7 @@ scale = Vector2( 0.612294, 1 ) texture = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, -0.103346 ) scale = Vector2( 0.310271, 1.02855 ) shape = SubResource( 1 ) @@ -60,3 +61,6 @@ custom_fonts/font = ExtResource( 2 ) text = "Ihre Werbung" align = 1 valign = 1 + +[node name="LockOnTimer" type="Timer" parent="."] +one_shot = true diff --git a/src/Actors/Enemies/Machines/TurretStateMachine.gd b/src/Actors/Enemies/Machines/TurretStateMachine.gd index 3a94f80..54bfac8 100644 --- a/src/Actors/Enemies/Machines/TurretStateMachine.gd +++ b/src/Actors/Enemies/Machines/TurretStateMachine.gd @@ -15,7 +15,7 @@ func _ready(): # Calls the parent behaviours according to state -func _state_logic(delta): +func _state_logic(_delta): var state_action_ref = "handle_deactivated_state" match self.state: "deactivated": @@ -37,12 +37,26 @@ func handle_searching_state(): parent.searching() +# Locking is intialized once when starting +# While the locking is handled by a Time/Turret, this method just passes +func handle_locking_state(): + pass + + +func handle_shooting_state(): + parent.shooting() + + # Determines which state should be active at the moment func _get_transition(_delta): - print_debug(self.state) # TODO why only this way? parent.get_node("StateLabel").text = self.state var new_state + if parent.prey != null && self.state == "searching": + parent.start_locking() + new_state = "locking" + if self.state == "locking" && parent.is_locked_on_target(): + new_state = "shooting" if new_state != self.state: return new_state diff --git a/src/Levels/Level02.tscn b/src/Levels/Level02.tscn deleted file mode 100644 index acee49a..0000000 --- a/src/Levels/Level02.tscn +++ /dev/null @@ -1,84 +0,0 @@ -[gd_scene load_steps=8 format=2] - -[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=1] -[ext_resource path="res://assets/meta/tileset.png" type="Texture" id=2] -[ext_resource path="res://src/Actors/Enemy/Enemy.tscn" type="PackedScene" id=3] -[ext_resource path="res://assets/environment/background/background.png" type="Texture" id=4] -[ext_resource path="res://src/NeutralObjects/Coin.tscn" type="PackedScene" id=5] - -[sub_resource type="ConvexPolygonShape2D" id=1] -points = PoolVector2Array( 0, 0, 80, 0, 80, 80, 0, 80 ) - -[sub_resource type="TileSet" id=2] -0/name = "tileset.png 0" -0/texture = ExtResource( 2 ) -0/tex_offset = Vector2( 0, 0 ) -0/modulate = Color( 1, 1, 1, 1 ) -0/region = Rect2( 0, 0, 80, 80 ) -0/tile_mode = 0 -0/occluder_offset = Vector2( 0, 0 ) -0/navigation_offset = Vector2( 0, 0 ) -0/shape_offset = Vector2( 0, 0 ) -0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -0/shape = SubResource( 1 ) -0/shape_one_way = false -0/shape_one_way_margin = 1.0 -0/shapes = [ { -"autotile_coord": Vector2( 0, 0 ), -"one_way": false, -"one_way_margin": 1.0, -"shape": SubResource( 1 ), -"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) -} ] -0/z_index = 0 - -[node name="LevelTemplate" type="Node2D"] - -[node name="CanvasLayer" type="CanvasLayer" parent="."] -layer = -1 - -[node name="background" type="TextureRect" parent="CanvasLayer"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_bottom = 76.0 -texture = ExtResource( 4 ) -expand = true -stretch_mode = 1 - -[node name="TileMap" type="TileMap" parent="."] -tile_set = SubResource( 2 ) -cell_size = Vector2( 80, 80 ) -collision_layer = 8 -collision_mask = 0 -format = 1 -tile_data = PoolIntArray( 0, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262153, 0, 0, 262154, 0, 0, 327680, 0, 0, 327686, 0, 0, 327702, 0, 0, 327703, 0, 0, 393216, 0, 0, 393221, 0, 0, 393222, 0, 0, 393237, 0, 0, 393238, 0, 0, 393239, 0, 0, 393247, 0, 0, 393248, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 458765, 0, 0, 458766, 0, 0, 458767, 0, 0, 458768, 0, 0, 458769, 0, 0, 458770, 0, 0, 458771, 0, 0, 458772, 0, 0, 458773, 0, 0, 458774, 0, 0, 458775, 0, 0, 458776, 0, 0, 458777, 0, 0, 458778, 0, 0, 458779, 0, 0, 458780, 0, 0, 458781, 0, 0, 458782, 0, 0, 458783, 0, 0, 458784, 0, 0, 458785, 0, 0, 458786, 0, 0, 458787, 0, 0, 458788, 0, 0, 458789, 0, 0, 458790, 0, 0, 458791, 0, 0, 458792, 0, 0, 458793, 0, 0, 458794, 0, 0, 458795, 0, 0, 458796, 0, 0, 458797, 0, 0, 458798, 0, 0, 458799, 0, 0, 458800, 0, 0, 458801, 0, 0, 458802, 0, 0, 458803, 0, 0, 458804, 0, 0, 458805, 0, 0, 458806, 0, 0, 458807, 0, 0, 458808, 0, 0, 458809, 0, 0, 458810, 0, 0, 458811, 0, 0, 458812, 0, 0, 458813, 0, 0, 458814, 0, 0, 458815, 0, 0, 458816, 0, 0, 458817, 0, 0, 458818, 0, 0, 458819, 0, 0, 458820, 0, 0, 458821, 0, 0, 458822, 0, 0, 458823, 0, 0, 458824, 0, 0, 458825, 0, 0, 458826, 0, 0, 458827, 0, 0, 458828, 0, 0, 458829, 0, 0, 458830, 0, 0, 458831, 0, 0, 458832, 0, 0, 458833, 0, 0, 458834, 0, 0, 458835, 0, 0, 458836, 0, 0, 458837, 0, 0, 458838, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 524307, 0, 0, 524308, 0, 0, 524309, 0, 0, 524310, 0, 0, 524311, 0, 0, 524312, 0, 0, 524313, 0, 0, 524314, 0, 0, 524315, 0, 0, 524316, 0, 0, 524317, 0, 0, 524318, 0, 0, 524319, 0, 0, 524320, 0, 0, 524321, 0, 0, 524322, 0, 0, 524323, 0, 0, 524324, 0, 0, 524325, 0, 0, 524326, 0, 0, 524327, 0, 0, 524328, 0, 0, 524329, 0, 0, 524330, 0, 0, 524331, 0, 0, 524332, 0, 0, 524333, 0, 0, 524334, 0, 0, 524335, 0, 0, 524336, 0, 0, 524337, 0, 0, 524338, 0, 0, 524339, 0, 0, 524340, 0, 0, 524341, 0, 0, 524342, 0, 0, 524343, 0, 0, 524344, 0, 0, 524345, 0, 0, 524346, 0, 0, 524347, 0, 0, 524348, 0, 0, 524349, 0, 0, 524350, 0, 0, 524351, 0, 0, 524352, 0, 0, 524353, 0, 0, 524354, 0, 0, 524355, 0, 0, 524356, 0, 0, 524357, 0, 0, 524358, 0, 0, 524359, 0, 0, 524360, 0, 0, 524361, 0, 0, 524362, 0, 0, 524363, 0, 0, 524364, 0, 0, 524365, 0, 0, 524366, 0, 0, 524367, 0, 0, 524368, 0, 0, 524369, 0, 0, 524370, 0, 0, 524371, 0, 0, 524372, 0, 0, 524373, 0, 0, 524374, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 589842, 0, 0, 589843, 0, 0, 589844, 0, 0, 589845, 0, 0, 589846, 0, 0, 589847, 0, 0, 589848, 0, 0, 589849, 0, 0, 589850, 0, 0, 589851, 0, 0, 589852, 0, 0, 589853, 0, 0, 589854, 0, 0, 589855, 0, 0, 589856, 0, 0, 589857, 0, 0, 589858, 0, 0, 589859, 0, 0, 589860, 0, 0, 589861, 0, 0, 589862, 0, 0, 589863, 0, 0, 589864, 0, 0, 589865, 0, 0, 589866, 0, 0, 589867, 0, 0, 589868, 0, 0, 589869, 0, 0, 589870, 0, 0, 589871, 0, 0, 589872, 0, 0, 589873, 0, 0, 589874, 0, 0, 589875, 0, 0, 589876, 0, 0, 589877, 0, 0, 589878, 0, 0, 589879, 0, 0, 589880, 0, 0, 589881, 0, 0, 589882, 0, 0, 589883, 0, 0, 589884, 0, 0, 589885, 0, 0, 589886, 0, 0, 589887, 0, 0, 589888, 0, 0, 589889, 0, 0, 589890, 0, 0, 589891, 0, 0, 589892, 0, 0, 589893, 0, 0, 589894, 0, 0, 589895, 0, 0, 589896, 0, 0, 589897, 0, 0, 589898, 0, 0, 589899, 0, 0, 589900, 0, 0, 589901, 0, 0, 589902, 0, 0, 589903, 0, 0, 589904, 0, 0, 589905, 0, 0, 589906, 0, 0, 589907, 0, 0, 589908, 0, 0, 589909, 0, 0, 589910, 0, 0 ) - -[node name="Blobby" parent="." instance=ExtResource( 1 )] -position = Vector2( 145.066, 551.48 ) - -[node name="Camera2D" parent="Blobby" index="2"] -limit_right = 85000 - -[node name="CollisionShape2D" parent="Blobby/EnemyDetector" index="0"] -position = Vector2( 0.187286, 0.0127563 ) - -[node name="RightWallRaycast" parent="Blobby/WallRaycasts" index="1"] -position = Vector2( 0.0715485, 0.00415039 ) - -[node name="Enemy" parent="." instance=ExtResource( 3 )] -position = Vector2( 2174, 560 ) - -[node name="Coin" parent="." instance=ExtResource( 5 )] -position = Vector2( 592, 352 ) - -[node name="coin" parent="Coin" index="0"] -position = Vector2( 0, 3 ) - -[node name="CollisionShape2D" parent="Coin" index="1"] -position = Vector2( 0, 3 ) - -[node name="Coin2" parent="." instance=ExtResource( 5 )] -position = Vector2( 749, 274 ) - -[editable path="Blobby"] -[editable path="Coin"] diff --git a/src/Levels/Level03.tscn b/src/Levels/Level03.tscn deleted file mode 100644 index 2cbcb6b..0000000 --- a/src/Levels/Level03.tscn +++ /dev/null @@ -1,61 +0,0 @@ -[gd_scene load_steps=8 format=2] - -[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=1] -[ext_resource path="res://assets/meta/tileset.tres" type="TileSet" id=2] -[ext_resource path="res://src/Actors/Enemies/Beings/Enemy.tscn" type="PackedScene" id=3] -[ext_resource path="res://assets/environment/background/background.png" type="Texture" id=4] -[ext_resource path="res://src/NeutralObjects/Coin.tscn" type="PackedScene" id=5] -[ext_resource path="res://src/UserInterface/Buttons/UserInterface.tscn" type="PackedScene" id=6] -[ext_resource path="res://src/UserInterface/Portal.tscn" type="PackedScene" id=8] - -[node name="Level03" type="Node2D"] - -[node name="UserInterface" type="CanvasLayer" parent="."] - -[node name="UserInterface" parent="UserInterface" instance=ExtResource( 6 )] - -[node name="BackgroundLayer" type="CanvasLayer" parent="."] -layer = -1 - -[node name="background" type="TextureRect" parent="BackgroundLayer"] -anchor_right = 1.016 -anchor_bottom = 1.0 -margin_right = -0.384033 -texture = ExtResource( 4 ) -expand = true -stretch_mode = 1 - -[node name="TileMap" type="TileMap" parent="."] -tile_set = ExtResource( 2 ) -cell_size = Vector2( 80, 80 ) -collision_layer = 8 -collision_mask = 0 -format = 1 -tile_data = PoolIntArray( -1048576, 0, 0, -1048564, 0, 0, -983040, 0, 0, -983028, 0, 0, -917504, 0, 0, -917492, 0, 0, -851968, 0, 0, -851956, 0, 0, -786432, 0, 0, -786420, 0, 0, -720896, 0, 0, -720884, 0, 0, -655360, 0, 0, -655348, 0, 0, -589824, 0, 0, -589812, 0, 0, -524288, 0, 0, -524276, 0, 0, -458752, 0, 0, -458740, 0, 0, -393216, 0, 0, -393215, 0, 0, -393214, 0, 0, -393213, 0, 0, -393204, 0, 0, -327680, 0, 0, -327668, 0, 0, -262144, 0, 0, -262132, 0, 0, -196608, 0, 0, -196607, 0, 0, -196606, 0, 0, -196605, 0, 0, -196596, 0, 0, -131072, 0, 0, -131060, 0, 0, -65536, 0, 0, -65524, 0, 0, 0, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 12, 0, 0, 65536, 0, 0, 65544, 0, 0, 65548, 0, 0, 131072, 0, 0, 131084, 0, 0, 196608, 0, 0, 196620, 0, 0, 262144, 0, 0, 262149, 0, 0, 262154, 0, 0, 262155, 0, 0, 262156, 0, 0, 327680, 0, 0, 327681, 0, 0, 327692, 0, 0, 393216, 0, 0, 393228, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0 ) - -[node name="Blobby" parent="." instance=ExtResource( 1 )] -position = Vector2( 156.988, 538.998 ) - -[node name="Enemy" parent="." instance=ExtResource( 3 )] -position = Vector2( 718.871, 527.037 ) - -[node name="VisibilityEnabler2D" parent="Enemy" index="1"] -position = Vector2( 1363.25, -11.7006 ) - -[node name="Coin" parent="." instance=ExtResource( 5 )] -position = Vector2( 592, 352 ) - -[node name="coin" parent="Coin" index="0"] -position = Vector2( 0, 3 ) - -[node name="CollisionShape2D" parent="Coin" index="1"] -position = Vector2( 0, 3 ) - -[node name="Coin2" parent="." instance=ExtResource( 5 )] -position = Vector2( 749, 274 ) - -[node name="Portal" parent="." instance=ExtResource( 8 )] -position = Vector2( 130.332, -461.479 ) - -[editable path="Enemy"] -[editable path="Coin"] diff --git a/src/Levels/LevelTemplate.tscn b/src/Levels/LevelTemplate.tscn deleted file mode 100644 index cbf269e..0000000 --- a/src/Levels/LevelTemplate.tscn +++ /dev/null @@ -1,113 +0,0 @@ -[gd_scene load_steps=13 format=2] - -[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=1] -[ext_resource path="res://assets/meta/tileset.png" type="Texture" id=2] -[ext_resource path="res://src/Actors/Enemy/Enemy.tscn" type="PackedScene" id=3] -[ext_resource path="res://assets/environment/background/background.png" type="Texture" id=4] -[ext_resource path="res://src/NeutralObjects/Coin.tscn" type="PackedScene" id=5] -[ext_resource path="res://src/UserInterface/Buttons/UserInterface.tscn" type="PackedScene" id=6] -[ext_resource path="res://src/UserInterface/Portal.tscn" type="PackedScene" id=7] -[ext_resource path="res://src/UserInterface/Screens/LevelEndScreen.tscn" type="PackedScene" id=8] -[ext_resource path="res://assets/meta/tileset.tres" type="TileSet" id=9] - -[sub_resource type="ConvexPolygonShape2D" id=1] -points = PoolVector2Array( 0, 0, 80, 0, 80, 80, 0, 80 ) - -[sub_resource type="TileSet" id=2] -0/name = "tileset.png 0" -0/texture = ExtResource( 2 ) -0/tex_offset = Vector2( 0, 0 ) -0/modulate = Color( 1, 1, 1, 1 ) -0/region = Rect2( 0, 0, 80, 80 ) -0/tile_mode = 0 -0/occluder_offset = Vector2( 0, 0 ) -0/navigation_offset = Vector2( 0, 0 ) -0/shape_offset = Vector2( 0, 0 ) -0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -0/shape = SubResource( 1 ) -0/shape_one_way = false -0/shape_one_way_margin = 1.0 -0/shapes = [ { -"autotile_coord": Vector2( 0, 0 ), -"one_way": false, -"one_way_margin": 1.0, -"shape": SubResource( 1 ), -"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) -} ] -0/z_index = 0 - -[sub_resource type="PackedScene" id=3] -_bundled = { -"conn_count": 0, -"conns": PoolIntArray( ), -"editable_instances": [ NodePath("Blobby"), NodePath("Coin") ], -"names": PoolStringArray( "Level03", "Node2D", "UserInterface", "CanvasLayer", "UserInterface", "BackgroundLayer", "CanvasLayer", "layer", "background", "TextureRect", "anchor_right", "anchor_bottom", "margin_right", "texture", "expand", "stretch_mode", "__meta__", "TileMap", "TileMap", "tile_set", "cell_size", "collision_layer", "collision_mask", "format", "tile_data", "Blobby", "position", "player", "position", "CollisionShape2D", "position", "Camera2D", "position", "limit_top", "limit_right", "limit_bottom", "drag_margin_h_enabled", "smoothing_enabled", "editor_draw_limits", "EnemyDetector", "position", "CollisionShape2D", "position", "Enemy", "position", "Coin", "position", "coin", "position", "CollisionShape2D", "position", "Coin2", "position", "Portal", "position", "next_scene" ), -"node_count": 18, -"node_paths": [ NodePath("."), NodePath("./UserInterface"), NodePath("."), NodePath("./BackgroundLayer"), NodePath("."), NodePath("."), NodePath("./Blobby"), NodePath("./Blobby"), NodePath("./Blobby"), NodePath("./Blobby"), NodePath("./Blobby/EnemyDetector"), NodePath("."), NodePath("."), NodePath("./Coin"), NodePath("./Coin"), NodePath("."), NodePath(".") ], -"nodes": PoolIntArray( -1, -1, 1, 0, -1, 0, 0, 1073741824, 0, 3, 2, -1, 0, 0, 1073741825, 0, 2147483647, 4, 0, 0, 0, 1073741826, 0, 6, 5, -1, 1, 7, 1, 0, 1073741827, 0, 9, 8, -1, 7, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 0, 1073741828, 0, 18, 17, -1, 6, 19, 9, 20, 10, 21, 11, 22, 12, 23, 13, 24, 14, 0, 1073741829, 0, 2147483647, 25, 15, 1, 26, 16, 0, 1073741830, -1, 2147483647, 262171, -1, 1, 28, 17, 0, 1073741831, -1, 2147483647, 524317, -1, 1, 30, 18, 0, 1073741832, -1, 2147483647, 786463, -1, 7, 32, 19, 33, 20, 34, 21, 35, 22, 36, 23, 37, 24, 38, 25, 0, 1073741833, -1, 2147483647, 1048615, -1, 1, 40, 26, 0, 1073741834, -1, 2147483647, 262185, -1, 1, 42, 27, 0, 1073741835, 0, 2147483647, 43, 28, 1, 44, 29, 0, 1073741836, 0, 2147483647, 45, 30, 1, 46, 31, 0, 1073741837, -1, 2147483647, 262191, -1, 1, 48, 32, 0, 1073741838, -1, 2147483647, 524337, -1, 1, 50, 33, 0, 1073741839, 0, 2147483647, 51, 34, 1, 52, 35, 0, 1073741840, 0, 2147483647, 53, 36, 2, 54, 37, 55, 38, 0 ), -"variants": [ ExtResource( 6 ), -1, 1.016, 1.0, -0.384033, ExtResource( 4 ), true, 1, { -"_edit_use_anchors_": false -}, ExtResource( 9 ), Vector2( 80, 80 ), 8, 0, 1, PoolIntArray( -1048576, 0, 0, -1048564, 0, 0, -983040, 0, 0, -983028, 0, 0, -917504, 0, 0, -917492, 0, 0, -851968, 0, 0, -851956, 0, 0, -786432, 0, 0, -786420, 0, 0, -720896, 0, 0, -720884, 0, 0, -655360, 0, 0, -655348, 0, 0, -589824, 0, 0, -589812, 0, 0, -524288, 0, 0, -524276, 0, 0, -458752, 0, 0, -458740, 0, 0, -393216, 0, 0, -393215, 0, 0, -393214, 0, 0, -393213, 0, 0, -393204, 0, 0, -327680, 0, 0, -327668, 0, 0, -262144, 0, 0, -262132, 0, 0, -196608, 0, 0, -196607, 0, 0, -196606, 0, 0, -196605, 0, 0, -196596, 0, 0, -131072, 0, 0, -131060, 0, 0, -65536, 0, 0, -65524, 0, 0, 0, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 12, 0, 0, 65536, 0, 0, 65544, 0, 0, 65548, 0, 0, 131072, 0, 0, 131084, 0, 0, 196608, 0, 0, 196620, 0, 0, 262144, 0, 0, 262149, 0, 0, 262154, 0, 0, 262155, 0, 0, 262156, 0, 0, 327680, 0, 0, 327681, 0, 0, 327692, 0, 0, 393216, 0, 0, 393228, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0 ), ExtResource( 1 ), Vector2( 131, 560 ), Vector2( 0, -32 ), Vector2( 0.224487, -32.0436 ), Vector2( 390.714, -75 ), -10000, 1040, 700, false, false, true, Vector2( 14.6832, -44.0497 ), Vector2( -15.3507, 14.3845 ), ExtResource( 3 ), Vector2( 715.5, 560 ), ExtResource( 5 ), Vector2( 592, 352 ), Vector2( 0, 3 ), Vector2( 0, 3 ), ExtResource( 5 ), Vector2( 749, 274 ), ExtResource( 7 ), Vector2( 130.332, -461.479 ), ExtResource( 8 ) ], -"version": 2 -} - -[node name="LevelTemplate" type="Node2D"] -__meta__ = { -"_edit_horizontal_guides_": [ 464.0 ], -"_edit_vertical_guides_": [ 2880.0 ] -} - -[node name="CanvasLayer" type="CanvasLayer" parent="."] -layer = -1 - -[node name="background" type="TextureRect" parent="CanvasLayer"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_bottom = 76.0 -texture = ExtResource( 4 ) -expand = true -stretch_mode = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="TileMap" type="TileMap" parent="."] -tile_set = SubResource( 2 ) -cell_size = Vector2( 80, 80 ) -collision_layer = 8 -collision_mask = 0 -format = 1 -tile_data = PoolIntArray( 0, 0, 0, 34, 0, 0, 35, 0, 0, 65536, 0, 0, 65570, 0, 0, 65571, 0, 0, 131072, 0, 0, 131106, 0, 0, 131107, 0, 0, 196608, 0, 0, 196613, 0, 0, 196614, 0, 0, 196619, 0, 0, 196620, 0, 0, 196623, 0, 0, 196627, 0, 0, 196628, 0, 0, 196629, 0, 0, 196634, 0, 0, 196635, 0, 0, 196636, 0, 0, 196642, 0, 0, 196643, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262177, 0, 0, 262178, 0, 0, 262179, 0, 0, 327680, 0, 0, 327712, 0, 0, 327713, 0, 0, 327714, 0, 0, 327715, 0, 0, 393216, 0, 0, 393247, 0, 0, 393248, 0, 0, 393249, 0, 0, 393250, 0, 0, 393251, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 458765, 0, 0, 458766, 0, 0, 458767, 0, 0, 458768, 0, 0, 458769, 0, 0, 458770, 0, 0, 458771, 0, 0, 458772, 0, 0, 458773, 0, 0, 458774, 0, 0, 458775, 0, 0, 458776, 0, 0, 458777, 0, 0, 458778, 0, 0, 458779, 0, 0, 458780, 0, 0, 458781, 0, 0, 458782, 0, 0, 458783, 0, 0, 458784, 0, 0, 458785, 0, 0, 458786, 0, 0, 458787, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 524307, 0, 0, 524308, 0, 0, 524309, 0, 0, 524310, 0, 0, 524311, 0, 0, 524312, 0, 0, 524313, 0, 0, 524314, 0, 0, 524315, 0, 0, 524316, 0, 0, 524317, 0, 0, 524318, 0, 0, 524319, 0, 0, 524320, 0, 0, 524321, 0, 0, 524322, 0, 0, 524323, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 589842, 0, 0, 589843, 0, 0, 589844, 0, 0, 589845, 0, 0, 589846, 0, 0, 589847, 0, 0, 589848, 0, 0, 589849, 0, 0, 589850, 0, 0, 589851, 0, 0, 589852, 0, 0, 589853, 0, 0, 589854, 0, 0, 589855, 0, 0, 589856, 0, 0, 589857, 0, 0, 589858, 0, 0, 589859, 0, 0 ) - -[node name="Blobby" parent="." instance=ExtResource( 1 )] -position = Vector2( 131, 560 ) - -[node name="Camera2D" parent="Blobby" index="2"] -limit_top = 100000000 -limit_right = 2826 -limit_bottom = 1410065408 - -[node name="CollisionShape2D" parent="Blobby/EnemyDetector" index="0"] -position = Vector2( 0.280624, -31.3723 ) - -[node name="Enemy" parent="." instance=ExtResource( 3 )] -position = Vector2( 2174, 560 ) - -[node name="Coin" parent="." instance=ExtResource( 5 )] -position = Vector2( 1161, 276 ) - -[node name="coin" parent="Coin" index="0"] -position = Vector2( 0, -2.76055 ) - -[node name="CollisionShape2D" parent="Coin" index="1"] -position = Vector2( 0, -2.83396 ) - -[node name="Coin2" parent="." instance=ExtResource( 5 )] -position = Vector2( 445, 199 ) - -[node name="Portal" parent="." instance=ExtResource( 7 )] -position = Vector2( 131, 339 ) -next_scene = SubResource( 3 ) - -[editable path="Blobby"] -[editable path="Coin"] diff --git a/src/Levels/Plattforms Level.tscn b/src/Levels/Plattforms Level.tscn index 9a30bd8..1cf5391 100644 --- a/src/Levels/Plattforms Level.tscn +++ b/src/Levels/Plattforms Level.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/environment/blocks/Basic stone block.png" type="Texture" id=2] [ext_resource path="res://src/Contraptions/Platform/Spring.tscn" type="PackedScene" id=3] [ext_resource path="res://src/Environment/Background.tscn" type="PackedScene" id=4] [ext_resource path="res://src/Contraptions/Platform/Track.tscn" type="PackedScene" id=5] -[ext_resource path="res://src/HarmfulObjects/Bullet.tscn" type="PackedScene" id=6] [ext_resource path="res://src/UserInterface/Buttons/UI.tscn" type="PackedScene" id=7] [ext_resource path="res://src/Actors/Enemies/Machines/Turret.tscn" type="PackedScene" id=8] @@ -63,7 +62,7 @@ cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) collision_layer = 8 collision_mask = 2147483648 format = 1 -tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 0, 17, 0, 0, 18, 0, 0, 19, 0, 0, 20, 0, 0, 21, 0, 0, 22, 0, 0, 23, 0, 0, 24, 0, 0, 25, 0, 0, 26, 0, 0, 27, 0, 0, 28, 0, 0, 29, 0, 0, 30, 0, 0, 31, 0, 0, 32, 0, 0, 33, 0, 0, 34, 0, 0, 35, 0, 0, 36, 0, 0, 37, 0, 0, 38, 0, 0, 39, 0, 0, 40, 0, 0, 41, 0, 0, 42, 0, 0, 43, 0, 0, 44, 0, 0, 45, 0, 0, 46, 0, 0, 47, 0, 0, 48, 0, 0, 49, 0, 0, 50, 0, 0, 51, 0, 0, 52, 0, 0, 53, 0, 0, 54, 0, 0, 55, 0, 0, 56, 0, 0, 57, 0, 0, 58, 0, 0, 59, 0, 0, 60, 0, 0, 65536, 0, 0, 65596, 0, 0, 131072, 0, 0, 131132, 0, 0, 196608, 0, 0, 196668, 0, 0, 262144, 0, 0, 262204, 0, 0, 327680, 0, 0, 327740, 0, 0, 393216, 0, 0, 393276, 0, 0, 458752, 0, 0, 458812, 0, 0, 524288, 0, 0, 524348, 0, 0, 589824, 0, 0, 589884, 0, 0, 655360, 0, 0, 655420, 0, 0, 720896, 0, 0, 720956, 0, 0, 786432, 0, 0, 786492, 0, 0, 851968, 0, 0, 852028, 0, 0, 917504, 0, 0, 917564, 0, 0, 983040, 0, 0, 983100, 0, 0, 1048576, 0, 0, 1048636, 0, 0, 1114112, 0, 0, 1114172, 0, 0, 1179648, 0, 0, 1179708, 0, 0, 1245184, 0, 0, 1245244, 0, 0, 1310720, 0, 0, 1310780, 0, 0, 1376256, 0, 0, 1376316, 0, 0, 1441792, 0, 0, 1441852, 0, 0, 1507328, 0, 0, 1507388, 0, 0, 1572864, 0, 0, 1572924, 0, 0, 1638400, 0, 0, 1638460, 0, 0, 1703936, 0, 0, 1703996, 0, 0, 1769472, 0, 0, 1769532, 0, 0, 1835008, 0, 0, 1835068, 0, 0, 1900544, 0, 0, 1900604, 0, 0, 1966080, 0, 0, 1966140, 0, 0, 2031616, 0, 0, 2031676, 0, 0, 2097152, 0, 0, 2097212, 0, 0, 2162688, 0, 0, 2162748, 0, 0, 2228224, 0, 0, 2228284, 0, 0, 2293760, 0, 0, 2293820, 0, 0, 2359296, 0, 0, 2359356, 0, 0, 2424832, 0, 0, 2424892, 0, 0, 2490368, 0, 0, 2490428, 0, 0, 2555904, 0, 0, 2555905, 0, 0, 2555906, 0, 0, 2555907, 0, 0, 2555908, 0, 0, 2555909, 0, 0, 2555910, 0, 0, 2555911, 0, 0, 2555912, 0, 0, 2555913, 0, 0, 2555914, 0, 0, 2555915, 0, 0, 2555916, 0, 0, 2555917, 0, 0, 2555918, 0, 0, 2555919, 0, 0, 2555920, 0, 0, 2555921, 0, 0, 2555922, 0, 0, 2555923, 0, 0, 2555924, 0, 0, 2555925, 0, 0, 2555926, 0, 0, 2555927, 0, 0, 2555928, 0, 0, 2555929, 0, 0, 2555930, 0, 0, 2555931, 0, 0, 2555932, 0, 0, 2555933, 0, 0, 2555934, 0, 0, 2555935, 0, 0, 2555936, 0, 0, 2555937, 0, 0, 2555938, 0, 0, 2555939, 0, 0, 2555940, 0, 0, 2555941, 0, 0, 2555942, 0, 0, 2555943, 0, 0, 2555944, 0, 0, 2555945, 0, 0, 2555946, 0, 0, 2555947, 0, 0, 2555948, 0, 0, 2555949, 0, 0, 2555950, 0, 0, 2555951, 0, 0, 2555952, 0, 0, 2555953, 0, 0, 2555954, 0, 0, 2555955, 0, 0, 2555956, 0, 0, 2555957, 0, 0, 2555958, 0, 0, 2555959, 0, 0, 2555960, 0, 0, 2555961, 0, 0, 2555962, 0, 0, 2555963, 0, 0, 2555964, 0, 0 ) +tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 0, 17, 0, 0, 18, 0, 0, 19, 0, 0, 20, 0, 0, 21, 0, 0, 22, 0, 0, 23, 0, 0, 24, 0, 0, 25, 0, 0, 26, 0, 0, 27, 0, 0, 28, 0, 0, 29, 0, 0, 30, 0, 0, 65536, 0, 0, 65566, 0, 0, 131072, 0, 0, 131102, 0, 0, 196608, 0, 0, 196638, 0, 0, 262144, 0, 0, 262174, 0, 0, 327680, 0, 0, 327710, 0, 0, 393216, 0, 0, 393246, 0, 0, 458752, 0, 0, 458782, 0, 0, 524288, 0, 0, 524318, 0, 0, 589824, 0, 0, 589854, 0, 0, 655360, 0, 0, 655390, 0, 0, 720896, 0, 0, 720926, 0, 0, 786432, 0, 0, 786462, 0, 0, 851968, 0, 0, 851998, 0, 0, 917504, 0, 0, 917534, 0, 0, 983040, 0, 0, 983070, 0, 0, 1048576, 0, 0, 1048606, 0, 0, 1114112, 0, 0, 1114142, 0, 0, 1179648, 0, 0, 1179678, 0, 0, 1245184, 0, 0, 1245214, 0, 0, 1310720, 0, 0, 1310750, 0, 0, 1376256, 0, 0, 1376286, 0, 0, 1441792, 0, 0, 1441822, 0, 0, 1507328, 0, 0, 1507358, 0, 0, 1572864, 0, 0, 1572894, 0, 0, 1638400, 0, 0, 1638430, 0, 0, 1703936, 0, 0, 1703966, 0, 0, 1769472, 0, 0, 1769502, 0, 0, 1835008, 0, 0, 1835038, 0, 0, 1900544, 0, 0, 1900574, 0, 0, 1966080, 0, 0, 1966110, 0, 0, 2031616, 0, 0, 2031646, 0, 0, 2097152, 0, 0, 2097182, 0, 0, 2162688, 0, 0, 2162718, 0, 0, 2228224, 0, 0, 2228254, 0, 0, 2293760, 0, 0, 2293790, 0, 0, 2359296, 0, 0, 2359326, 0, 0, 2424832, 0, 0, 2424862, 0, 0, 2490368, 0, 0, 2490398, 0, 0, 2555904, 0, 0, 2555905, 0, 0, 2555906, 0, 0, 2555907, 0, 0, 2555908, 0, 0, 2555909, 0, 0, 2555910, 0, 0, 2555911, 0, 0, 2555912, 0, 0, 2555913, 0, 0, 2555914, 0, 0, 2555915, 0, 0, 2555916, 0, 0, 2555917, 0, 0, 2555918, 0, 0, 2555919, 0, 0, 2555920, 0, 0, 2555921, 0, 0, 2555922, 0, 0, 2555923, 0, 0, 2555924, 0, 0, 2555925, 0, 0, 2555926, 0, 0, 2555927, 0, 0, 2555928, 0, 0, 2555929, 0, 0, 2555930, 0, 0, 2555931, 0, 0, 2555932, 0, 0, 2555933, 0, 0, 2555934, 0, 0 ) [node name="Blobby" parent="." instance=ExtResource( 1 )] position = Vector2( 50.7867, 604.063 ) @@ -79,11 +78,8 @@ scale = Vector2( 2.83999, 0.56 ) [node name="KinematicBody2D" parent="Track" index="0"] position = Vector2( 8, 0 ) -[node name="Bullet" parent="." instance=ExtResource( 6 )] -position = Vector2( 901, 579 ) - [node name="Turret" parent="." instance=ExtResource( 8 )] -position = Vector2( 958.501, 464 ) +position = Vector2( 479.52, 464 ) scale = Vector2( 0.5, 0.5 ) [editable path="Spring4"] diff --git a/src/Levels/StaticBody2D.gd b/src/Levels/StaticBody2D.gd deleted file mode 100644 index a693bd4..0000000 --- a/src/Levels/StaticBody2D.gd +++ /dev/null @@ -1,16 +0,0 @@ -extends StaticBody2D - - -# Declare member variables here. Examples: -# var a: int = 2 -# var b: String = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready() -> void: - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta: float) -> void: -# pass diff --git a/src/Levels/Tween.gd b/src/Levels/Tween.gd deleted file mode 100644 index 8c62465..0000000 --- a/src/Levels/Tween.gd +++ /dev/null @@ -1,16 +0,0 @@ -extends Tween - - -# Declare member variables here. Examples: -# var a: int = 2 -# var b: String = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready() -> void: - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta: float) -> void: -# pass