Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ProjectileEffect base class and basic functionality #2

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions units/enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ func _physics_process(delta):

func _on_visible_on_screen_notifier_2d_screen_exited():
queue_free()

func _on_area_entered(area):
queue_free()
4 changes: 3 additions & 1 deletion units/enemy.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://4fjgeuv7aun7"]
[gd_scene load_steps=4 format=3 uid="uid://bdsjg08y1h6yh"]

[ext_resource type="Script" path="res://units/enemy.gd" id="1_6h8a0"]
[ext_resource type="Texture2D" uid="uid://dqkvsqmwue64p" path="res://units/PNG_Parts&Spriter_Animation/Ship1/Ship1.png" id="1_ndkjl"]
Expand All @@ -13,11 +13,13 @@ script = ExtResource("1_6h8a0")
texture = ExtResource("1_ndkjl")

[node name="Area2D" type="Area2D" parent="."]
collision_mask = 3

[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, -0.75)
shape = SubResource("RectangleShape2D_mvxux")

[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]

[connection signal="area_entered" from="Area2D" to="." method="_on_area_entered"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
1 change: 0 additions & 1 deletion units/projectile.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func _physics_process(delta):
func _on_area_entered(area):
# TODO: apply effects on enemy hit. For now just despawn.
queue_free()
area.owner.queue_free()

func _integrate_forces(delta):
scale = Vector2(100, 100)
1 change: 1 addition & 0 deletions units/projectile.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ radius = 4.0

[node name="Projectile" type="Area2D"]
position = Vector2(68, 1)
collision_layer = 2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I kinda like the idea that projectiles can hit themselves / the player... but that'll take some thinking. For now 👍 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a terrible idea, though the huge double lasers overlapped hitboxes, so they would just immediately disappear

script = ExtResource("1_t6pyo")

[node name="Sprite2D" type="Sprite2D" parent="."]
Expand Down