mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-13 00:25:53 +00:00
NPC that shoots at player
This commit is contained in:
parent
bfe42b460b
commit
30850362ce
11 changed files with 253 additions and 5250 deletions
48
Scenes/Enemy.tscn
Normal file
48
Scenes/Enemy.tscn
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://v8s3kubgb2qg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b4ynnb14mb4uq" path="res://Sprites/Reisen.png" id="1_4w8mj"]
|
||||
[ext_resource type="Script" path="res://Scripts/Enemy.cs" id="1_lpwdj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="2_ogldd"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2brqc"]
|
||||
atlas = ExtResource("1_4w8mj")
|
||||
region = Rect2(0, 0, 8, 16)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8gtts"]
|
||||
radius = 7.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_cacb5"]
|
||||
radius = 4.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_v711r"]
|
||||
radius = 85.0529
|
||||
|
||||
[node name="Enemy" type="Area2D"]
|
||||
collision_layer = 16
|
||||
script = ExtResource("1_lpwdj")
|
||||
BulletScene = ExtResource("2_ogldd")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = SubResource("AtlasTexture_2brqc")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
shape = SubResource("CircleShape2D_8gtts")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
visible = false
|
||||
position = Vector2(0, 5)
|
||||
shape = SubResource("CircleShape2D_cacb5")
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
|
||||
[node name="PlayerDetectionArea" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
shape = SubResource("CircleShape2D_v711r")
|
||||
|
||||
[connection signal="area_entered" from="PlayerDetection" to="." method="_on_player_detection_area_entered"]
|
||||
[connection signal="area_exited" from="PlayerDetection" to="." method="_on_player_detection_area_exited"]
|
||||
|
|
@ -32,6 +32,7 @@ position = Vector2(0.5, -0.5)
|
|||
shape = SubResource("RectangleShape2D_0nhpj")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
position = Vector2(0, 1.5)
|
||||
|
|
|
|||
29
Scenes/enemyBullet.tscn
Normal file
29
Scenes/enemyBullet.tscn
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cuixq5ex0j40h"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Bullet.cs" id="1_s0j1e"]
|
||||
[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="2_6t448"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jxptd"]
|
||||
radius = 2.23607
|
||||
|
||||
[node name="Bullet" type="Area2D" groups=["bullets"]]
|
||||
collision_layer = 8
|
||||
collision_mask = 71
|
||||
script = ExtResource("1_s0j1e")
|
||||
Speed = 200.0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_6t448")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_jxptd")
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
editor_description = "Player Bullet"
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
2950
Scenes/test.tscn
2950
Scenes/test.tscn
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue