From 62e90b444315245ef24606fa51d3fccba5f18e08 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 28 Sep 2024 15:29:16 +0200 Subject: initial commit --- .gitattributes | 2 + .gitignore | 3 + Game.tscn | 6 + Player/Assets/arrow.kra | Bin 0 -> 32160 bytes Player/Assets/arrow.kra~ | Bin 0 -> 31971 bytes Player/Assets/arrow.png | Bin 0 -> 170 bytes Player/Assets/arrow.png.import | 34 ++++++ Player/Assets/arrow.png~ | Bin 0 -> 165 bytes Player/Assets/bow.kra | Bin 0 -> 32879 bytes Player/Assets/bow.kra~ | Bin 0 -> 32897 bytes Player/Assets/bow.png | Bin 0 -> 202 bytes Player/Assets/bow.png.import | 34 ++++++ Player/Assets/bow.png~ | Bin 0 -> 226 bytes Player/arrow.gd | 27 +++++ Player/arrow.tscn | 35 ++++++ Player/arrow_head_shape.tres | 4 + Player/bow.gd | 86 +++++++++++++ Player/bow.tscn | 20 +++ Player/target_line.gd | 26 ++++ SoundManager.tscn | 23 ++++ Stage/balloons.gd | 12 ++ Stage/balloons.tscn | 32 +++++ Target/Assets/balloon-pop-01.wav | Bin 0 -> 7134 bytes Target/Assets/balloon-pop-01.wav.import | 24 ++++ Target/Assets/balloon-pop-02.wav | Bin 0 -> 11598 bytes Target/Assets/balloon-pop-02.wav.import | 24 ++++ Target/Assets/balloon-pop-03.wav | Bin 0 -> 19278 bytes Target/Assets/balloon-pop-03.wav.import | 24 ++++ Target/Assets/balloon.kra | Bin 0 -> 41069 bytes Target/Assets/balloon.kra~ | Bin 0 -> 41089 bytes Target/Assets/balloon.png | Bin 0 -> 155 bytes Target/Assets/balloon.png.import | 34 ++++++ Target/Assets/balloon.png~ | Bin 0 -> 152 bytes Target/balloon.gd | 40 ++++++ Target/balloon.tscn | 37 ++++++ Target/balloon_shape.tres | 5 + UI/Assets/background.jpg | Bin 0 -> 722373 bytes UI/Assets/background.jpg.import | 34 ++++++ UI/hud.gd | 7 ++ UI/hud.tscn | 21 ++++ UI/start.gd | 5 + UI/start.tscn | 35 ++++++ export_presets.cfg | 207 ++++++++++++++++++++++++++++++++ game.gd | 8 ++ icon.svg | 1 + icon.svg.import | 37 ++++++ project.godot | 50 ++++++++ sound_manager.gd | 7 ++ 48 files changed, 944 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Game.tscn create mode 100644 Player/Assets/arrow.kra create mode 100644 Player/Assets/arrow.kra~ create mode 100644 Player/Assets/arrow.png create mode 100644 Player/Assets/arrow.png.import create mode 100644 Player/Assets/arrow.png~ create mode 100644 Player/Assets/bow.kra create mode 100644 Player/Assets/bow.kra~ create mode 100644 Player/Assets/bow.png create mode 100644 Player/Assets/bow.png.import create mode 100644 Player/Assets/bow.png~ create mode 100644 Player/arrow.gd create mode 100644 Player/arrow.tscn create mode 100644 Player/arrow_head_shape.tres create mode 100644 Player/bow.gd create mode 100644 Player/bow.tscn create mode 100644 Player/target_line.gd create mode 100644 SoundManager.tscn create mode 100644 Stage/balloons.gd create mode 100644 Stage/balloons.tscn create mode 100644 Target/Assets/balloon-pop-01.wav create mode 100644 Target/Assets/balloon-pop-01.wav.import create mode 100644 Target/Assets/balloon-pop-02.wav create mode 100644 Target/Assets/balloon-pop-02.wav.import create mode 100644 Target/Assets/balloon-pop-03.wav create mode 100644 Target/Assets/balloon-pop-03.wav.import create mode 100644 Target/Assets/balloon.kra create mode 100644 Target/Assets/balloon.kra~ create mode 100644 Target/Assets/balloon.png create mode 100644 Target/Assets/balloon.png.import create mode 100644 Target/Assets/balloon.png~ create mode 100644 Target/balloon.gd create mode 100644 Target/balloon.tscn create mode 100644 Target/balloon_shape.tres create mode 100644 UI/Assets/background.jpg create mode 100644 UI/Assets/background.jpg.import create mode 100644 UI/hud.gd create mode 100644 UI/hud.tscn create mode 100644 UI/start.gd create mode 100644 UI/start.tscn create mode 100644 export_presets.cfg create mode 100644 game.gd create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot create mode 100644 sound_manager.gd diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/Game.tscn b/Game.tscn new file mode 100644 index 0000000..ae0456b --- /dev/null +++ b/Game.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://dn3yr1q2kbl7c"] + +[ext_resource type="Script" path="res://game.gd" id="1_rydg3"] + +[node name="Game" type="Node"] +script = ExtResource("1_rydg3") diff --git a/Player/Assets/arrow.kra b/Player/Assets/arrow.kra new file mode 100644 index 0000000..57ca2a8 Binary files /dev/null and b/Player/Assets/arrow.kra differ diff --git a/Player/Assets/arrow.kra~ b/Player/Assets/arrow.kra~ new file mode 100644 index 0000000..376471d Binary files /dev/null and b/Player/Assets/arrow.kra~ differ diff --git a/Player/Assets/arrow.png b/Player/Assets/arrow.png new file mode 100644 index 0000000..4e71ad9 Binary files /dev/null and b/Player/Assets/arrow.png differ diff --git a/Player/Assets/arrow.png.import b/Player/Assets/arrow.png.import new file mode 100644 index 0000000..0c475ca --- /dev/null +++ b/Player/Assets/arrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b6mkb436giuns" +path="res://.godot/imported/arrow.png-a9f919cad48f96a83e2a88829bb8141c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Player/Assets/arrow.png" +dest_files=["res://.godot/imported/arrow.png-a9f919cad48f96a83e2a88829bb8141c.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/Player/Assets/arrow.png~ b/Player/Assets/arrow.png~ new file mode 100644 index 0000000..bc6209b Binary files /dev/null and b/Player/Assets/arrow.png~ differ diff --git a/Player/Assets/bow.kra b/Player/Assets/bow.kra new file mode 100644 index 0000000..c08370d Binary files /dev/null and b/Player/Assets/bow.kra differ diff --git a/Player/Assets/bow.kra~ b/Player/Assets/bow.kra~ new file mode 100644 index 0000000..ce0934a Binary files /dev/null and b/Player/Assets/bow.kra~ differ diff --git a/Player/Assets/bow.png b/Player/Assets/bow.png new file mode 100644 index 0000000..c315267 Binary files /dev/null and b/Player/Assets/bow.png differ diff --git a/Player/Assets/bow.png.import b/Player/Assets/bow.png.import new file mode 100644 index 0000000..bd33d5d --- /dev/null +++ b/Player/Assets/bow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://e0214m2jyp81" +path="res://.godot/imported/bow.png-8d7cdf3a1d17167a06b6f444c5720069.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Player/Assets/bow.png" +dest_files=["res://.godot/imported/bow.png-8d7cdf3a1d17167a06b6f444c5720069.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/Player/Assets/bow.png~ b/Player/Assets/bow.png~ new file mode 100644 index 0000000..00ee2d9 Binary files /dev/null and b/Player/Assets/bow.png~ differ diff --git a/Player/arrow.gd b/Player/arrow.gd new file mode 100644 index 0000000..f6cce57 --- /dev/null +++ b/Player/arrow.gd @@ -0,0 +1,27 @@ +extends CharacterBody2D + + +var deacceleration := 10.0 +var flying := false + + +func _ready(): + if OS.has_feature("mobile"): + scale = Vector2(2, 2) + + +func _physics_process(delta: float) -> void: + velocity = velocity.move_toward(Vector2.ZERO, deacceleration * delta) + + if abs(velocity) > Vector2.ZERO: + flying = true + $ArrowHead/CollisionShape2D.disabled = false + + if flying and velocity == Vector2.ZERO: + queue_free() + + move_and_slide() + + +func _on_visible_on_screen_notifier_2d_screen_exited() -> void: + queue_free() diff --git a/Player/arrow.tscn b/Player/arrow.tscn new file mode 100644 index 0000000..a9f7c98 --- /dev/null +++ b/Player/arrow.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=4 format=3 uid="uid://ctkfjrwg171fr"] + +[ext_resource type="Texture2D" uid="uid://b6mkb436giuns" path="res://Player/Assets/arrow.png" id="1_1lalc"] +[ext_resource type="Script" path="res://Player/arrow.gd" id="1_q6ess"] +[ext_resource type="Shape2D" uid="uid://vny1lmq7xr3s" path="res://Player/arrow_head_shape.tres" id="3_b2q2f"] + +[node name="Arrow" type="CharacterBody2D"] +z_index = 1 +collision_layer = 0 +collision_mask = 8 +script = ExtResource("1_q6ess") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +rotation = -3.14159 +texture = ExtResource("1_1lalc") + +[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] +position = Vector2(-7.15256e-07, -3.27826e-07) +scale = Vector2(0.8, 0.5) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-4.5, 0) +shape = ExtResource("3_b2q2f") + +[node name="ArrowHead" type="Area2D" parent="." groups=["arrow"]] +collision_layer = 2 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="ArrowHead"] +position = Vector2(-4.5, 0) +shape = ExtResource("3_b2q2f") +disabled = true + +[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"] diff --git a/Player/arrow_head_shape.tres b/Player/arrow_head_shape.tres new file mode 100644 index 0000000..0c29169 --- /dev/null +++ b/Player/arrow_head_shape.tres @@ -0,0 +1,4 @@ +[gd_resource type="RectangleShape2D" format=3 uid="uid://vny1lmq7xr3s"] + +[resource] +size = Vector2(3, 4) diff --git a/Player/bow.gd b/Player/bow.gd new file mode 100644 index 0000000..aa3fafc --- /dev/null +++ b/Player/bow.gd @@ -0,0 +1,86 @@ +extends Node2D + + +var anchor := Vector2.ZERO +var anchor_mode := false +var drag_distance := Vector2.ZERO +var max_length := 75.0 + +var arrow_scene = preload("res://Player/arrow.tscn") +var arrow: Node2D + +var process_touch := false + + +func _ready() -> void: + if OS.has_feature("mobile"): + scale = Vector2(2, 2) + + $DrawLine.visible = false + $TargetLine.visible = false + + +func _input(event: InputEvent) -> void: + if event is InputEventScreenTouch: + if event.is_pressed(): + process_touch = true + elif event.is_released(): + process_touch = false + + +func _process(_delta: float) -> void: + if Input.is_action_just_pressed("click"): + global_position = get_global_mouse_position() + anchor = get_global_mouse_position() + anchor_mode = true + + arrow = arrow_scene.instantiate() + arrow.global_position = global_position + + get_tree().current_scene.add_child(arrow) + $DrawLine.visible = true + + $TargetLine.visible = true + $TargetLine.origin = anchor + $TargetLine.queue_redraw() + + elif Input.is_action_just_released("click"): + anchor_mode = false + + arrow.velocity = -drag_distance * 1.5 + arrow.flying = true + arrow = null + + $DrawLine.visible = false + $DrawLine.clear_points() + + $TargetLine.visible = false + $TargetLine.queue_redraw() + + elif Input.is_action_pressed("click"): + drag_distance = get_global_mouse_position() - anchor + rotation = atan2(drag_distance.y, drag_distance.x) + + var max_distance = get_global_mouse_position() + if drag_distance.length() > max_length: + drag_distance = (max_length / drag_distance.length()) * drag_distance + max_distance = anchor + drag_distance + + $DrawLine.clear_points() + $DrawLine.add_point(Vector2.ZERO) + $DrawLine.add_point((max_distance - global_position) / scale) + $DrawLine.rotation = -rotation + + $TargetLine.direction = (max_distance - global_position).normalized() * -1 + $TargetLine.rotation = -rotation + $TargetLine.queue_redraw() + + if not anchor_mode: + if OS.has_feature("mobile"): + if process_touch: + global_position = get_global_mouse_position() + else: + global_position = get_global_mouse_position() + + if is_instance_valid(arrow): + arrow.rotation = rotation diff --git a/Player/bow.tscn b/Player/bow.tscn new file mode 100644 index 0000000..e1ec9da --- /dev/null +++ b/Player/bow.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=4 format=3 uid="uid://bn0h50n6fr6n1"] + +[ext_resource type="Texture2D" uid="uid://e0214m2jyp81" path="res://Player/Assets/bow.png" id="1_7j25w"] +[ext_resource type="Script" path="res://Player/bow.gd" id="1_f5b6e"] +[ext_resource type="Script" path="res://Player/target_line.gd" id="3_r056j"] + +[node name="Bow" type="Node2D"] +z_index = 1 +script = ExtResource("1_f5b6e") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +texture = ExtResource("1_7j25w") + +[node name="DrawLine" type="Line2D" parent="."] +width = 1.0 + +[node name="TargetLine" type="Node2D" parent="."] +script = ExtResource("3_r056j") +color = Color(0.464322, 0.282893, 0, 1) diff --git a/Player/target_line.gd b/Player/target_line.gd new file mode 100644 index 0000000..8a321af --- /dev/null +++ b/Player/target_line.gd @@ -0,0 +1,26 @@ +extends Node2D + + +@export var direction := Vector2.ZERO +@export var origin := Vector2.ZERO +@export var spacing_factor := 15 +@export var color := Color("#ffa500") + + +func _draw() -> void: + var target_direction = direction * (get_viewport_rect().size).length() + var points = target_direction.length() / spacing_factor + var fraction = (target_direction / points) + for point in range(points): + color.a = 1.0 / clamp(log(point), 1.0, 10.0) + draw_circle( + (point + 1) * fraction, + 1.0, + color + ) + draw_circle( + (point + 1) * fraction, + 1.0, + Color(1.0, 1.0, 1.0, color.a), + false + ) diff --git a/SoundManager.tscn b/SoundManager.tscn new file mode 100644 index 0000000..c083e65 --- /dev/null +++ b/SoundManager.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=5 format=3 uid="uid://phao3lwow0kh"] + +[ext_resource type="Script" path="res://sound_manager.gd" id="1_32vwc"] +[ext_resource type="AudioStream" uid="uid://2ysaqcfxhuhc" path="res://Target/Assets/balloon-pop-01.wav" id="2_3a1yw"] +[ext_resource type="AudioStream" uid="uid://13t4skh185gb" path="res://Target/Assets/balloon-pop-02.wav" id="3_qd2xq"] +[ext_resource type="AudioStream" uid="uid://cyqg31tj3xxwv" path="res://Target/Assets/balloon-pop-03.wav" id="4_qv7n7"] + +[node name="SoundManager" type="Node"] +script = ExtResource("1_32vwc") + +[node name="Balloon" type="Node" parent="."] + +[node name="Balloon-pop-01" type="AudioStreamPlayer" parent="Balloon"] +stream = ExtResource("2_3a1yw") +volume_db = -5.0 + +[node name="Balloon-pop-02" type="AudioStreamPlayer" parent="Balloon"] +stream = ExtResource("3_qd2xq") +volume_db = -5.0 + +[node name="Balloon-pop-03" type="AudioStreamPlayer" parent="Balloon"] +stream = ExtResource("4_qv7n7") +volume_db = -5.0 diff --git a/Stage/balloons.gd b/Stage/balloons.gd new file mode 100644 index 0000000..a242bc0 --- /dev/null +++ b/Stage/balloons.gd @@ -0,0 +1,12 @@ +extends Node2D + + +func _on_spawn_timer_timeout() -> void: + var balloon = preload("res://Target/balloon.tscn").instantiate() + balloon.global_position = Vector2( + randf_range(get_viewport_rect().position.x, get_viewport_rect().end.x), + randf_range(get_viewport_rect().position.y, get_viewport_rect().end.y) + ) + balloon.velocity = Vector2(randf_range(-1.0, 1.0) * 20, randf_range(-1.0, 1.0) * 20) + balloon.modulate = Color(randf(), randf(), randf()) + add_child(balloon) diff --git a/Stage/balloons.tscn b/Stage/balloons.tscn new file mode 100644 index 0000000..63cd919 --- /dev/null +++ b/Stage/balloons.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=5 format=3 uid="uid://ddthntf36xojy"] + +[ext_resource type="Script" path="res://Stage/balloons.gd" id="1_fuioi"] +[ext_resource type="PackedScene" uid="uid://cuemoig58el4f" path="res://UI/hud.tscn" id="2_tsbp8"] +[ext_resource type="Texture2D" uid="uid://cyw52lkxbbnbb" path="res://UI/Assets/background.jpg" id="3_sh8m8"] +[ext_resource type="PackedScene" uid="uid://bn0h50n6fr6n1" path="res://Player/bow.tscn" id="4_0t5n3"] + +[node name="Balloons" type="Node2D"] +script = ExtResource("1_fuioi") + +[node name="HUD" parent="." instance=ExtResource("2_tsbp8")] + +[node name="Background" type="CanvasLayer" parent="."] +layer = -1 + +[node name="TextureRect" type="TextureRect" parent="Background"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_sh8m8") +expand_mode = 1 + +[node name="Bow" parent="." instance=ExtResource("4_0t5n3")] +position = Vector2(104, 152) + +[node name="SpawnTimer" type="Timer" parent="."] +wait_time = 0.5 +autostart = true + +[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"] diff --git a/Target/Assets/balloon-pop-01.wav b/Target/Assets/balloon-pop-01.wav new file mode 100644 index 0000000..b0f3e58 Binary files /dev/null and b/Target/Assets/balloon-pop-01.wav differ diff --git a/Target/Assets/balloon-pop-01.wav.import b/Target/Assets/balloon-pop-01.wav.import new file mode 100644 index 0000000..50b0fc9 --- /dev/null +++ b/Target/Assets/balloon-pop-01.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://2ysaqcfxhuhc" +path="res://.godot/imported/balloon-pop-01.wav-54d644f5f16010f4ae805ba450d8b07a.sample" + +[deps] + +source_file="res://Target/Assets/balloon-pop-01.wav" +dest_files=["res://.godot/imported/balloon-pop-01.wav-54d644f5f16010f4ae805ba450d8b07a.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Target/Assets/balloon-pop-02.wav b/Target/Assets/balloon-pop-02.wav new file mode 100644 index 0000000..4a3d7a6 Binary files /dev/null and b/Target/Assets/balloon-pop-02.wav differ diff --git a/Target/Assets/balloon-pop-02.wav.import b/Target/Assets/balloon-pop-02.wav.import new file mode 100644 index 0000000..142f6a0 --- /dev/null +++ b/Target/Assets/balloon-pop-02.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://13t4skh185gb" +path="res://.godot/imported/balloon-pop-02.wav-49b7c0363fe6daf1af7d80016db102d2.sample" + +[deps] + +source_file="res://Target/Assets/balloon-pop-02.wav" +dest_files=["res://.godot/imported/balloon-pop-02.wav-49b7c0363fe6daf1af7d80016db102d2.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Target/Assets/balloon-pop-03.wav b/Target/Assets/balloon-pop-03.wav new file mode 100644 index 0000000..9ce6a80 Binary files /dev/null and b/Target/Assets/balloon-pop-03.wav differ diff --git a/Target/Assets/balloon-pop-03.wav.import b/Target/Assets/balloon-pop-03.wav.import new file mode 100644 index 0000000..20c9913 --- /dev/null +++ b/Target/Assets/balloon-pop-03.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cyqg31tj3xxwv" +path="res://.godot/imported/balloon-pop-03.wav-93e3465c13f530ea62ebcb0479181009.sample" + +[deps] + +source_file="res://Target/Assets/balloon-pop-03.wav" +dest_files=["res://.godot/imported/balloon-pop-03.wav-93e3465c13f530ea62ebcb0479181009.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Target/Assets/balloon.kra b/Target/Assets/balloon.kra new file mode 100644 index 0000000..a9e1a07 Binary files /dev/null and b/Target/Assets/balloon.kra differ diff --git a/Target/Assets/balloon.kra~ b/Target/Assets/balloon.kra~ new file mode 100644 index 0000000..f2050de Binary files /dev/null and b/Target/Assets/balloon.kra~ differ diff --git a/Target/Assets/balloon.png b/Target/Assets/balloon.png new file mode 100644 index 0000000..3aee4b4 Binary files /dev/null and b/Target/Assets/balloon.png differ diff --git a/Target/Assets/balloon.png.import b/Target/Assets/balloon.png.import new file mode 100644 index 0000000..62aa172 --- /dev/null +++ b/Target/Assets/balloon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dv84uuaxgs8fc" +path="res://.godot/imported/balloon.png-295af647cd51cb409a91fc4900f0ec1c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Target/Assets/balloon.png" +dest_files=["res://.godot/imported/balloon.png-295af647cd51cb409a91fc4900f0ec1c.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/Target/Assets/balloon.png~ b/Target/Assets/balloon.png~ new file mode 100644 index 0000000..cf99359 Binary files /dev/null and b/Target/Assets/balloon.png~ differ diff --git a/Target/balloon.gd b/Target/balloon.gd new file mode 100644 index 0000000..af7a8bd --- /dev/null +++ b/Target/balloon.gd @@ -0,0 +1,40 @@ +extends CharacterBody2D + + +func _ready(): + if OS.has_feature("mobile"): + scale = Vector2(1.5, 1.5) + + var tween = create_tween() + tween.set_loops() + tween.tween_method(func(value): + $Line2D.set_point_position(2, Vector2(value, $Line2D.points[2].y)) + , -2, 2, randf_range(0.5, 1.5)).set_delay(0.01) + tween.tween_method(func(value): + $Line2D.set_point_position(2, Vector2(value, $Line2D.points[2].y)) + , 2, -2, randf_range(0.5, 1.5)).set_delay(0.01) + tween.tween_method(func(value): + $Line2D.set_point_position(3, Vector2(value, $Line2D.points[3].y)) + , -1, 1, randf_range(0.5, 1.5)).set_delay(0.01) + tween.tween_method(func(value): + $Line2D.set_point_position(3, Vector2(value, $Line2D.points[3].y)) + , 1, -1, randf_range(0.5, 1.5)).set_delay(0.01) + + +func _process(_delta: float) -> void: + move_and_slide() + + var collision := get_last_slide_collision() + if collision: + velocity = velocity.bounce(collision.get_normal()) + + +func _on_area_2d_area_entered(area: Area2D) -> void: + if area.is_in_group("arrow"): + Game.score += 1 + SoundManager.balloon.get_children().pick_random().play() + queue_free() + + +func _on_visible_on_screen_notifier_2d_screen_exited() -> void: + queue_free() diff --git a/Target/balloon.tscn b/Target/balloon.tscn new file mode 100644 index 0000000..f967a96 --- /dev/null +++ b/Target/balloon.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=4 format=3 uid="uid://blifc11rkfkkv"] + +[ext_resource type="Script" path="res://Target/balloon.gd" id="1_e3new"] +[ext_resource type="Texture2D" uid="uid://dv84uuaxgs8fc" path="res://Target/Assets/balloon.png" id="2_3oqak"] +[ext_resource type="Shape2D" uid="uid://da5k00qhu13tl" path="res://Target/balloon_shape.tres" id="3_d2kvr"] + +[node name="Balloon" type="CharacterBody2D"] +collision_layer = 0 +collision_mask = 8 +script = ExtResource("1_e3new") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +texture = ExtResource("2_3oqak") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = ExtResource("3_d2kvr") + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 4 +collision_mask = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = ExtResource("3_d2kvr") +debug_color = Color(0.561074, 0.559604, 0, 0.42) + +[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] +position = Vector2(4.76837e-07, 1.19209e-07) +scale = Vector2(0.6, 0.7) + +[node name="Line2D" type="Line2D" parent="."] +position = Vector2(0, -1) +points = PackedVector2Array(0, 7, -1, 10, 2, 12, 0, 15) +width = 1.0 + +[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"] +[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"] diff --git a/Target/balloon_shape.tres b/Target/balloon_shape.tres new file mode 100644 index 0000000..05f5dbe --- /dev/null +++ b/Target/balloon_shape.tres @@ -0,0 +1,5 @@ +[gd_resource type="CapsuleShape2D" format=3 uid="uid://da5k00qhu13tl"] + +[resource] +radius = 6.0 +height = 14.0 diff --git a/UI/Assets/background.jpg b/UI/Assets/background.jpg new file mode 100644 index 0000000..90789b6 Binary files /dev/null and b/UI/Assets/background.jpg differ diff --git a/UI/Assets/background.jpg.import b/UI/Assets/background.jpg.import new file mode 100644 index 0000000..61ab5dc --- /dev/null +++ b/UI/Assets/background.jpg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cyw52lkxbbnbb" +path="res://.godot/imported/background.jpg-7ab479536167978b65a746ec270a1959.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/background.jpg" +dest_files=["res://.godot/imported/background.jpg-7ab479536167978b65a746ec270a1959.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/UI/hud.gd b/UI/hud.gd new file mode 100644 index 0000000..d5f7cc3 --- /dev/null +++ b/UI/hud.gd @@ -0,0 +1,7 @@ +extends CanvasLayer + + +func _ready() -> void: + Game.score_changed.connect(func(): + %Score.text = str(Game.score) + ) diff --git a/UI/hud.tscn b/UI/hud.tscn new file mode 100644 index 0000000..e02d9dd --- /dev/null +++ b/UI/hud.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=2 format=3 uid="uid://cuemoig58el4f"] + +[ext_resource type="Script" path="res://UI/hud.gd" id="1_ip2w4"] + +[node name="HUD" type="CanvasLayer"] +script = ExtResource("1_ip2w4") + +[node name="MarginContainer" type="MarginContainer" parent="."] +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 + +[node name="Score" type="Label" parent="MarginContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +text = "0" diff --git a/UI/start.gd b/UI/start.gd new file mode 100644 index 0000000..5290112 --- /dev/null +++ b/UI/start.gd @@ -0,0 +1,5 @@ +extends Control + + +func _on_balloons_button_pressed() -> void: + get_tree().change_scene_to_file("res://Stage/balloons.tscn") diff --git a/UI/start.tscn b/UI/start.tscn new file mode 100644 index 0000000..bd02fd2 --- /dev/null +++ b/UI/start.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=2 format=3 uid="uid://b20e404dx8nk1"] + +[ext_resource type="Script" path="res://UI/start.gd" id="1_6l74h"] + +[node name="Start" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_6l74h") + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] +layout_mode = 2 + +[node name="BalloonsButton" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Balloons" + +[node name="ForestButton" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Forest" + +[connection signal="pressed" from="CenterContainer/VBoxContainer/BalloonsButton" to="." method="_on_balloons_button_pressed"] diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..41d2d8f --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,207 @@ +[preset.0] + +name="Android" +platform="Android" +runnable=true +advanced_options=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../../../Applications/Godot/bow-arrow.apk" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +gradle_build/use_gradle_build=false +gradle_build/gradle_build_directory="" +gradle_build/android_source_template="" +gradle_build/compress_native_libraries=false +gradle_build/export_format=0 +gradle_build/min_sdk="" +gradle_build/target_sdk="" +architectures/armeabi-v7a=false +architectures/arm64-v8a=true +architectures/x86=false +architectures/x86_64=false +version/code=1 +version/name="" +package/unique_name="com.example.$genname" +package/name="Bow & Arrow" +package/signed=true +package/app_category=2 +package/retain_data_on_uninstall=false +package/exclude_from_recents=false +package/show_in_android_tv=false +package/show_in_app_library=true +package/show_as_launcher_app=false +launcher_icons/main_192x192="" +launcher_icons/adaptive_foreground_432x432="" +launcher_icons/adaptive_background_432x432="" +graphics/opengl_debug=false +xr_features/xr_mode=0 +screen/immersive_mode=true +screen/support_small=true +screen/support_normal=true +screen/support_large=true +screen/support_xlarge=true +user_data_backup/allow=false +command_line/extra_args="" +apk_expansion/enable=false +apk_expansion/SALT="" +apk_expansion/public_key="" +permissions/custom_permissions=PackedStringArray() +permissions/access_checkin_properties=false +permissions/access_coarse_location=false +permissions/access_fine_location=false +permissions/access_location_extra_commands=false +permissions/access_mock_location=false +permissions/access_network_state=false +permissions/access_surface_flinger=false +permissions/access_wifi_state=false +permissions/account_manager=false +permissions/add_voicemail=false +permissions/authenticate_accounts=false +permissions/battery_stats=false +permissions/bind_accessibility_service=false +permissions/bind_appwidget=false +permissions/bind_device_admin=false +permissions/bind_input_method=false +permissions/bind_nfc_service=false +permissions/bind_notification_listener_service=false +permissions/bind_print_service=false +permissions/bind_remoteviews=false +permissions/bind_text_service=false +permissions/bind_vpn_service=false +permissions/bind_wallpaper=false +permissions/bluetooth=false +permissions/bluetooth_admin=false +permissions/bluetooth_privileged=false +permissions/brick=false +permissions/broadcast_package_removed=false +permissions/broadcast_sms=false +permissions/broadcast_sticky=false +permissions/broadcast_wap_push=false +permissions/call_phone=false +permissions/call_privileged=false +permissions/camera=false +permissions/capture_audio_output=false +permissions/capture_secure_video_output=false +permissions/capture_video_output=false +permissions/change_component_enabled_state=false +permissions/change_configuration=false +permissions/change_network_state=false +permissions/change_wifi_multicast_state=false +permissions/change_wifi_state=false +permissions/clear_app_cache=false +permissions/clear_app_user_data=false +permissions/control_location_updates=false +permissions/delete_cache_files=false +permissions/delete_packages=false +permissions/device_power=false +permissions/diagnostic=false +permissions/disable_keyguard=false +permissions/dump=false +permissions/expand_status_bar=false +permissions/factory_test=false +permissions/flashlight=false +permissions/force_back=false +permissions/get_accounts=false +permissions/get_package_size=false +permissions/get_tasks=false +permissions/get_top_activity_info=false +permissions/global_search=false +permissions/hardware_test=false +permissions/inject_events=false +permissions/install_location_provider=false +permissions/install_packages=false +permissions/install_shortcut=false +permissions/internal_system_window=false +permissions/internet=false +permissions/kill_background_processes=false +permissions/location_hardware=false +permissions/manage_accounts=false +permissions/manage_app_tokens=false +permissions/manage_documents=false +permissions/manage_external_storage=false +permissions/master_clear=false +permissions/media_content_control=false +permissions/modify_audio_settings=false +permissions/modify_phone_state=false +permissions/mount_format_filesystems=false +permissions/mount_unmount_filesystems=false +permissions/nfc=false +permissions/persistent_activity=false +permissions/post_notifications=false +permissions/process_outgoing_calls=false +permissions/read_calendar=false +permissions/read_call_log=false +permissions/read_contacts=false +permissions/read_external_storage=false +permissions/read_frame_buffer=false +permissions/read_history_bookmarks=false +permissions/read_input_state=false +permissions/read_logs=false +permissions/read_phone_state=false +permissions/read_profile=false +permissions/read_sms=false +permissions/read_social_stream=false +permissions/read_sync_settings=false +permissions/read_sync_stats=false +permissions/read_user_dictionary=false +permissions/reboot=false +permissions/receive_boot_completed=false +permissions/receive_mms=false +permissions/receive_sms=false +permissions/receive_wap_push=false +permissions/record_audio=false +permissions/reorder_tasks=false +permissions/restart_packages=false +permissions/send_respond_via_message=false +permissions/send_sms=false +permissions/set_activity_watcher=false +permissions/set_alarm=false +permissions/set_always_finish=false +permissions/set_animation_scale=false +permissions/set_debug_app=false +permissions/set_orientation=false +permissions/set_pointer_speed=false +permissions/set_preferred_applications=false +permissions/set_process_limit=false +permissions/set_time=false +permissions/set_time_zone=false +permissions/set_wallpaper=false +permissions/set_wallpaper_hints=false +permissions/signal_persistent_processes=false +permissions/status_bar=false +permissions/subscribed_feeds_read=false +permissions/subscribed_feeds_write=false +permissions/system_alert_window=false +permissions/transmit_ir=false +permissions/uninstall_shortcut=false +permissions/update_device_stats=false +permissions/use_credentials=false +permissions/use_sip=false +permissions/vibrate=false +permissions/wake_lock=false +permissions/write_apn_settings=false +permissions/write_calendar=false +permissions/write_call_log=false +permissions/write_contacts=false +permissions/write_external_storage=false +permissions/write_gservices=false +permissions/write_history_bookmarks=false +permissions/write_profile=false +permissions/write_secure_settings=false +permissions/write_settings=false +permissions/write_sms=false +permissions/write_social_stream=false +permissions/write_sync_settings=false +permissions/write_user_dictionary=false diff --git a/game.gd b/game.gd new file mode 100644 index 0000000..42de6e9 --- /dev/null +++ b/game.gd @@ -0,0 +1,8 @@ +extends Node + + +signal score_changed +var score := 0 : + set(value): + score = value + score_changed.emit() diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..c3b8dec --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ytg33mbgtm5e" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..801dbc1 --- /dev/null +++ b/project.godot @@ -0,0 +1,50 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="bow-arrow" +run/main_scene="res://UI/start.tscn" +config/features=PackedStringArray("4.3", "Mobile") +config/icon="res://icon.svg" + +[autoload] + +Game="*res://Game.tscn" +SoundManager="*res://SoundManager.tscn" + +[display] + +window/size/viewport_width=210 +window/size/viewport_height=300 +window/stretch/mode="viewport" +window/stretch/aspect="expand" +window/handheld/orientation=1 + +[input] + +click={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(234, 6),"global_position":Vector2(243, 52),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[layer_names] + +2d_physics/layer_1="Player" +2d_physics/layer_2="Arrow" +2d_physics/layer_3="Target" +2d_physics/layer_4="Wall" + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +textures/vram_compression/import_etc2_astc=true diff --git a/sound_manager.gd b/sound_manager.gd new file mode 100644 index 0000000..5978383 --- /dev/null +++ b/sound_manager.gd @@ -0,0 +1,7 @@ +extends Node + + +@onready var balloon: Node = $Balloon +@onready var balloon_pop_01: AudioStreamPlayer = $"Balloon/Balloon-pop-01" +@onready var balloon_pop_02: AudioStreamPlayer = $"Balloon/Balloon-pop-02" +@onready var balloon_pop_03: AudioStreamPlayer = $"Balloon/Balloon-pop-03" -- cgit v1.2.3