aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfreddie-a <57713959+freddie-a@users.noreply.github.com>2022-10-29 23:16:03 +0100
committerfreddie-a <57713959+freddie-a@users.noreply.github.com>2022-10-29 23:16:03 +0100
commit6d389367e55365c0d993e23d93a3e60ade51c844 (patch)
tree2bbea616bae1bbb1982617a16a2fcf8fde4fd1d0
parent50b7eb11fe309582002d2fb70742d1c1e6d03d92 (diff)
Change bullet sprite and accelerate spawning
-rw-r--r--Bullet.tscn6
-rw-r--r--Enemy0.gd2
-rw-r--r--KinematicBody2D.gd2
-rw-r--r--Node2D.tscn10
-rw-r--r--assets/maps/map2.jpgbin709332 -> 610550 bytes
5 files changed, 14 insertions, 6 deletions
diff --git a/Bullet.tscn b/Bullet.tscn
index 1d8b9e4..56a7785 100644
--- a/Bullet.tscn
+++ b/Bullet.tscn
@@ -3,13 +3,15 @@
[ext_resource path="res://Bullet.gd" type="Script" id=1]
[ext_resource path="res://assets/bullet.png" type="Texture" id=2]
-[sub_resource type="RectangleShape2D" id=1]
-extents = Vector2( 31, 31 )
+[sub_resource type="CapsuleShape2D" id=1]
+radius = 15.0
+height = 12.0
[node name="Bullet" type="KinematicBody2D"]
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+rotation = 1.5708
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
diff --git a/Enemy0.gd b/Enemy0.gd
index ecfb99c..625762a 100644
--- a/Enemy0.gd
+++ b/Enemy0.gd
@@ -14,4 +14,4 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
- move_and_collide(global_position.direction_to(globals.playerPos).normalized() * 2)
+ move_and_collide(global_position.direction_to(globals.playerPos).normalized() * 1000 * delta)
diff --git a/KinematicBody2D.gd b/KinematicBody2D.gd
index 4f2949c..96484f3 100644
--- a/KinematicBody2D.gd
+++ b/KinematicBody2D.gd
@@ -34,5 +34,5 @@ func _physics_process(delta):
get_owner().add_child(obj)
var bodies = get_overlapping_bodies()
for body in bodies:
- if body.get_name() != "Bullet":
+ if not "Bullet" in body.get_name():
emit_signal("hit", delta)
diff --git a/Node2D.tscn b/Node2D.tscn
index d6a1149..0a39396 100644
--- a/Node2D.tscn
+++ b/Node2D.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=7 format=2]
[ext_resource path="res://HUD.tscn" type="PackedScene" id=1]
[ext_resource path="res://Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Main.gd" type="Script" id=3]
+[ext_resource path="res://assets/maps/map2.jpg" type="Texture" id=4]
[ext_resource path="res://Enemy0.tscn" type="PackedScene" id=5]
[sub_resource type="Curve2D" id=1]
@@ -14,6 +15,11 @@ _data = {
script = ExtResource( 3 )
enemy_scene = ExtResource( 5 )
+[node name="Sprite" type="Sprite" parent="."]
+scale = Vector2( 0.64, 0.64 )
+texture = ExtResource( 4 )
+centered = false
+
[node name="KinematicBody2D" parent="." instance=ExtResource( 2 )]
position = Vector2( 544, 216 )
@@ -27,6 +33,6 @@ curve = SubResource( 1 )
[node name="EnemySpawnLocation" type="PathFollow2D" parent="EnemySpawn"]
[node name="EnemySpawnTimer" type="Timer" parent="."]
-wait_time = 1.504
+wait_time = 0.476
[connection signal="timeout" from="EnemySpawnTimer" to="." method="_on_EnemySpawnTimer_timeout"]
diff --git a/assets/maps/map2.jpg b/assets/maps/map2.jpg
index 7cd6716..95b35e9 100644
--- a/assets/maps/map2.jpg
+++ b/assets/maps/map2.jpg
Binary files differ