diff --git a/Assets/y-wing_main_laser.png b/Assets/y-wing_main_laser.png new file mode 100644 index 0000000..48dc691 Binary files /dev/null and b/Assets/y-wing_main_laser.png differ diff --git a/Assets/y-wing_main_laser.png.import b/Assets/y-wing_main_laser.png.import new file mode 100644 index 0000000..2807bee --- /dev/null +++ b/Assets/y-wing_main_laser.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://qmnr2uqcocyi" +path="res://.godot/imported/y-wing_main_laser.png-eb02e45ecdcfd605782f38b4c2feafab.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/y-wing_main_laser.png" +dest_files=["res://.godot/imported/y-wing_main_laser.png-eb02e45ecdcfd605782f38b4c2feafab.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Scenes/world.gd b/Scenes/world.gd index 66e6658..a930b81 100644 --- a/Scenes/world.gd +++ b/Scenes/world.gd @@ -6,6 +6,7 @@ var Laser = preload("res://Scenes/PlayerLaser.tscn") var missile = preload("res://Scenes/missile.tscn") var missile_refil = preload("res://Scenes/missile_pickup.tscn") var enemy_laser = preload("res://Scenes/enemy_laser.tscn") +var enemy_y_wing_main = preload("res://Scenes/y_wing_main_cannon_laser.tscn") var enemy_y_wing_turret_laser = preload("res://Scenes/turret_laser.tscn") var enemy_y_wing_main_laser = null @@ -68,6 +69,11 @@ func firey_wingturret(location,firing_solution,target): add_child(l) #l.initialize(rotation,target) +func fire_y_wing_main(location): + print("fired") + var l = enemy_y_wing_main.instantiate() + l.global_position = location + add_child(l) diff --git a/Scenes/y_wing_main_cannon_laser.tscn b/Scenes/y_wing_main_cannon_laser.tscn new file mode 100644 index 0000000..a9a785c --- /dev/null +++ b/Scenes/y_wing_main_cannon_laser.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=5 format=3 uid="uid://bclbidx5k15o7"] + +[ext_resource type="Script" path="res://Scripts/y_wing_main_cannon_laser.gd" id="1_2yenk"] +[ext_resource type="Texture2D" uid="uid://qmnr2uqcocyi" path="res://Assets/y-wing_main_laser.png" id="1_jmsrt"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_iw7a3"] +radius = 3.0 +height = 80.0 + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_mtiwm"] +radius = 3.0 +height = 80.0 + +[node name="y-wing-main-cannon" type="Area2D"] +collision_layer = 16 +collision_mask = 3 +script = ExtResource("1_2yenk") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_jmsrt") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-8, 4) +shape = SubResource("CapsuleShape2D_iw7a3") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="."] +position = Vector2(7, 4) +shape = SubResource("CapsuleShape2D_mtiwm") + +[connection signal="area_entered" from="." to="." method="_on_area_entered"] diff --git a/Scripts/enemy_ywing.gd b/Scripts/enemy_ywing.gd index a915cc8..6702890 100644 --- a/Scripts/enemy_ywing.gd +++ b/Scripts/enemy_ywing.gd @@ -43,8 +43,9 @@ func _physics_process(delta): global_position.y += speed * delta #main cannon firing - if mainray.is_colliding and mainray.get_collider is player: + if mainray.is_colliding and mainray.get_collider() is player: if main_cannon == true: + print("target") fire_main_cannon() main_cannon = false mainCannonFire.start() diff --git a/Scripts/y_wing_main_cannon_laser.gd b/Scripts/y_wing_main_cannon_laser.gd new file mode 100644 index 0000000..ed40e33 --- /dev/null +++ b/Scripts/y_wing_main_cannon_laser.gd @@ -0,0 +1,16 @@ +extends Area2D + +var speed = 2500 + + +func _physics_process(delta): + global_position.y += speed * delta + if global_position.y >= 980: + queue_free() + + + +func _on_area_entered(area): + if area is player: + area.take_damage(1) + queue_free()