hyper space
This commit is contained in:
		
							
								
								
									
										19
									
								
								enemy_bullet/enemy_bullet.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								enemy_bullet/enemy_bullet.gd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
extends Area2D
 | 
			
		||||
 | 
			
		||||
@export var speed = 150
 | 
			
		||||
 | 
			
		||||
func start(pos):
 | 
			
		||||
	position = pos
 | 
			
		||||
 | 
			
		||||
func _process(delta):
 | 
			
		||||
	position.y += speed * delta
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_visible_on_screen_notifier_2d_screen_exited():
 | 
			
		||||
	queue_free() # Replace with function body.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_area_entered(area):
 | 
			
		||||
	if area.name == "Player":
 | 
			
		||||
		queue_free()
 | 
			
		||||
		area.shield -= 1
 | 
			
		||||
							
								
								
									
										22
									
								
								enemy_bullet/enemy_bullet.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								enemy_bullet/enemy_bullet.tscn
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
[gd_scene load_steps=4 format=3 uid="uid://cd4vk0l8luwvx"]
 | 
			
		||||
 | 
			
		||||
[ext_resource type="Texture2D" uid="uid://dkbhiir1v8nq1" path="res://assets/Projectiles/Enemy_projectile (16 x 16).png" id="1_wjdji"]
 | 
			
		||||
[ext_resource type="Script" path="res://enemy_bullet/enemy_bullet.gd" id="1_y73ek"]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="CircleShape2D" id="CircleShape2D_4410i"]
 | 
			
		||||
radius = 3.0
 | 
			
		||||
 | 
			
		||||
[node name="enemy_bullet" type="Area2D"]
 | 
			
		||||
script = ExtResource("1_y73ek")
 | 
			
		||||
 | 
			
		||||
[node name="Sprite2D" type="Sprite2D" parent="."]
 | 
			
		||||
texture = ExtResource("1_wjdji")
 | 
			
		||||
hframes = 4
 | 
			
		||||
 | 
			
		||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
 | 
			
		||||
shape = SubResource("CircleShape2D_4410i")
 | 
			
		||||
 | 
			
		||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
 | 
			
		||||
 | 
			
		||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
 | 
			
		||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
 | 
			
		||||
		Reference in New Issue
	
	Block a user