Refactored all of ship movement

This commit is contained in:
2024-05-10 20:42:22 -04:00
parent c13e23cdd3
commit 2c90c6d318
8 changed files with 144 additions and 35 deletions

View File

@ -4,10 +4,11 @@
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_jyq7a"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5nukh"]
size = Vector2(4, 16)
size = Vector2(16, 4)
[node name="Bullet" type="Area2D" groups=["projectile"]]
collision_layer = 2
position = Vector2(7, 1)
collision_mask = 2
script = ExtResource("1_jyq7a")
[node name="Sprite2D" type="Sprite2D" parent="."]
@ -15,6 +16,7 @@ position = Vector2(1, 0)
texture = ExtResource("1_6rsjj")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(1, -1)
shape = SubResource("RectangleShape2D_5nukh")
[node name="LifeTimer" type="Timer" parent="."]

View File

@ -4,4 +4,20 @@
[node name="Game" type="Node2D"]
[node name="Background" type="CanvasLayer" parent="."]
layer = -1
[node name="ColorRect" type="ColorRect" parent="Background"]
z_index = -1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
z_index = 1
position = Vector2(622, 309)
max_speed = null
steering_factor = null

View File

@ -3,12 +3,17 @@
[ext_resource type="Script" path="res://scripts/ship.gd" id="1_japvq"]
[ext_resource type="Texture2D" uid="uid://qcnuvee2jcp0" path="res://assets/img/ship.png" id="1_ymcdl"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hwy8o"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_115lu"]
size = Vector2(35, 35)
[node name="Ship" type="Area2D" groups=["ship"]]
[node name="Ship" type="RigidBody2D" groups=["ship"]]
collision_mask = 2
gravity_scale = 0.0
linear_damp = 1.0
angular_damp = 2.0
script = ExtResource("1_japvq")
max_speed = null
steering_factor = null
engine_power = null
spin_power = null
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_ymcdl")
@ -20,10 +25,17 @@ emission_sphere_radius = 3.0
spread = 105.9
gravity = Vector2(0, 0)
[node name="Gun" type="Marker2D" parent="Sprite2D"]
position = Vector2(32, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.54049
scale = Vector2(1.36118, -2.39866)
shape = SubResource("CapsuleShape2D_hwy8o")
shape = SubResource("RectangleShape2D_115lu")
[node name="ShotCooldown" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[node name="Gun" type="Marker2D" parent="."]
[node name="Projectiles" type="Node2D" parent="."]
position = Vector2(-33, 0)
[connection signal="timeout" from="ShotCooldown" to="." method="_on_shot_cooldown_timeout"]