INIT
This commit is contained in:
4
levels/level_1/crosshair.gd
Normal file
4
levels/level_1/crosshair.gd
Normal file
@@ -0,0 +1,4 @@
|
||||
extends Sprite2D
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
position = get_global_mouse_position()
|
||||
1
levels/level_1/crosshair.gd.uid
Normal file
1
levels/level_1/crosshair.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://djy0pj3it4816
|
||||
4
levels/level_1/gun.gd
Normal file
4
levels/level_1/gun.gd
Normal file
@@ -0,0 +1,4 @@
|
||||
extends Node2D
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
look_at(get_global_mouse_position())
|
||||
1
levels/level_1/gun.gd.uid
Normal file
1
levels/level_1/gun.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b6nk5wcxncuwm
|
||||
7
levels/level_1/level_1.gd
Normal file
7
levels/level_1/level_1.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends Node2D
|
||||
|
||||
@export
|
||||
var mouse_cursor: Texture2D
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||
1
levels/level_1/level_1.gd.uid
Normal file
1
levels/level_1/level_1.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://yrpmdfnvg458
|
||||
68
levels/level_1/level_1.tscn
Normal file
68
levels/level_1/level_1.tscn
Normal file
@@ -0,0 +1,68 @@
|
||||
[gd_scene format=3 uid="uid://dd2hhxsy2tyrg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yrpmdfnvg458" path="res://levels/level_1/level_1.gd" id="1_5b03i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bde7acekd3uir" path="res://levels/level_1/moorhuhn.tscn" id="1_k1ttk"]
|
||||
[ext_resource type="Script" uid="uid://35u2woe76mun" path="res://levels/level_1/spawner.gd" id="2_45440"]
|
||||
[ext_resource type="Texture2D" uid="uid://cp7xaluayhbv8" path="res://assets/cursor.png" id="2_e6u7d"]
|
||||
[ext_resource type="FontFile" uid="uid://c4vwn7ipn5jno" path="res://assets/fonts/HennyPenny-Regular.ttf" id="3_epb64"]
|
||||
[ext_resource type="Texture2D" uid="uid://dt0qvt2i1knk0" path="res://assets/background3-720.png" id="4_iey7c"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4vbec50oggpd" path="res://assets/gun.png" id="7_mxc8w"]
|
||||
[ext_resource type="Script" uid="uid://b6nk5wcxncuwm" path="res://levels/level_1/gun.gd" id="8_j48du"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcvbx8mnfpmhg" path="res://assets/crosshair.png" id="9_8jbay"]
|
||||
[ext_resource type="Script" uid="uid://djy0pj3it4816" path="res://levels/level_1/crosshair.gd" id="10_la5aw"]
|
||||
|
||||
[node name="Level1" type="Node2D" unique_id=1640293185]
|
||||
script = ExtResource("1_5b03i")
|
||||
mouse_cursor = ExtResource("2_e6u7d")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=1141524756]
|
||||
offset_left = -14.0
|
||||
offset_top = 204.0
|
||||
offset_right = 331.0
|
||||
offset_bottom = 261.0
|
||||
color = Color(0.22352941, 0.2509804, 0.27450982, 1)
|
||||
|
||||
[node name="Background3720" type="Sprite2D" parent="." unique_id=2006398144]
|
||||
position = Vector2(133, 105.00001)
|
||||
scale = Vector2(0.30742478, 0.30742475)
|
||||
texture = ExtResource("4_iey7c")
|
||||
|
||||
[node name="GUI" type="CanvasLayer" parent="." unique_id=1855866513]
|
||||
|
||||
[node name="Score" type="Label" parent="GUI" unique_id=1647586601]
|
||||
offset_left = 5.0
|
||||
offset_top = -1.0
|
||||
offset_right = 45.0
|
||||
offset_bottom = 43.0
|
||||
mouse_filter = 1
|
||||
theme_override_colors/font_color = Color(1, 1, 0, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 6
|
||||
theme_override_fonts/font = ExtResource("3_epb64")
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "0"
|
||||
|
||||
[node name="Spawner" type="Node2D" parent="." unique_id=487338256 node_paths=PackedStringArray("score_label")]
|
||||
script = ExtResource("2_45440")
|
||||
spawnee = ExtResource("1_k1ttk")
|
||||
score_label = NodePath("../GUI/Score")
|
||||
|
||||
[node name="Timer" type="Timer" parent="Spawner" unique_id=239078670]
|
||||
autostart = true
|
||||
|
||||
[node name="Gun" type="Node2D" parent="." unique_id=2142476497]
|
||||
position = Vector2(162, 260)
|
||||
rotation = -1.5707964
|
||||
script = ExtResource("8_j48du")
|
||||
|
||||
[node name="GFX" type="Sprite2D" parent="Gun" unique_id=907649535]
|
||||
rotation = 1.5707964
|
||||
texture = ExtResource("7_mxc8w")
|
||||
offset = Vector2(3, -47)
|
||||
|
||||
[node name="Crosshair" type="Sprite2D" parent="." unique_id=2084983337]
|
||||
position = Vector2(141, 99)
|
||||
texture = ExtResource("9_8jbay")
|
||||
script = ExtResource("10_la5aw")
|
||||
|
||||
[connection signal="timeout" from="Spawner/Timer" to="Spawner" method="spawn"]
|
||||
33
levels/level_1/moorhuhn.gd
Normal file
33
levels/level_1/moorhuhn.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
class_name Moorhuhn
|
||||
extends Area2D
|
||||
|
||||
signal killed
|
||||
|
||||
@export
|
||||
var explosion: PackedScene
|
||||
|
||||
var direction := Vector2.ONE
|
||||
|
||||
var speed := 10
|
||||
|
||||
func _ready() -> void:
|
||||
var angle := randi_range(0, 360)
|
||||
direction = direction.rotated(deg_to_rad(angle))
|
||||
|
||||
speed += randi_range(5, 10)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
position += direction * speed * delta
|
||||
|
||||
|
||||
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.is_released():
|
||||
var expl_inst = explosion.instantiate()
|
||||
expl_inst.position = position
|
||||
get_parent().add_child(expl_inst)
|
||||
|
||||
killed.emit()
|
||||
|
||||
queue_free()
|
||||
1
levels/level_1/moorhuhn.gd.uid
Normal file
1
levels/level_1/moorhuhn.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dhjsnp5vhwovp
|
||||
21
levels/level_1/moorhuhn.tscn
Normal file
21
levels/level_1/moorhuhn.tscn
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_scene format=3 uid="uid://bde7acekd3uir"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cydwx3idckbqx" path="res://icon.svg" id="1_krtjd"]
|
||||
[ext_resource type="Script" uid="uid://dhjsnp5vhwovp" path="res://levels/level_1/moorhuhn.gd" id="1_lfeej"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfvm2tee57rnd" path="res://levels/level_1/moorhuhn_explosion.tscn" id="2_47yum"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vn7o3"]
|
||||
size = Vector2(32, 34)
|
||||
|
||||
[node name="Moorhuhn" type="Area2D" unique_id=425849624]
|
||||
script = ExtResource("1_lfeej")
|
||||
explosion = ExtResource("2_47yum")
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="." unique_id=1344228166]
|
||||
scale = Vector2(0.27734372, 0.27734372)
|
||||
texture = ExtResource("1_krtjd")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2057638764]
|
||||
shape = SubResource("RectangleShape2D_vn7o3")
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
5
levels/level_1/moorhuhn_explosion.gd
Normal file
5
levels/level_1/moorhuhn_explosion.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends GPUParticles2D
|
||||
|
||||
func _ready() -> void:
|
||||
restart()
|
||||
finished.connect(queue_free)
|
||||
1
levels/level_1/moorhuhn_explosion.gd.uid
Normal file
1
levels/level_1/moorhuhn_explosion.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vpp7pnmsf5ll
|
||||
47
levels/level_1/moorhuhn_explosion.tscn
Normal file
47
levels/level_1/moorhuhn_explosion.tscn
Normal file
@@ -0,0 +1,47 @@
|
||||
[gd_scene format=3 uid="uid://cfvm2tee57rnd"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cydwx3idckbqx" path="res://icon.svg" id="1_fk8g6"]
|
||||
[ext_resource type="AudioStream" uid="uid://bfwumy1ku2qd1" path="res://assets/explosion/explosion_1.sfxr" id="2_njv5u"]
|
||||
[ext_resource type="Script" uid="uid://vpp7pnmsf5ll" path="res://levels/level_1/moorhuhn_explosion.gd" id="2_xpde7"]
|
||||
[ext_resource type="AudioStream" uid="uid://lfo3acn16vs2" path="res://assets/explosion/explosion_2.sfxr" id="3_xpde7"]
|
||||
[ext_resource type="AudioStream" uid="uid://q66wk5y6kpe2" path="res://assets/explosion/explosion_3.sfxr" id="4_rnyim"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_epb64"]
|
||||
_data = [Vector2(0, 0.5882353), 0.0, 0.0, 0, 0, Vector2(0.98857147, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_5b03i"]
|
||||
curve = SubResource("Curve_epb64")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_iey7c"]
|
||||
particle_flag_disable_z = true
|
||||
angle_min = -285.3
|
||||
angle_max = 298.6
|
||||
spread = 180.0
|
||||
initial_velocity_min = 13.219999
|
||||
initial_velocity_max = 29.22
|
||||
gravity = Vector3(0, 0, 0)
|
||||
scale_min = 0.099999994
|
||||
scale_max = 0.099999994
|
||||
scale_curve = SubResource("CurveTexture_5b03i")
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_pnhrh"]
|
||||
streams_count = 3
|
||||
stream_0/stream = ExtResource("2_njv5u")
|
||||
stream_1/stream = ExtResource("3_xpde7")
|
||||
stream_2/stream = ExtResource("4_rnyim")
|
||||
|
||||
[node name="MoorhuhnExplosion" type="GPUParticles2D" unique_id=1457483329]
|
||||
emitting = false
|
||||
amount = 12
|
||||
texture = ExtResource("1_fk8g6")
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
randomness = 0.62
|
||||
process_material = SubResource("ParticleProcessMaterial_iey7c")
|
||||
script = ExtResource("2_xpde7")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=237906263]
|
||||
stream = SubResource("AudioStreamRandomizer_pnhrh")
|
||||
autoplay = true
|
||||
bus = &"SFXR"
|
||||
33
levels/level_1/spawner.gd
Normal file
33
levels/level_1/spawner.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Node2D
|
||||
|
||||
@export
|
||||
var spawnee: PackedScene
|
||||
|
||||
@export
|
||||
var initial_spawn_amount: int = 4
|
||||
|
||||
@export
|
||||
var score_label: Label
|
||||
|
||||
var score: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
score_label.text = str(score)
|
||||
for i in range(initial_spawn_amount):
|
||||
spawn()
|
||||
|
||||
|
||||
func spawn() -> void:
|
||||
var new_spawnee: Node2D = spawnee.instantiate()
|
||||
new_spawnee.position = Vector2(randi_range(40, 280), randi_range(40, 200))
|
||||
|
||||
|
||||
new_spawnee.killed.connect(on_killed)
|
||||
|
||||
add_child(new_spawnee)
|
||||
|
||||
|
||||
func on_killed():
|
||||
score += 1
|
||||
score_label.text = str(score)
|
||||
1
levels/level_1/spawner.gd.uid
Normal file
1
levels/level_1/spawner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://35u2woe76mun
|
||||
Reference in New Issue
Block a user