Skip to content

Commit

Permalink
added respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey Sivachinski authored and Matvey Sivachinski committed Feb 5, 2024
2 parents 0a1d7be + 108cb3a commit 8b70f22
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 19 deletions.
13 changes: 9 additions & 4 deletions addons/pronto/behaviors/CollisionBehavior.gd
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,22 @@ func _get_configuration_warnings():
return ["Collision only works with Area2D, RigidBody2D and CharacterBody2D"]
return ""


func toggleVisibility(node):
if node.visible:
node.hide()
else:
node.show()

func _on_area_2d_body_entered(body):
var dark = get_tree().get_nodes_in_group("dark")
print("dark:", dark)
if dark:
var canvasModulate = dark[0]
canvasModulate.hide()
toggleVisibility(dark[0])

var light = get_tree().get_nodes_in_group("light")
if light:
var flashlight = light[0]
flashlight.hide()
toggleVisibility(light[0])

#var canvasModulate = dark.get_node("CanvasModulate")
#var canvasModulate = get_parent().get_parent().find_child("CanvasModulate")
Expand Down
16 changes: 16 additions & 0 deletions prototypes/game-shadows-of-surveillance/characters/drone.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

[sub_resource type="CircleShape2D" id="CircleShape2D_kvhpb"]

<<<<<<< HEAD
[sub_resource type="Image" id="Image_e2286"]
=======
[sub_resource type="Image" id="Image_laljb"]
>>>>>>> origin/game-shadows-of-surveillance
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",
Expand All @@ -21,7 +25,11 @@ data = {
}

[sub_resource type="ImageTexture" id="ImageTexture_1i6xe"]
<<<<<<< HEAD
image = SubResource("Image_e2286")
=======
image = SubResource("Image_laljb")
>>>>>>> origin/game-shadows-of-surveillance

[sub_resource type="GDScript" id="GDScript_6kxwn"]
script/source = "@tool
Expand Down Expand Up @@ -113,7 +121,11 @@ deferred = false
enabled = true
trigger = ""
<<<<<<< HEAD
[sub_resource type="Image" id="Image_6lp4v"]
=======
[sub_resource type="Image" id="Image_4gc6h"]
>>>>>>> origin/game-shadows-of-surveillance
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",
Expand All @@ -123,7 +135,11 @@ data = {
}
[sub_resource type="ImageTexture" id="ImageTexture_r1157"]
<<<<<<< HEAD
image = SubResource("Image_6lp4v")
=======
image = SubResource("Image_4gc6h")
>>>>>>> origin/game-shadows-of-surveillance
[node name="Enemy" type="CharacterBody2D" groups=["enemy"]]
position = Vector2(870, 309)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ func _process(delta):
position += dir * speed * delta

func _on_body_entered(body):
var playerHealth = get_parent().get_node("Player2").get_node("HealthBarBehavior")
if body.is_in_group("player"):
<<<<<<< HEAD
body.queue_free()
get_tree().change_scene_to_file("res://Restart.tscn")
=======
if playerHealth:
playerHealth.damage(20)
>>>>>>> origin/game-shadows-of-surveillance
if !body.is_in_group("enemy"):
queue_free()
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://ci42negqibb6p"]

