diff --git a/prototypes/game-shadows-of-surveillance/characters/bullet.tscn b/prototypes/game-shadows-of-surveillance/characters/bullet.tscn index 9ecf48c1..78a0bd88 100644 --- a/prototypes/game-shadows-of-surveillance/characters/bullet.tscn +++ b/prototypes/game-shadows-of-surveillance/characters/bullet.tscn @@ -15,6 +15,7 @@ texture = ExtResource("2_h6e5i") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(-2.5, 0) +scale = Vector2(0.278716, 0.27712) shape = SubResource("RectangleShape2D_cn71r") [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/prototypes/game-shadows-of-surveillance/characters/drone.tscn b/prototypes/game-shadows-of-surveillance/characters/drone.tscn index 10a6ecdf..ea91821c 100644 --- a/prototypes/game-shadows-of-surveillance/characters/drone.tscn +++ b/prototypes/game-shadows-of-surveillance/characters/drone.tscn @@ -11,7 +11,7 @@ [sub_resource type="CircleShape2D" id="CircleShape2D_kvhpb"] -[sub_resource type="Image" id="Image_7r4yi"] +[sub_resource type="Image" id="Image_0m4ch"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 233, 233, 233, 23, 224, 224, 224, 198, 225, 225, 225, 199, 224, 224, 224, 24, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 233, 233, 233, 23, 224, 224, 224, 213, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 215, 224, 224, 224, 24, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 103, 224, 224, 224, 255, 224, 224, 224, 212, 224, 224, 224, 209, 224, 224, 224, 255, 224, 224, 224, 107, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 103, 232, 232, 232, 22, 230, 230, 230, 20, 224, 224, 224, 105, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 233, 233, 233, 23, 225, 225, 225, 109, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 24, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 233, 233, 233, 23, 224, 224, 224, 213, 224, 224, 224, 255, 225, 225, 225, 108, 255, 255, 255, 0, 225, 225, 225, 76, 224, 224, 224, 229, 224, 224, 224, 228, 224, 224, 224, 74, 255, 255, 255, 0, 224, 224, 224, 105, 224, 224, 224, 255, 225, 225, 225, 215, 224, 224, 224, 24, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 197, 224, 224, 224, 255, 224, 224, 224, 211, 231, 231, 231, 21, 255, 255, 255, 0, 224, 224, 224, 229, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 228, 255, 255, 255, 0, 230, 230, 230, 20, 224, 224, 224, 208, 224, 224, 224, 255, 224, 224, 224, 201, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 195, 224, 224, 224, 255, 225, 225, 225, 215, 224, 224, 224, 24, 255, 255, 255, 0, 224, 224, 224, 228, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 227, 255, 255, 255, 0, 233, 233, 233, 23, 224, 224, 224, 213, 224, 224, 224, 255, 224, 224, 224, 198, 255, 255, 255, 0, 255, 255, 255, 0, 231, 231, 231, 21, 224, 224, 224, 210, 224, 224, 224, 255, 224, 224, 224, 107, 255, 255, 255, 0, 224, 224, 224, 74, 224, 224, 224, 228, 224, 224, 224, 227, 224, 224, 224, 72, 255, 255, 255, 0, 226, 226, 226, 103, 224, 224, 224, 255, 224, 224, 224, 212, 232, 232, 232, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 231, 231, 231, 21, 224, 224, 224, 105, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 103, 232, 232, 232, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 24, 232, 232, 232, 22, 225, 225, 225, 109, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 224, 224, 224, 255, 225, 225, 225, 215, 224, 224, 224, 211, 224, 224, 224, 255, 225, 225, 225, 108, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 231, 231, 231, 21, 224, 224, 224, 210, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 212, 232, 232, 232, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 231, 231, 231, 21, 224, 224, 224, 194, 224, 224, 224, 196, 232, 232, 232, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0), "format": "RGBA8", @@ -21,7 +21,7 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_1i6xe"] -image = SubResource("Image_7r4yi") +image = SubResource("Image_0m4ch") [sub_resource type="GDScript" id="GDScript_6kxwn"] script/source = "@tool @@ -113,7 +113,7 @@ deferred = false enabled = true trigger = "" -[sub_resource type="Image" id="Image_6rsyd"] +[sub_resource type="Image" id="Image_1u8y2"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 160, 230, 230, 230, 10, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 213, 225, 225, 225, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 76, 224, 224, 224, 189, 224, 224, 224, 238, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 245, 224, 224, 224, 96, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 245, 226, 226, 226, 95, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 77, 224, 224, 224, 255, 224, 224, 224, 253, 225, 225, 225, 117, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 212, 225, 225, 225, 42, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 129, 225, 225, 225, 68, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 189, 224, 224, 224, 255, 224, 224, 224, 113, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 159, 230, 230, 230, 10, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 73, 224, 224, 224, 255, 225, 225, 225, 183, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 242, 224, 224, 224, 255, 224, 224, 224, 24, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 25, 224, 224, 224, 255, 224, 224, 224, 237, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 243, 224, 224, 224, 254, 233, 233, 233, 23, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 29, 224, 224, 224, 255, 224, 224, 224, 236, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 188, 224, 224, 224, 255, 225, 225, 225, 68, 255, 255, 255, 0, 255, 255, 255, 0, 230, 230, 230, 10, 224, 224, 224, 160, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 120, 224, 224, 224, 255, 224, 224, 224, 181, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 71, 225, 225, 225, 126, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 43, 224, 224, 224, 213, 224, 224, 224, 255, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 34, 225, 225, 225, 124, 224, 224, 224, 254, 224, 224, 224, 255, 226, 226, 226, 70, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 96, 224, 224, 224, 245, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 125, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 226, 226, 226, 95, 224, 224, 224, 245, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 237, 224, 224, 224, 185, 227, 227, 227, 71, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 225, 225, 225, 42, 224, 224, 224, 213, 224, 224, 224, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 230, 230, 230, 10, 225, 225, 225, 159, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0), "format": "RGBA8", @@ -123,7 +123,7 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_r1157"] -image = SubResource("Image_6rsyd") +image = SubResource("Image_1u8y2") [node name="Enemy" type="CharacterBody2D" groups=["enemy"]] position = Vector2(870, 309) diff --git a/prototypes/game-shadows-of-surveillance/characters/droneBullet.gd b/prototypes/game-shadows-of-surveillance/characters/droneBullet.gd new file mode 100644 index 00000000..a4b31963 --- /dev/null +++ b/prototypes/game-shadows-of-surveillance/characters/droneBullet.gd @@ -0,0 +1,23 @@ +extends Area2D +var speed = 501 +var dir +var muzzle + +# Called when the node enters the scene tree for the first time. +func _ready(): + self.global_position = muzzle + global_rotation = dir.angle() + +func setup(direction, muzzlePos): + dir = direction + muzzle = muzzlePos + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + position += dir * speed * delta + +func _on_body_entered(body): + if body.is_in_group("player"): + body.queue_free() + if !body.is_in_group("enemy"): + queue_free() diff --git a/prototypes/game-shadows-of-surveillance/characters/player1.tscn b/prototypes/game-shadows-of-surveillance/characters/player1.tscn index 24b652a1..835d9b09 100644 --- a/prototypes/game-shadows-of-surveillance/characters/player1.tscn +++ b/prototypes/game-shadows-of-surveillance/characters/player1.tscn @@ -3,11 +3,10 @@ [ext_resource type="Texture2D" uid="uid://cfemjjj52u7tw" path="res://prototypes/game-shadows-of-surveillance/characters/Virtual Guy/Idle (32x32).png" id="1_am0mg"] [ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/characters/PlatfomerControllerPlayer1.gd" id="2_opehh"] -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_h8f81"] -radius = 12.1039 -height = 137.594 +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7aa12"] +size = Vector2(17.84, 19.8482) -[node name="Player1" type="CharacterBody2D"] +[node name="Player1" type="CharacterBody2D" groups=["player"]] [node name="DavidPlayer1" type="Sprite2D" parent="."] position = Vector2(0, 4.76837e-07) @@ -16,9 +15,9 @@ texture = ExtResource("1_am0mg") hframes = 11 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(0, 4) -scale = Vector2(0.912592, 0.18803) -shape = SubResource("CapsuleShape2D_h8f81") +position = Vector2(-5.96046e-07, 4.10018) +scale = Vector2(1.23053, 1.34308) +shape = SubResource("RectangleShape2D_7aa12") [node name="PlatformerControllerPlayer1" type="Node2D" parent="."] position = Vector2(576, 324) diff --git a/prototypes/game-shadows-of-surveillance/characters/player2.tscn b/prototypes/game-shadows-of-surveillance/characters/player2.tscn index 255755f7..bac442ae 100644 --- a/prototypes/game-shadows-of-surveillance/characters/player2.tscn +++ b/prototypes/game-shadows-of-surveillance/characters/player2.tscn @@ -1,15 +1,16 @@ -[gd_scene load_steps=5 format=3 uid="uid://dxp4mlvvs0g2"] +[gd_scene load_steps=6 format=3 uid="uid://dxp4mlvvs0g2"] +[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/scripts/player2.gd" id="1_dxuki"] [ext_resource type="Texture2D" uid="uid://dx884i5e2o8ql" path="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Idle (32x32).png" id="2_3wlyp"] [ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/characters/PlatformerControllerPlayer2.gd" id="3_kwpqc"] [ext_resource type="Texture2D" uid="uid://ch6w3mr4w7ueu" path="res://LightSprite.png" id="4_u5jrv"] -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_7cbuj"] -height = 248.062 +[sub_resource type="RectangleShape2D" id="RectangleShape2D_csvif"] [node name="Player2" type="CharacterBody2D" groups=["player"]] scale = Vector2(0.258, 0.258) collision_layer = 3 +script = ExtResource("1_dxuki") [node name="OlePlayer2" type="Sprite2D" parent="."] scale = Vector2(1, 1.10562) @@ -19,8 +20,8 @@ frame = 10 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, 3.87597) -scale = Vector2(1, 0.11) -shape = SubResource("CapsuleShape2D_7cbuj") +scale = Vector2(1.12791, 1.45493) +shape = SubResource("RectangleShape2D_csvif") [node name="Marker2D" type="Marker2D" parent="."] diff --git a/prototypes/game-shadows-of-surveillance/levels/level.tscn b/prototypes/game-shadows-of-surveillance/levels/level.tscn index d1e87f66..178b7e1d 100644 --- a/prototypes/game-shadows-of-surveillance/levels/level.tscn +++ b/prototypes/game-shadows-of-surveillance/levels/level.tscn @@ -28,7 +28,7 @@ color = Color(1, 1, 0.0313726, 1) sprite_texture = ExtResource("4_rqfal") placeholder_size = Vector2(20, 20) -[node name="Player1" parent="." groups=["player"] instance=ExtResource("3_x2hlg")] +[node name="Player1" parent="." instance=ExtResource("3_x2hlg")] position = Vector2(101, 565) scale = Vector2(1.5, 1.5) collision_layer = 3 diff --git a/prototypes/game-shadows-of-surveillance/levels/level2.tscn b/prototypes/game-shadows-of-surveillance/levels/level2.tscn index 463b62a8..60e40d2d 100644 --- a/prototypes/game-shadows-of-surveillance/levels/level2.tscn +++ b/prototypes/game-shadows-of-surveillance/levels/level2.tscn @@ -14,6 +14,7 @@ scale = Vector2(3.5, 3.5) texture = ExtResource("1_j6sv0") [node name="CanvasModulate" type="CanvasModulate" parent="6" groups=["dark"]] +visible = false color = Color(0, 0, 0, 1) [node name="TileMap" parent="." instance=ExtResource("2_llo4g")] @@ -26,3 +27,6 @@ position = Vector2(932, -32) [node name="Player2" parent="." instance=ExtResource("5_a7n2h")] position = Vector2(294, 440) scale = Vector2(1.5, 1.5) + +[node name="drone" parent="." instance=ExtResource("4_m1bym")] +position = Vector2(236, -6) diff --git a/prototypes/game-shadows-of-surveillance/levels/thumbnail.png b/prototypes/game-shadows-of-surveillance/levels/thumbnail.png index bb852c80..f96e9840 100644 Binary files a/prototypes/game-shadows-of-surveillance/levels/thumbnail.png and b/prototypes/game-shadows-of-surveillance/levels/thumbnail.png differ diff --git a/prototypes/game-shadows-of-surveillance/scripts/drone.gd b/prototypes/game-shadows-of-surveillance/scripts/drone.gd index f2740ffe..701193d1 100644 --- a/prototypes/game-shadows-of-surveillance/scripts/drone.gd +++ b/prototypes/game-shadows-of-surveillance/scripts/drone.gd @@ -3,18 +3,20 @@ extends CharacterBody2D const SPEED = 300.0 const JUMP_VELOCITY = -400.0 -const shootingCooldown = 3 +const shootingCooldown = 2 const bullet_scene = preload("res://prototypes/game-shadows-of-surveillance/characters/droneBullet.tscn") # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") var player var shootingTimer = 0 +var minimalHeightDiff = 100 func _ready(): - player = get_parent().get_node("Player1") - print(player) - + pass + func _physics_process(delta): + player = get_parent().get_node("Player2") + # Add the gravity. if not is_on_floor(): velocity.y += gravity * delta @@ -25,24 +27,33 @@ func _physics_process(delta): # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. - var direction = Input.get_axis("ui_left", "ui_right") - if direction: - velocity.x = direction * SPEED - else: - velocity.x = move_toward(velocity.x, 0, SPEED) - + + if player: + var heightDifference = player.position.y - position.y + print(heightDifference) + if heightDifference < minimalHeightDiff: + velocity.y = -130 + minimalHeightDiff = 200 + else: + minimalHeightDiff = 100 + var direction = Input.get_axis("ui_left", "ui_right") + if direction: + velocity.x = direction * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + if player: -l var distanceToPlayer = position.distance_to(player.position) - print(distanceToPlayer) - if distanceToPlayer > 200: + var distanceToPlayer = position.distance_to(player.position) + if distanceToPlayer > 200: shootingTimer += delta if shootingTimer > shootingCooldown: shoot() shootingTimer = 0 + print("shoot") move_and_slide() func shoot(): var b = bullet_scene.instantiate() - var direction = (get_global_mouse_position() - global_position).normalized() + var direction = (player.global_position - global_position).normalized() b.setup(direction, $Marker2D.global_position) owner.add_child(b) diff --git a/prototypes/game-shadows-of-surveillance/scripts/player2.gd b/prototypes/game-shadows-of-surveillance/scripts/player2.gd index 8303e600..6f27e786 100644 --- a/prototypes/game-shadows-of-surveillance/scripts/player2.gd +++ b/prototypes/game-shadows-of-surveillance/scripts/player2.gd @@ -1,7 +1,7 @@ extends CharacterBody2D const bullet_scene = preload("res://prototypes/game-shadows-of-surveillance/characters/bullet.tscn") -const SPEED = 300.0 +const SPEED = 200.0 const JUMP_VELOCITY = -400.0 # Get the gravity from the project settings to be synced with RigidBody nodes.