diff --git a/growth/Card/BaseCard.gd b/growth/BaseCard/BaseCard.gd similarity index 100% rename from growth/Card/BaseCard.gd rename to growth/BaseCard/BaseCard.gd diff --git a/growth/Card/BaseCard.gd.uid b/growth/BaseCard/BaseCard.gd.uid similarity index 100% rename from growth/Card/BaseCard.gd.uid rename to growth/BaseCard/BaseCard.gd.uid diff --git a/growth/Card/BaseCard.tscn b/growth/BaseCard/BaseCard.tscn similarity index 87% rename from growth/Card/BaseCard.tscn rename to growth/BaseCard/BaseCard.tscn index 6468328..77ef18d 100644 --- a/growth/Card/BaseCard.tscn +++ b/growth/BaseCard/BaseCard.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://b0g5wd4n3py3x"] -[ext_resource type="Script" uid="uid://c4x7n1r3ce1bc" path="res://Card/BaseCard.gd" id="1_hoajl"] +[ext_resource type="Script" uid="uid://c4x7n1r3ce1bc" path="res://BaseCard/BaseCard.gd" id="1_hoajl"] [node name="Card" type="PanelContainer"] offset_right = 1.0 diff --git a/growth/CardInjects/CursorGunCardInject.tscn b/growth/CardInjects/CursorGun/CursorGunCardInject.tscn similarity index 75% rename from growth/CardInjects/CursorGunCardInject.tscn rename to growth/CardInjects/CursorGun/CursorGunCardInject.tscn index 303efce..3673a61 100644 --- a/growth/CardInjects/CursorGunCardInject.tscn +++ b/growth/CardInjects/CursorGun/CursorGunCardInject.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://bf1241le7dwfs"] -[ext_resource type="Script" uid="uid://c0jwjfs64x5tm" path="res://CardInjects/cursor_gun_card_inject.gd" id="1_25dn0"] +[ext_resource type="Script" uid="uid://c0jwjfs64x5tm" path="res://CardInjects/CursorGun/cursor_gun_card_inject.gd" id="1_25dn0"] [node name="CursorGunCardInject" type="Node"] script = ExtResource("1_25dn0") diff --git a/growth/cursor_bullet.gd b/growth/CardInjects/CursorGun/cursor_bullet.gd similarity index 51% rename from growth/cursor_bullet.gd rename to growth/CardInjects/CursorGun/cursor_bullet.gd index 1a5d869..cb2a54f 100644 --- a/growth/cursor_bullet.gd +++ b/growth/CardInjects/CursorGun/cursor_bullet.gd @@ -2,10 +2,16 @@ extends Area2D @export var speed = 70 + func _physics_process(delta): - self.position += speed * delta + var direction = Vector2.RIGHT.rotated(self.rotation) + self.position += direction * speed * delta func _on_body_entered(body): if body.is_in_group("mobs"): body.take_hit() + self.queue_free() + + +func _on_timer_timeout() -> void: self.queue_free() diff --git a/growth/cursor_bullet.gd.uid b/growth/CardInjects/CursorGun/cursor_bullet.gd.uid similarity index 100% rename from growth/cursor_bullet.gd.uid rename to growth/CardInjects/CursorGun/cursor_bullet.gd.uid diff --git a/growth/cursor_bullet.tscn b/growth/CardInjects/CursorGun/cursor_bullet.tscn similarity index 75% rename from growth/cursor_bullet.tscn rename to growth/CardInjects/CursorGun/cursor_bullet.tscn index 0e2bf11..6848b54 100644 --- a/growth/cursor_bullet.tscn +++ b/growth/CardInjects/CursorGun/cursor_bullet.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://2fmcxd2b8ff3"] [ext_resource type="Texture2D" uid="uid://dg6dkalarcq2w" path="res://assets/Cursor_projectile_symbol.png" id="1_g08wh"] -[ext_resource type="Script" uid="uid://bmms1edsh26dp" path="res://cursor_bullet.gd" id="1_ln2dr"] +[ext_resource type="Script" uid="uid://bmms1edsh26dp" path="res://CardInjects/CursorGun/cursor_bullet.gd" id="1_ln2dr"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_g08wh"] size = Vector2(226, 168) @@ -16,4 +16,10 @@ texture = ExtResource("1_g08wh") position = Vector2(-11, -2) shape = SubResource("RectangleShape2D_g08wh") +[node name="Timer" type="Timer" parent="."] +wait_time = 5.0 +one_shot = true +autostart = true + [connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/growth/CardInjects/cursor_gun_card_inject.gd b/growth/CardInjects/CursorGun/cursor_gun_card_inject.gd similarity index 50% rename from growth/CardInjects/cursor_gun_card_inject.gd rename to growth/CardInjects/CursorGun/cursor_gun_card_inject.gd index fc99a0a..d20f6d5 100644 --- a/growth/CardInjects/cursor_gun_card_inject.gd +++ b/growth/CardInjects/CursorGun/cursor_gun_card_inject.gd @@ -1,6 +1,6 @@ extends Node -@export var CursorBullet: PackedScene +@export var CursorBullet: PackedScene = preload("res://CardInjects/CursorGun/cursor_bullet.tscn") @export var max_ammo = 10 var ammo = 10 @@ -10,12 +10,12 @@ func activate(world, activator): world.add_child(bullet) bullet.position = activator.position bullet.look_at(target) - if activator.get_collision_layer_bit(1): # player object - bullet.set_collision_layer_bit(1, false) - bullet.set_collision_layer_bit(2, true) - elif activator.get_collision_layer_bit(2): # enemy object - bullet.set_collision_layer_bit(1, true) - bullet.set_collision_layer_bit(2, false) + if activator.get_collision_layer_value(1): # player object + bullet.set_collision_layer_value (1, false) + bullet.set_collision_layer_value(2, true) + elif activator.get_collision_layer_value(2): # enemy object + bullet.set_collision_layer_value(1, true) + bullet.set_collision_layer_value(2, false) else: assert(false, "who are you, activator?") ammo -= 1 diff --git a/growth/CardInjects/cursor_gun_card_inject.gd.uid b/growth/CardInjects/CursorGun/cursor_gun_card_inject.gd.uid similarity index 100% rename from growth/CardInjects/cursor_gun_card_inject.gd.uid rename to growth/CardInjects/CursorGun/cursor_gun_card_inject.gd.uid diff --git a/growth/CardInjects/Firewall/FirewallCardInject.tscn b/growth/CardInjects/Firewall/FirewallCardInject.tscn new file mode 100644 index 0000000..45caa5e --- /dev/null +++ b/growth/CardInjects/Firewall/FirewallCardInject.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=3 format=3 uid="uid://otxia3v8iw07"] + +[ext_resource type="Script" uid="uid://dpyarqogod6d3" path="res://CardInjects/Firewall/firewall_card_inject.gd" id="1_fd08f"] +[ext_resource type="PackedScene" uid="uid://33rplipuwv2k" path="res://CardInjects/Firewall/firewall.tscn" id="2_sbju6"] + +[node name="FirewallCardInject" type="Node"] +script = ExtResource("1_fd08f") +FireWall = ExtResource("2_sbju6") diff --git a/growth/firewall.gd b/growth/CardInjects/Firewall/firewall.gd similarity index 100% rename from growth/firewall.gd rename to growth/CardInjects/Firewall/firewall.gd diff --git a/growth/firewall.gd.uid b/growth/CardInjects/Firewall/firewall.gd.uid similarity index 100% rename from growth/firewall.gd.uid rename to growth/CardInjects/Firewall/firewall.gd.uid diff --git a/growth/firewall.tscn b/growth/CardInjects/Firewall/firewall.tscn similarity index 87% rename from growth/firewall.tscn rename to growth/CardInjects/Firewall/firewall.tscn index a626fda..9ad7711 100644 --- a/growth/firewall.tscn +++ b/growth/CardInjects/Firewall/firewall.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=2 format=3 uid="uid://33rplipuwv2k"] -[ext_resource type="Script" uid="uid://bmt6oqrixatxt" path="res://firewall.gd" id="1_qwxdp"] +[ext_resource type="Script" uid="uid://bmt6oqrixatxt" path="res://CardInjects/Firewall/firewall.gd" id="1_qwxdp"] -[node name="Firewall" type="Node"] +[node name="Firewall" type="Node2D"] script = ExtResource("1_qwxdp") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] diff --git a/growth/CardInjects/firewall_card_inject.gd b/growth/CardInjects/Firewall/firewall_card_inject.gd similarity index 53% rename from growth/CardInjects/firewall_card_inject.gd rename to growth/CardInjects/Firewall/firewall_card_inject.gd index f0a869b..9ecfdfd 100644 --- a/growth/CardInjects/firewall_card_inject.gd +++ b/growth/CardInjects/Firewall/firewall_card_inject.gd @@ -10,14 +10,15 @@ func activate(world, activator): firewall.position = activator.position firewall.position += firewall.position.direction_to(target) \ * clamp(firewall.position.distance_to(target), min_range, max_range) - if activator.get_collision_layer_bit(1): # player object - firewall.set_collision_layer_bit(1, false) - firewall.set_collision_layer_bit(2, true) - elif activator.get_collision_layer_bit(2): # enemy object - firewall.set_collision_layer_bit(1, true) - firewall.set_collision_layer_bit(2, false) + if activator.get_collision_layer_value(1): # player object + firewall.get_node("Area2D").set_collision_layer_value(1, false) + firewall.get_node("Area2D").set_collision_layer_value(2, true) + elif activator.get_collision_layer_value(2): # enemy object + firewall.get_node("Area2D").set_collision_layer_value(1, true) + firewall.get_node("Area2D").set_collision_layer_value(2, false) else: assert(false, "who are you, activator?") + world.add_child(firewall) func discard(world, activator): diff --git a/growth/CardInjects/firewall_card_inject.gd.uid b/growth/CardInjects/Firewall/firewall_card_inject.gd.uid similarity index 100% rename from growth/CardInjects/firewall_card_inject.gd.uid rename to growth/CardInjects/Firewall/firewall_card_inject.gd.uid diff --git a/growth/CardInjects/FirewallCardInject.tscn b/growth/CardInjects/FirewallCardInject.tscn deleted file mode 100644 index b5876ee..0000000 --- a/growth/CardInjects/FirewallCardInject.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://otxia3v8iw07"] - -[ext_resource type="Script" uid="uid://dpyarqogod6d3" path="res://CardInjects/firewall_card_inject.gd" id="1_fd08f"] - -[node name="FirewallCardInject" type="Node"] -script = ExtResource("1_fd08f") diff --git a/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.gd b/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.gd new file mode 100644 index 0000000..59e0963 --- /dev/null +++ b/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.gd @@ -0,0 +1,21 @@ +extends Node + +@export var RocketProjectile: PackedScene + +func activate(world, activator): + var rocket = RocketProjectile.instantiate() + var target = activator.get_target_pos() + rocket.position = activator.position + rocket.look_at(target) + if activator.get_collision_layer_value(1): # player object + rocket.get_node("Area2D").set_collision_layer_value(1, false) + rocket.get_node("Area2D").set_collision_layer_value(2, true) + elif activator.get_collision_layer_value(2): # enemy object + rocket.get_node("Area2D").set_collision_layer_value(1, true) + rocket.get_node("Area2D").set_collision_layer_value(2, false) + else: + assert(false, "who are you, activator?") + world.add_child(rocket) + +func discard(world, activator): + pass diff --git a/growth/CardInjects/rocket_launcher_card_inject.gd.uid b/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.gd.uid similarity index 100% rename from growth/CardInjects/rocket_launcher_card_inject.gd.uid rename to growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.gd.uid diff --git a/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.tscn b/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.tscn new file mode 100644 index 0000000..3812835 --- /dev/null +++ b/growth/CardInjects/RocketLauncher/rocket_launcher_card_inject.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=3 format=3 uid="uid://cquq44uspy17w"] + +[ext_resource type="Script" uid="uid://bijee1o0qyiis" path="res://CardInjects/RocketLauncher/rocket_launcher_card_inject.gd" id="1_fa8xn"] +[ext_resource type="PackedScene" uid="uid://csqaw6y03bohh" path="res://CardInjects/RocketLauncher/rocket_projectile.tscn" id="2_g05lu"] + +[node name="RocketLauncherCardInject" type="Node"] +script = ExtResource("1_fa8xn") +RocketProjectile = ExtResource("2_g05lu") diff --git a/growth/rocket_projectile.gd b/growth/CardInjects/RocketLauncher/rocket_projectile.gd similarity index 100% rename from growth/rocket_projectile.gd rename to growth/CardInjects/RocketLauncher/rocket_projectile.gd diff --git a/growth/rocket_projectile.gd.uid b/growth/CardInjects/RocketLauncher/rocket_projectile.gd.uid similarity index 100% rename from growth/rocket_projectile.gd.uid rename to growth/CardInjects/RocketLauncher/rocket_projectile.gd.uid diff --git a/growth/rocket_projectile.tscn b/growth/CardInjects/RocketLauncher/rocket_projectile.tscn similarity index 94% rename from growth/rocket_projectile.tscn rename to growth/CardInjects/RocketLauncher/rocket_projectile.tscn index 8e5cf4f..f4fa04f 100644 --- a/growth/rocket_projectile.tscn +++ b/growth/CardInjects/RocketLauncher/rocket_projectile.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://csqaw6y03bohh"] -[ext_resource type="Script" uid="uid://2gkeyxrjxt1b" path="res://rocket_projectile.gd" id="1_7grw8"] +[ext_resource type="Script" uid="uid://2gkeyxrjxt1b" path="res://CardInjects/RocketLauncher/rocket_projectile.gd" id="1_7grw8"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_7grw8"] particle_flag_disable_z = true diff --git a/growth/CardInjects/rocket_launcher_card_inject.gd b/growth/CardInjects/rocket_launcher_card_inject.gd deleted file mode 100644 index 7705afd..0000000 --- a/growth/CardInjects/rocket_launcher_card_inject.gd +++ /dev/null @@ -1,21 +0,0 @@ -extends Node - -@export var RocketProjectile: PackedScene - -func activate(world, activator): - var rocket = RocketProjectile.instantiate() - var target = activator.get_target_pos() - rocket.position = activator.position - rocket.look_at(target) - if activator.get_collision_layer_bit(1): # player object - rocket.set_collision_layer_bit(1, false) - rocket.set_collision_layer_bit(2, true) - elif activator.get_collision_layer_bit(2): # enemy object - rocket.set_collision_layer_bit(1, true) - rocket.set_collision_layer_bit(2, false) - else: - assert(false, "who are you, activator?") - - -func discard(world, activator): - pass diff --git a/growth/CardInjects/rocket_launcher_card_inject.tscn b/growth/CardInjects/rocket_launcher_card_inject.tscn deleted file mode 100644 index afcebcd..0000000 --- a/growth/CardInjects/rocket_launcher_card_inject.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://cquq44uspy17w"] - -[ext_resource type="Script" uid="uid://bijee1o0qyiis" path="res://CardInjects/rocket_launcher_card_inject.gd" id="1_fa8xn"] - -[node name="RocketLauncherCardInject" type="Node"] -script = ExtResource("1_fa8xn") diff --git a/growth/Cards/CursorGunCard.tscn b/growth/Cards/CursorGunCard.tscn new file mode 100644 index 0000000..5cba502 --- /dev/null +++ b/growth/Cards/CursorGunCard.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=3 format=3 uid="uid://cmuig2rqt65f3"] + +[ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://BaseCard/BaseCard.tscn" id="1_3qnhj"] +[ext_resource type="PackedScene" uid="uid://bf1241le7dwfs" path="res://CardInjects/CursorGun/CursorGunCardInject.tscn" id="2_rrs0u"] + +[node name="Card" instance=ExtResource("1_3qnhj")] +behaviors = [ExtResource("2_rrs0u")] diff --git a/growth/Cards/DashCard.tscn b/growth/Cards/DashCard.tscn index 873b516..e176f76 100644 --- a/growth/Cards/DashCard.tscn +++ b/growth/Cards/DashCard.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://ee0t3qv6gyam"] -[ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://Card/BaseCard.tscn" id="1_wwyou"] +[ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://BaseCard/BaseCard.tscn" id="1_wwyou"] [ext_resource type="PackedScene" uid="uid://b3piw7awjaxgj" path="res://CardInjects/DashCardInject.tscn" id="2_2qs8v"] [node name="Card" instance=ExtResource("1_wwyou")] diff --git a/growth/Cards/FirewallCard.tscn b/growth/Cards/FirewallCard.tscn new file mode 100644 index 0000000..89a7a61 --- /dev/null +++ b/growth/Cards/FirewallCard.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=3 format=3 uid="uid://bbjra84inrnnu"] + +[ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://BaseCard/BaseCard.tscn" id="1_jb1yu"] +[ext_resource type="PackedScene" uid="uid://otxia3v8iw07" path="res://CardInjects/Firewall/FirewallCardInject.tscn" id="2_il4cq"] + +[node name="Card" instance=ExtResource("1_jb1yu")] +behaviors = [ExtResource("2_il4cq")] diff --git a/growth/Cards/RocketLauncherCard.tscn b/growth/Cards/RocketLauncherCard.tscn new file mode 100644 index 0000000..b7863d4 --- /dev/null +++ b/growth/Cards/RocketLauncherCard.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=3 format=3 uid="uid://cwrwbf1ib5845"] + +[ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://BaseCard/BaseCard.tscn" id="1_j4w8m"] +[ext_resource type="PackedScene" uid="uid://cquq44uspy17w" path="res://CardInjects/RocketLauncher/rocket_launcher_card_inject.tscn" id="2_203iy"] + +[node name="Card" instance=ExtResource("1_j4w8m")] +behaviors = [ExtResource("2_203iy")] diff --git a/growth/hand.gd b/growth/hand.gd index 59fa02e..246734c 100644 --- a/growth/hand.gd +++ b/growth/hand.gd @@ -3,7 +3,7 @@ extends Panel @export var player: NodePath @export var world: NodePath -var dash_card_scene = preload("res://Cards/DashCard.tscn") +var dash_card_scene = preload("res://Cards/FirewallCard.tscn") var active_card_index = 0 func _ready() -> void: diff --git a/growth/level.tscn b/growth/level.tscn index df0c965..361e5aa 100644 --- a/growth/level.tscn +++ b/growth/level.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://dhhnr3xkxbxlu" path="res://player.tscn" id="1_vonw3"] [ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"] -[ext_resource type="PackedScene" path="res://hand.tscn" id="3_oi3di"] +[ext_resource type="PackedScene" uid="uid://co8jnr2dew5ts" path="res://hand.tscn" id="3_oi3di"] [ext_resource type="TileSet" uid="uid://c20bl25rqyf68" path="res://assets/tiles/new_tile_set.tres" id="4_0b4ue"] [node name="Level" type="Node2D"] diff --git a/growth/player.gd b/growth/player.gd index 9e1fe28..f14b522 100644 --- a/growth/player.gd +++ b/growth/player.gd @@ -31,6 +31,9 @@ var charged = false; var dash_cooldown_timer = 0; var dash_on_cooldown = false; +func get_target_pos(): + return self.get_global_mouse_position() + func update_move_direction(): move_direction = Vector2.ZERO if Input.is_action_pressed("move_right"): diff --git a/growth/player.tscn b/growth/player.tscn index 5cfdc6e..3c2af90 100644 --- a/growth/player.tscn +++ b/growth/player.tscn @@ -29,7 +29,6 @@ unique_name_in_owner = true scale = Vector2(0.1, 0.1) sprite_frames = SubResource("SpriteFrames_onrkg") -collision_layer = 2 [node name="Hurtbox" type="CollisionShape2D" parent="."] scale = Vector2(2.5, 2.5) shape = SubResource("CircleShape2D_i3pqv")