[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/characters/droneBullet.gd" id="1_u7oaw"]
[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/characters/droneBullet.gd" id="1_rjykv"]
[ext_resource type="Texture2D" uid="uid://cooutieukq5fx" path="res://prototypes/game-shadows-of-surveillance/assets/laserRed01.png" id="2_uy31x"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_cn71r"]
size = Vector2(57, 10)

[node name="Bullet" type="Area2D"]
[node name="Dronebullet" type="Area2D"]
collision_layer = 2
collision_mask = 2
script = ExtResource("1_u7oaw")
script = ExtResource("1_rjykv")

[node name="Sprite2D" type="Sprite2D" parent="."]
rotation = 1.5708
Expand Down
43 changes: 41 additions & 2 deletions prototypes/game-shadows-of-surveillance/characters/player2.tscn
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
[gd_scene load_steps=6 format=3 uid="uid://dxp4mlvvs0g2"]
[gd_scene load_steps=13 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"]
[ext_resource type="Texture2D" uid="uid://ca3jyudumrgbl" path="res://LightSprite.png" id="4_u5jrv"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/HealthBarBehavior.gd" id="5_oymb4"]
[ext_resource type="Script" path="res://addons/pronto/helpers/ConnectionScript.gd" id="6_82em1"]
[ext_resource type="Script" path="res://addons/pronto/helpers/Connection.gd" id="7_dkbr3"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_csvif"]

[sub_resource type="Gradient" id="Gradient_53jmr"]
offsets = PackedFloat32Array(0, 0.5, 1)
colors = PackedColorArray(1, 0, 0, 1, 1, 1, 0, 1, 0.196078, 0.803922, 0.196078, 1)

[sub_resource type="GDScript" id="GDScript_1v478"]
script/source = "@tool
extends U
@warning_ignore(\"unused_parameter\")
func run(from: Node2D, to: CharacterBody2D):
return true
"
[sub_resource type="Resource" id="Resource_v6c5t"]
script = ExtResource("6_82em1")
nested_script = SubResource("GDScript_1v478")
argument_names = ["from", "to"]
return_value = true
[sub_resource type="Resource" id="Resource_xvx8k"]
script = ExtResource("7_dkbr3")
signal_name = "death"
to = NodePath("..")
more_references = []
invoke = "die"
arguments = []
only_if = SubResource("Resource_v6c5t")
deferred = false
enabled = true
trigger = ""
[node name="Player2" type="CharacterBody2D" groups=["player"]]
scale = Vector2(0.258, 0.258)
collision_layer = 3
Expand All @@ -32,3 +65,9 @@ texture = ExtResource("4_u5jrv")
[node name="PlatformerControllerBehavior2" type="Node2D" parent="."]
position = Vector2(576, 324)
script = ExtResource("3_kwpqc")
[node name="HealthBarBehavior" type="Node2D" parent="."]
position = Vector2(0, -11.6279)
script = ExtResource("5_oymb4")
progress_gradient = SubResource("Gradient_53jmr")
metadata/pronto_connections = [SubResource("Resource_xvx8k")]
6 changes: 2 additions & 4 deletions prototypes/game-shadows-of-surveillance/levels/level2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/levels/level2.gd" id="1_eq0v8"]
[ext_resource type="Texture2D" uid="uid://ej3g6agmjf0x" path="res://prototypes/game-shadows-of-surveillance/assets/6.png" id="1_j6sv0"]
[ext_resource type="PackedScene" uid="uid://4j52c4ucysq5" path="res://Tilemap.tscn" id="2_llo4g"]
[ext_resource type="PackedScene" path="res://Tilemap.tscn" id="2_llo4g"]
[ext_resource type="TileSet" uid="uid://dp12gfueqor5q" path="res://tileset.tres" id="3_ko4tt"]
[ext_resource type="PackedScene" uid="uid://ds24wbrnr7tta" path="res://prototypes/game-shadows-of-surveillance/characters/drone.tscn" id="4_m1bym"]
[ext_resource type="PackedScene" uid="uid://dxp4mlvvs0g2" path="res://prototypes/game-shadows-of-surveillance/characters/player2.tscn" id="5_a7n2h"]
Expand All @@ -15,19 +15,17 @@ position = Vector2(578, 319)
scale = Vector2(3.5, 3.5)
texture = ExtResource("1_j6sv0")

[node name="CanvasModulate" type="CanvasModulate" parent="6" groups=["dark"]]
[node name="Background_2" type="Sprite2D" parent="Background"]
position = Vector2(576, 0)
scale = Vector2(1, 1)
texture = ExtResource("1_j6sv0")

[node name="Background_3" type="Sprite2D" parent="Background"]
position = Vector2(1152, 0)
scale = Vector2(1, 1)
texture = ExtResource("1_j6sv0")

[node name="Background_4" type="Sprite2D" parent="Background/Background_3"]
position = Vector2(575.714, 2.27374e-12)
scale = Vector2(1, 1)
texture = ExtResource("1_j6sv0")

[node name="CanvasModulate" type="CanvasModulate" parent="Background" groups=["dark"]]
Expand Down
5 changes: 4 additions & 1 deletion prototypes/game-shadows-of-surveillance/scripts/drone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta

# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
Expand All @@ -30,6 +29,10 @@ func _physics_process(delta):

if player:
var heightDifference = player.position.y - position.y
<<<<<<< HEAD
=======
#print(heightDifference)
>>>>>>> origin/game-shadows-of-surveillance
if heightDifference < minimalHeightDiff:
velocity.y = -130
minimalHeightDiff = 200
Expand Down
11 changes: 6 additions & 5 deletions prototypes/game-shadows-of-surveillance/scripts/player2.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
extends CharacterBody2D

const bullet_scene = preload("res://prototypes/game-shadows-of-surveillance/characters/bullet.tscn")
const SPEED = 200.0
const JUMP_VELOCITY = -400.0

var timeCapsule = false
const bullet_scene = preload("res://prototypes/game-shadows-of-surveillance/characters/bullet.tscn")
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")


func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
Expand All @@ -28,10 +27,12 @@ func _physics_process(delta):

move_and_slide()

if Input.is_action_just_pressed("shoot"):
if Input.is_action_just_pressed("shoot") and timeCapsule:
shoot()

func die():
queue_free()


func shoot():
var b = bullet_scene.instantiate()
var direction = (get_global_mouse_position() - global_position).normalized()
Expand Down

0 comments on commit 8b70f22

Please sign in to comment.