From cbdf446e736fac759659b9689ea7150598cd74d9 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sun, 6 Sep 2020 23:02:19 +0300 Subject: [PATCH] Initial commit --- README.md | 32 ++- entities/avenger/avenger.png | Bin 0 -> 231 bytes entities/avenger/avenger.png.import | 34 +++ entities/bullet/bullet.gd | 15 ++ entities/bullet/bullet.png | Bin 0 -> 87 bytes entities/bullet/bullet.png.import | 34 +++ entities/bullet/bullet.tscn | 26 ++ entities/enemy.gd | 55 ++++ entities/meteorite/meteor_big_1.png | Bin 0 -> 162 bytes entities/meteorite/meteor_big_1.png.import | 34 +++ entities/meteorite/meteor_big_2.png | Bin 0 -> 153 bytes entities/meteorite/meteor_big_2.png.import | 34 +++ entities/meteorite/meteor_big_3.png | Bin 0 -> 162 bytes entities/meteorite/meteor_big_3.png.import | 34 +++ entities/meteorite/meteor_small_1.png | Bin 0 -> 114 bytes entities/meteorite/meteor_small_1.png.import | 34 +++ entities/meteorite/meteor_small_2.png | Bin 0 -> 111 bytes entities/meteorite/meteor_small_2.png.import | 34 +++ entities/meteorite/meteor_small_3.png | Bin 0 -> 114 bytes entities/meteorite/meteor_small_3.png.import | 34 +++ entities/meteorite/meteorite.gd | 19 ++ entities/meteorite/meteorite.tscn | 28 +++ entities/pellett/pellett.gd | 15 ++ entities/pellett/pellett.png | Bin 0 -> 111 bytes entities/pellett/pellett.png.import | 34 +++ entities/pellett/pellett.tscn | 22 ++ entities/player/player.gd | 119 +++++++++ entities/player/player.tscn | 36 +++ entities/player/player_ship.png | Bin 0 -> 192 bytes entities/player/player_ship.png.import | 34 +++ entities/player/player_ship_iframe.png | Bin 0 -> 186 bytes entities/player/player_ship_iframe.png.import | 34 +++ entities/powerups/double/double.png | Bin 0 -> 114 bytes entities/powerups/double/double.png.import | 34 +++ entities/powerups/double/double.tscn | 24 ++ entities/powerups/laser/laser.png | Bin 0 -> 120 bytes entities/powerups/laser/laser.png.import | 34 +++ entities/powerups/laser/laser.tscn | 24 ++ entities/powerups/powerup.gd | 36 +++ entities/ufo/ufo.gd | 48 ++++ entities/ufo/ufo.png | Bin 0 -> 198 bytes entities/ufo/ufo.png.import | 34 +++ entities/ufo/ufo.tscn | 28 +++ entities/viper/viper.gd | 18 ++ entities/viper/viper.png | Bin 0 -> 216 bytes entities/viper/viper.png.import | 34 +++ entities/viper/viper.tscn | 26 ++ globals/default_env.tres | 7 + globals/global.gd | 48 ++++ levels/demo.tscn | 54 ++++ levels/level.gd | 19 ++ levels/wave.gd | 21 ++ levels/waves/one_ufo.tscn | 13 + levels/waves/one_viper_01.tscn | 11 + levels/waves/one_viper_02.tscn | 11 + levels/waves/one_viper_03.tscn | 11 + levels/waves/one_viper_one_ufo_01.tscn | 19 ++ levels/waves/three_viper_01.tscn | 17 ++ levels/waves/two_ufo_easy.tscn | 16 ++ levels/waves/two_ufo_hard.tscn | 24 ++ levels/waves/two_viper_01.tscn | 14 ++ levels/waves/two_viper_02.tscn | 16 ++ levels/waves/two_viper_03.tscn | 15 ++ objects/explosion/explosion.gd | 7 + objects/explosion/explosion.png | Bin 0 -> 765 bytes objects/explosion/explosion.png.import | 34 +++ objects/explosion/explosion.tscn | 49 ++++ objects/spawner/spawner.gd | 24 ++ objects/spawner/spawner.tscn | 6 + project.godot | 144 +++++++++++ ui/Kenney Mini.ttf | Bin 0 -> 26156 bytes ui/background.png | Bin 0 -> 78 bytes ui/background.png.import | 34 +++ ui/empty.png | Bin 0 -> 88 bytes ui/empty.png.import | 34 +++ ui/game_over/game_over.gd | 39 +++ ui/game_over/game_over.tscn | 115 +++++++++ ui/hiscores/highscores_list.gd | 22 ++ ui/hiscores/hiscores.tscn | 238 ++++++++++++++++++ ui/hud/hud.gd | 24 ++ ui/hud/hud.tscn | 86 +++++++ ui/kenny_mini_16px.tres | 6 + ui/kenny_mini_8px.tres | 7 + ui/life.png | Bin 0 -> 114 bytes ui/life.png.import | 34 +++ ui/main_menu/caret_1.png | Bin 0 -> 105 bytes ui/main_menu/caret_1.png.import | 34 +++ ui/main_menu/caret_2.png | Bin 0 -> 105 bytes ui/main_menu/caret_2.png.import | 34 +++ ui/main_menu/main_menu.tscn | 102 ++++++++ ui/main_menu/menu.gd | 52 ++++ ui/name_selector/name_selector.gd | 53 ++++ ui/name_selector/name_selector.tscn | 63 +++++ ui/name_selector/selected.png.import | 34 +++ ui/name_selector/selected_1.png | Bin 0 -> 118 bytes ui/name_selector/selected_1.png.import | 34 +++ ui/name_selector/selected_2.png | Bin 0 -> 111 bytes ui/name_selector/selected_2.png.import | 34 +++ ui/pixelated_style.tres | 14 ++ ui/special.png | Bin 0 -> 99 bytes ui/special.png.import | 34 +++ weapons/default/default.gd | 4 + weapons/default/default.tscn | 10 + weapons/double/double.gd | 20 ++ weapons/double/double.tscn | 8 + weapons/laser/laser.gd | 12 + weapons/laser/laser.tscn | 8 + weapons/weapon.gd | 24 ++ 108 files changed, 2873 insertions(+), 1 deletion(-) create mode 100644 entities/avenger/avenger.png create mode 100644 entities/avenger/avenger.png.import create mode 100644 entities/bullet/bullet.gd create mode 100644 entities/bullet/bullet.png create mode 100644 entities/bullet/bullet.png.import create mode 100644 entities/bullet/bullet.tscn create mode 100644 entities/enemy.gd create mode 100644 entities/meteorite/meteor_big_1.png create mode 100644 entities/meteorite/meteor_big_1.png.import create mode 100644 entities/meteorite/meteor_big_2.png create mode 100644 entities/meteorite/meteor_big_2.png.import create mode 100644 entities/meteorite/meteor_big_3.png create mode 100644 entities/meteorite/meteor_big_3.png.import create mode 100644 entities/meteorite/meteor_small_1.png create mode 100644 entities/meteorite/meteor_small_1.png.import create mode 100644 entities/meteorite/meteor_small_2.png create mode 100644 entities/meteorite/meteor_small_2.png.import create mode 100644 entities/meteorite/meteor_small_3.png create mode 100644 entities/meteorite/meteor_small_3.png.import create mode 100644 entities/meteorite/meteorite.gd create mode 100644 entities/meteorite/meteorite.tscn create mode 100644 entities/pellett/pellett.gd create mode 100644 entities/pellett/pellett.png create mode 100644 entities/pellett/pellett.png.import create mode 100644 entities/pellett/pellett.tscn create mode 100644 entities/player/player.gd create mode 100644 entities/player/player.tscn create mode 100644 entities/player/player_ship.png create mode 100644 entities/player/player_ship.png.import create mode 100644 entities/player/player_ship_iframe.png create mode 100644 entities/player/player_ship_iframe.png.import create mode 100644 entities/powerups/double/double.png create mode 100644 entities/powerups/double/double.png.import create mode 100644 entities/powerups/double/double.tscn create mode 100644 entities/powerups/laser/laser.png create mode 100644 entities/powerups/laser/laser.png.import create mode 100644 entities/powerups/laser/laser.tscn create mode 100644 entities/powerups/powerup.gd create mode 100644 entities/ufo/ufo.gd create mode 100644 entities/ufo/ufo.png create mode 100644 entities/ufo/ufo.png.import create mode 100644 entities/ufo/ufo.tscn create mode 100644 entities/viper/viper.gd create mode 100644 entities/viper/viper.png create mode 100644 entities/viper/viper.png.import create mode 100644 entities/viper/viper.tscn create mode 100644 globals/default_env.tres create mode 100644 globals/global.gd create mode 100644 levels/demo.tscn create mode 100644 levels/level.gd create mode 100644 levels/wave.gd create mode 100644 levels/waves/one_ufo.tscn create mode 100644 levels/waves/one_viper_01.tscn create mode 100644 levels/waves/one_viper_02.tscn create mode 100644 levels/waves/one_viper_03.tscn create mode 100644 levels/waves/one_viper_one_ufo_01.tscn create mode 100644 levels/waves/three_viper_01.tscn create mode 100644 levels/waves/two_ufo_easy.tscn create mode 100644 levels/waves/two_ufo_hard.tscn create mode 100644 levels/waves/two_viper_01.tscn create mode 100644 levels/waves/two_viper_02.tscn create mode 100644 levels/waves/two_viper_03.tscn create mode 100644 objects/explosion/explosion.gd create mode 100644 objects/explosion/explosion.png create mode 100644 objects/explosion/explosion.png.import create mode 100644 objects/explosion/explosion.tscn create mode 100644 objects/spawner/spawner.gd create mode 100644 objects/spawner/spawner.tscn create mode 100644 project.godot create mode 100644 ui/Kenney Mini.ttf create mode 100644 ui/background.png create mode 100644 ui/background.png.import create mode 100644 ui/empty.png create mode 100644 ui/empty.png.import create mode 100644 ui/game_over/game_over.gd create mode 100644 ui/game_over/game_over.tscn create mode 100644 ui/hiscores/highscores_list.gd create mode 100644 ui/hiscores/hiscores.tscn create mode 100644 ui/hud/hud.gd create mode 100644 ui/hud/hud.tscn create mode 100644 ui/kenny_mini_16px.tres create mode 100644 ui/kenny_mini_8px.tres create mode 100644 ui/life.png create mode 100644 ui/life.png.import create mode 100644 ui/main_menu/caret_1.png create mode 100644 ui/main_menu/caret_1.png.import create mode 100644 ui/main_menu/caret_2.png create mode 100644 ui/main_menu/caret_2.png.import create mode 100644 ui/main_menu/main_menu.tscn create mode 100644 ui/main_menu/menu.gd create mode 100644 ui/name_selector/name_selector.gd create mode 100644 ui/name_selector/name_selector.tscn create mode 100644 ui/name_selector/selected.png.import create mode 100644 ui/name_selector/selected_1.png create mode 100644 ui/name_selector/selected_1.png.import create mode 100644 ui/name_selector/selected_2.png create mode 100644 ui/name_selector/selected_2.png.import create mode 100644 ui/pixelated_style.tres create mode 100644 ui/special.png create mode 100644 ui/special.png.import create mode 100644 weapons/default/default.gd create mode 100644 weapons/default/default.tscn create mode 100644 weapons/double/double.gd create mode 100644 weapons/double/double.tscn create mode 100644 weapons/laser/laser.gd create mode 100644 weapons/laser/laser.tscn create mode 100644 weapons/weapon.gd diff --git a/README.md b/README.md index 225befc..e2762a3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,32 @@ # evospace -Short and noob friendly bullet hell for GBJAM 8 +Short and noob friendly bullet hell for [GBJAM 8](https://itch.io/jam/gbjam-8) + +## Controls: + +* Arrow Keys - Movement +* Z - Shooting +* X - Bomb + +## Colors used: +* #000000 +* #4D4D4D +* #999999 +* #FFFFFF + +## Extra Info: +* You have 3 lives and 120 seconds to survive an ongoing assault. +* You get 3 bombs and no extras, bombs destroy all enemies on screen so use them carefully +* At 10.000 points you get an extra life +* At the end of the round every life you still have will grant 2000 points and every bomb 1000 points +* Enemies will drop 2 types of power ups: + * Double - shoots 2 lasers with the same power and slightly faster cooldown + * Fast - shoots 1 laser without cooldown but significantly less damage than the standard laser + +## Credits :​ + +Ships and asteroids are recolorings and at times slightly changed versions of Kenney's Space Shooter Redux pack: +[https://www.kenney.nl/assets/space-shooter-redux](https://www.kenney.nl/assets/space-shooter-redux) + +Name taken from Fantasy Name Generators website: +[https://www.fantasynamegenerators.com/video-game-names.php](https://www.fantasynamegenerators.com/video-game-names.php) +​ \ No newline at end of file diff --git a/entities/avenger/avenger.png b/entities/avenger/avenger.png new file mode 100644 index 0000000000000000000000000000000000000000..0511574cbc611b909bc7a404bdccb7a48eea6d5c GIT binary patch literal 231 zcmVNPx**HG`*29qJPEVP@}KY@85U`~IY9O=gxFZT7`-PoJa3T*-lx&Xe3 z0b_^)Al`eYQi}UB_5pGLESCEx0Q&`!tr!84ZO)lmYo{84iVX)z4uBm`0f=(}HlxkX zRcH^QD!lSxJ3T-XJphlw^M`=7mNu7XUu)IvlxHb`s}M0nm=G_HKp>X5OR$v50B@T@ hz^|V&{Ebh6Z>GwLZ>*ukp8x;=07*qoM6N<$f&dTmS*rj5 literal 0 HcmV?d00001 diff --git a/entities/avenger/avenger.png.import b/entities/avenger/avenger.png.import new file mode 100644 index 0000000..f02a0cb --- /dev/null +++ b/entities/avenger/avenger.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/avenger.png-e1dc08e70c6a7b4dbe97994572bffa1a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/avenger/avenger.png" +dest_files=[ "res://.import/avenger.png-e1dc08e70c6a7b4dbe97994572bffa1a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/bullet/bullet.gd b/entities/bullet/bullet.gd new file mode 100644 index 0000000..92597e7 --- /dev/null +++ b/entities/bullet/bullet.gd @@ -0,0 +1,15 @@ +extends KinematicBody2D + +var damage = 1.0 +var velocity = Vector2() + +func _physics_process(delta): + var collision_info = move_and_collide(velocity) + if collision_info: + var collision_point = collision_info.position + if(collision_info.collider is Enemy): + (collision_info.collider as Enemy).damage(damage) + queue_free() + +func _on_visiblity_notifier_screen_exited(): + queue_free() diff --git a/entities/bullet/bullet.png b/entities/bullet/bullet.png new file mode 100644 index 0000000000000000000000000000000000000000..ced3c6174883bd2b5d01f6bbcdd8b914bea478db GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqa-J@ZAsWHSDGp5kfq?&!5fB_| hdB`*2z=u!x@Au1 z<#QWY4h8UN+JE-KwQuG6 z)LWaj_}o#y7x6qJFN-mp_2(v0gW}CaN?h5~o%vnwR$dfINzj)u65Mk@tC{5zW6|&D zOue6f39f&hVBYB6vuk7LoC5(1oTs+B+y0TZw(2sv&2DeF9%vVXr>mdKI;Vst0L*?j AUH||9 literal 0 HcmV?d00001 diff --git a/entities/meteorite/meteor_big_2.png.import b/entities/meteorite/meteor_big_2.png.import new file mode 100644 index 0000000..9b7040f --- /dev/null +++ b/entities/meteorite/meteor_big_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/meteor_big_2.png-7b908137aa9e737d444eb33ccf4e97b4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/meteorite/meteor_big_2.png" +dest_files=[ "res://.import/meteor_big_2.png-7b908137aa9e737d444eb33ccf4e97b4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/meteorite/meteor_big_3.png b/entities/meteorite/meteor_big_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4ebe77f170ed2363c760bcd57e250e1d5ab2b562 GIT binary patch literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`>7Fi*Ar}5eFMD$_C~&Y`uvwe_ zX-jM4MgG}2fu{@PCVIX6C@@QW;+Zqve~T8j%2_Eh7jQ}6QRa0xY#h{hyP*FM>lam# z+I?+bjSn}JD*a(+F1X$KR%Stmbtgv=OO8j`-NtF0cl}mtU;ANp`(j(-Q=pX$p00i_ K>zopr7#IMQ@;g}o literal 0 HcmV?d00001 diff --git a/entities/meteorite/meteor_big_3.png.import b/entities/meteorite/meteor_big_3.png.import new file mode 100644 index 0000000..807c028 --- /dev/null +++ b/entities/meteorite/meteor_big_3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/meteor_big_3.png-88972c75241a59c653113008a9f5c126.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/meteorite/meteor_big_3.png" +dest_files=[ "res://.import/meteor_big_3.png-88972c75241a59c653113008a9f5c126.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/meteorite/meteor_small_1.png b/entities/meteorite/meteor_small_1.png new file mode 100644 index 0000000000000000000000000000000000000000..a86889231eca984f233a78e3822d32f7cf319243 GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqmYyz-AsWHSDGp4=>F56NKU%hY zx$&WvhdeV>HnB}`+Q5`EsX+LHXOqZ7)5Zm&1*|*nG%jL@6+E+=!S%W9-03B%KrXRyss+Q3xenc{jx^FSI`m#BgAM=PP}`HWv4NN}1@{{IbV0E4HipUXO@ HgeC?6Wl|zK literal 0 HcmV?d00001 diff --git a/entities/pellett/pellett.png.import b/entities/pellett/pellett.png.import new file mode 100644 index 0000000..7a8857a --- /dev/null +++ b/entities/pellett/pellett.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pellett.png-7761fcbb1c76550f372176a149794ae3.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/pellett/pellett.png" +dest_files=[ "res://.import/pellett.png-7761fcbb1c76550f372176a149794ae3.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/pellett/pellett.tscn b/entities/pellett/pellett.tscn new file mode 100644 index 0000000..dd15e57 --- /dev/null +++ b/entities/pellett/pellett.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://entities/pellett/pellett.png" type="Texture" id=1] +[ext_resource path="res://entities/pellett/pellett.gd" type="Script" id=2] + +[sub_resource type="CircleShape2D" id=1] +radius = 2.33548 + +[node name="pellett" type="KinematicBody2D" groups=[ +"Enemies", +]] +collision_layer = 16 +script = ExtResource( 2 ) + +[node name="texture" type="Sprite" parent="."] +texture = ExtResource( 1 ) + +[node name="collision" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="visiblity_notifier" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="visiblity_notifier" to="." method="_on_visiblity_notifier_screen_exited"] diff --git a/entities/player/player.gd b/entities/player/player.gd new file mode 100644 index 0000000..1b27eff --- /dev/null +++ b/entities/player/player.gd @@ -0,0 +1,119 @@ +extends KinematicBody2D +class_name Player + +export (float) var speed = 1.3 +export (Resource) var weapon = load("weapons/default/default.tscn") +export (int) var lives = 2 +export (int) var bombs = 3 + +var velocity = Vector2() +var score = 0 +var hiscore = 0 +var hud +var iframe = false +onready var iframe_timer = $iframe_timer +onready var sprite = $sprite +var explosion_resource = preload("res://objects/explosion/explosion.tscn") +var collision_info +var game_over_screen = preload("res://ui/game_over/game_over.tscn") +var level +var extra_lives = 0 + +func _ready(): + level = get_tree().get_root().get_node("level") + hud = get_parent().get_node("hud") + update_weapon() + +func _physics_process(delta): + get_input() + collision_info = move_and_collide(velocity) + if collision_info: + if collision_info.collider.has_method("kill"): + collision_info.collider.kill() + kill() + if collision_info.collider.has_method("reward"): + collision_info.collider.reward(self) + +func get_input(): + velocity = Vector2() + if Input.is_action_pressed("ui_right") && position.x < ProjectSettings.get("display/window/size/width") - 9: + velocity.x += 1 + if Input.is_action_pressed("ui_left") && position.x > 10: + velocity.x -= 1 + if Input.is_action_pressed("ui_up") && position.y > 7: + velocity.y -= 1 + if Input.is_action_pressed("ui_down") && position.y < ProjectSettings.get("display/window/size/height") - 16: + velocity.y += 1 + velocity = velocity.normalized() * speed + + if Input.is_action_pressed("player_shoot"): + shoot() + elif Input.is_action_just_pressed("player_special"): + special() + + if Input.is_key_pressed(KEY_1): + weapon = load("weapons/default/default.tscn") + update_weapon() + if Input.is_key_pressed(KEY_2): + weapon = load("weapons/double/double.tscn") + update_weapon() + if Input.is_key_pressed(KEY_3): + weapon = load("weapons/laser/laser.tscn") + update_weapon() + +func shoot(): + if weapon.has_method("shoot"): + weapon.shoot() + +func special(): + if bombs <= 0: + return + bombs -= 1 + for node in get_tree().get_nodes_in_group("Enemies"): + if node.has_method("kill"): + node.kill(true) + else: + node.queue_free() + +func update_weapon(): + if weapon.get_class() != "PackedScene": + weapon.queue_free() + weapon = weapon.instance() + weapon.player = self + add_child(weapon) + +func increase_score(points): + score += points + if score / 10000 >= 1 + extra_lives: + lives += 1 + extra_lives += 1 + hud.update_labels() + +func kill(end_game: bool = false): + if !iframe: + lives -= 1 + hud.update_labels() + iframe = true + var explosion = explosion_resource.instance() + explosion.position = position + level.add_child(explosion) + position = Vector2(80, 123) + sprite.play("iframe") + iframe_timer.start() + if lives < 0 || end_game: + score += bombs * 1000 + score += lives * 2000 + if hiscore == 0: + hiscore = score + elif score > hiscore: + hiscore = score + var game_over = game_over_screen.instance() + game_over.score = score + game_over.hiscore = hiscore + level.queue_free() + get_tree().get_root().add_child(game_over) + +func _on_iframe_timer_timeout(): + iframe = false + sprite.frame = 0 + sprite.stop() diff --git a/entities/player/player.tscn b/entities/player/player.tscn new file mode 100644 index 0000000..002a096 --- /dev/null +++ b/entities/player/player.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://entities/player/player_ship.png" type="Texture" id=1] +[ext_resource path="res://entities/player/player.gd" type="Script" id=2] +[ext_resource path="res://entities/player/player_ship_iframe.png" type="Texture" id=3] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 1 ), ExtResource( 3 ) ], +"loop": true, +"name": "iframe", +"speed": 5.0 +} ] + +[sub_resource type="CapsuleShape2D" id=2] +radius = 2.42166 +height = 0.939134 + +[node name="player_ship" type="KinematicBody2D"] +collision_mask = 2147483660 +script = ExtResource( 2 ) +__meta__ = { +"_edit_group_": true +} + +[node name="sprite" type="AnimatedSprite" parent="."] +frames = SubResource( 1 ) +animation = "iframe" + +[node name="collision" type="CollisionShape2D" parent="."] +position = Vector2( -0.0910168, 3.14083 ) +shape = SubResource( 2 ) + +[node name="iframe_timer" type="Timer" parent="."] +wait_time = 3.0 +[connection signal="timeout" from="iframe_timer" to="." method="_on_iframe_timer_timeout"] diff --git a/entities/player/player_ship.png b/entities/player/player_ship.png new file mode 100644 index 0000000000000000000000000000000000000000..ba68d6060ec055c171d80ed6f42025177a4db24f GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`t)4E9Ar}5;Ctu_|pupo&YJXPh z+!Lu;e|5wIoHBk1xBOCG@qLoD>GB6B9BX%Rzu2o^awDpkd#AL3@n#F1r8_3fXWCYt zd+@Z<^{DG}K1bY4;?OzZv_O=>X%q7!!!{k^i7Y?Mo(V5tEoVI8P<{Phx%f6_8@-bU rese!;XED%9xVAloyUqSG^KY~Gex=@j@O1TaS?83{#J~UmPMb*+ literal 0 HcmV?d00001 diff --git a/entities/player/player_ship.png.import b/entities/player/player_ship.png.import new file mode 100644 index 0000000..862b130 --- /dev/null +++ b/entities/player/player_ship.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/player_ship.png-76cc9570d03ee0d2b47c69cb84bafbe9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/player/player_ship.png" +dest_files=[ "res://.import/player_ship.png-76cc9570d03ee0d2b47c69cb84bafbe9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/player/player_ship_iframe.png b/entities/player/player_ship_iframe.png new file mode 100644 index 0000000000000000000000000000000000000000..15f8aa2f10da78bda93f8241802edbba415ae30f GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`^`0({Ar}5;CkJvdC~~-bZm8_x zyK4BVK~H%{$C}ekEVtd|ug;$1xKdPH^k-Svg711O3f|AHn-a$mm%Y+C&Cj(?E8*VW zRvm63LB&P4yACoeau5j=lXmLj{xB!F|G0$IlgqQi8TsdkI-vW(%V_=$VY>C6nzlC?Px9$}CM P8pYu0>gTe~DWM4f*rX+L literal 0 HcmV?d00001 diff --git a/entities/powerups/laser/laser.png.import b/entities/powerups/laser/laser.png.import new file mode 100644 index 0000000..5bd8a35 --- /dev/null +++ b/entities/powerups/laser/laser.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/laser.png-3d3e2fdc2b041edf05a8817a5670b160.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/powerups/laser/laser.png" +dest_files=[ "res://.import/laser.png-3d3e2fdc2b041edf05a8817a5670b160.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/entities/powerups/laser/laser.tscn b/entities/powerups/laser/laser.tscn new file mode 100644 index 0000000..7ddeed1 --- /dev/null +++ b/entities/powerups/laser/laser.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://weapons/laser/laser.tscn" type="PackedScene" id=1] +[ext_resource path="res://entities/powerups/powerup.gd" type="Script" id=2] +[ext_resource path="res://entities/powerups/laser/laser.png" type="Texture" id=3] + +[sub_resource type="CircleShape2D" id=1] +radius = 4.91787 + +[node name="powerup" type="KinematicBody2D"] +collision_layer = 8 +collision_mask = 8 +script = ExtResource( 2 ) +weapon = ExtResource( 1 ) + +[node name="collision" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="texture" type="Sprite" parent="."] +position = Vector2( -0.0625, 0.75 ) +texture = ExtResource( 3 ) + +[node name="visiblity_notifier" type="VisibilityNotifier2D" parent="."] +[connection signal="screen_exited" from="visiblity_notifier" to="." method="_on_visiblity_notifier_screen_exited"] diff --git a/entities/powerups/powerup.gd b/entities/powerups/powerup.gd new file mode 100644 index 0000000..cf02ad3 --- /dev/null +++ b/entities/powerups/powerup.gd @@ -0,0 +1,36 @@ +extends KinematicBody2D + +export (Resource) var weapon + +var rng = RandomNumberGenerator.new() +var speed +var velocity = Vector2(0, 0.2) +var dir = 0 + +func _ready(): + rng.randomize() + speed = rng.randf_range(0.2, 0.8) + velocity.x = speed + +func _physics_process(delta): + + if dir == 0 && position.x > ProjectSettings.get("display/window/size/width") - 8: + dir = 1 + velocity.x = -speed + elif dir == 1 && position.x < 8: + dir = 0 + velocity.x = speed + + var collision_info = move_and_collide(velocity) + if collision_info && collision_info.collider is Player: + var player = (collision_info.collider as Player) + reward(player) + +func _on_visiblity_notifier_screen_exited(): + queue_free() + +func reward(player): + player.weapon = weapon + player.update_weapon() + player.increase_score(50) + queue_free() diff --git a/entities/ufo/ufo.gd b/entities/ufo/ufo.gd new file mode 100644 index 0000000..0f658f3 --- /dev/null +++ b/entities/ufo/ufo.gd @@ -0,0 +1,48 @@ +extends "../enemy.gd" + +export (int) var pellett_count = 10 +export (int) var pellett_radius = 10 +export (float) var pellett_speed = 0.6 +export (int) var pellett_rows_per_wave = 3 +export (int) var pellet_waves = 3 + +var shoot_timer = Timer.new() +var phase = -1 +var max_phase +var pellett = preload("res://entities/pellett/pellett.tscn") + +func _ready(): + shoot_timer.one_shot = true + shoot_timer.wait_time = 0.5 + add_child(shoot_timer) + max_phase = pellet_waves * pellett_rows_per_wave + +func _process(delta): + if shoot_timer.is_stopped() && phase >= 0 && phase <= max_phase: + if phase % pellett_rows_per_wave == 0: + shoot_timer.wait_time = 3.5 + else: + shoot_timer.wait_time = 0.5 + phase += 1 + var angle_step = 2.0 * PI / pellett_count + var angle = 0 + for i in range(0, pellett_count): + var direction = Vector2(cos(angle), sin(angle)) + var pos = position + direction * pellett_radius + var pellett_shot = pellett.instance() + pellett_shot.position = pos + angle += angle_step + pellett_shot.velocity = direction * pellett_speed + level.add_child(pellett_shot) + shoot_timer.start() + +func _physics_process(delta): + if phase == -1 && position.y < 40: + velocity.y = 0.8 + elif phase == - 1: + phase = 1 + velocity = Vector2(0, 0) + + if shoot_timer.is_stopped() && phase >= max_phase - 1: + velocity.y = 0.8 + collision_info = move_and_collide(velocity) diff --git a/entities/ufo/ufo.png b/entities/ufo/ufo.png new file mode 100644 index 0000000000000000000000000000000000000000..8a314347154f651ab9cf131e1dc003e9723756a3 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`y`C%{GUZprlYM_?$T-DmK26!RN-nVc&}73|IxpDP%wl9tVOSIy8p&>Z z?xm~|V}jbj!#Q6WH{4vibL+EBOQ*CPRChQpaCU3hNlR{pZC&*YFP@gNMl<+SRdy8e yZ`=QIvTKsSt}eHd)jYLdwn` zX`BM|+WLT*Elxzb5&HQqo!F>A%vL=zQAoj~k0y)Ux!nZ_x~l%#!Iwol-o_hFD^%TQ SybK)x0000{S36c*ev50A|n}MgaT1@7uPez_Z}pd6f)g!0$0%=F<}pL8JiuAOfgZsHB5hQUGA^ zZW}?kv>yOC{hoQ%v7M`=qudj-A6Yg44jvPE0AL?_2BL&I22}aPdzf_W41$mu@Y;1^5OT@prn zLEDL|vY7$!OpdbW=PM8~0WE+k$Y*{QL1fImEdXb+liXVaP#7*Bv7;XyiDULg>~Wk{ z?AlRc}>zkNZTnC(usZQO5#_!N;!5#(>UGR+Z5I9YB^n94jg|eml%z#_KCJ zg={5UC8JI{D0zEFHPjG6q*xqFa1XSNJ!UQfx$ihE)<)#gqgn5@K(o z93|8y#*$EdHjMLB1=twX#XYa$@CkB7$ z#4{QAYny2XW*3mvfTthv#{*cM$=Um+8JKmr+U_t;tJO$Z`&I|b?i*&{U9|6DrmN5^ vva9%@!<;H3#lf@B{EtzhTje~9@5szI$oIDy)VWks00000NkvXXu0mjf$zNYf literal 0 HcmV?d00001 diff --git a/objects/explosion/explosion.png.import b/objects/explosion/explosion.png.import new file mode 100644 index 0000000..bdd6733 --- /dev/null +++ b/objects/explosion/explosion.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/explosion.png-8ff303fba58225a9b04a257c019728bb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://objects/explosion/explosion.png" +dest_files=[ "res://.import/explosion.png-8ff303fba58225a9b04a257c019728bb.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/objects/explosion/explosion.tscn b/objects/explosion/explosion.tscn new file mode 100644 index 0000000..dde80bc --- /dev/null +++ b/objects/explosion/explosion.tscn @@ -0,0 +1,49 @@ +[gd_scene load_steps=12 format=2] + +[ext_resource path="res://objects/explosion/explosion.png" type="Texture" id=1] +[ext_resource path="res://objects/explosion/explosion.gd" type="Script" id=2] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 16, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 32, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 0, 16, 16, 16 ) + +[sub_resource type="AtlasTexture" id=5] +atlas = ExtResource( 1 ) +region = Rect2( 16, 16, 16, 16 ) + +[sub_resource type="AtlasTexture" id=6] +atlas = ExtResource( 1 ) +region = Rect2( 32, 16, 16, 16 ) + +[sub_resource type="AtlasTexture" id=7] +atlas = ExtResource( 1 ) +region = Rect2( 0, 32, 16, 16 ) + +[sub_resource type="AtlasTexture" id=8] +atlas = ExtResource( 1 ) +region = Rect2( 16, 32, 16, 16 ) + +[sub_resource type="SpriteFrames" id=9] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ], +"loop": false, +"name": "default", +"speed": 15.0 +} ] + +[node name="explosion" type="AnimatedSprite"] +frames = SubResource( 9 ) +script = ExtResource( 2 ) +[connection signal="animation_finished" from="." to="." method="_on_explosion_animation_finished"] diff --git a/objects/spawner/spawner.gd b/objects/spawner/spawner.gd new file mode 100644 index 0000000..2bf5660 --- /dev/null +++ b/objects/spawner/spawner.gd @@ -0,0 +1,24 @@ +extends Node2D + +export (Resource) var spawn_type +export (int) var maximum_spawns +export (float) var spawn_interval = 2 + +var spawn_timer = Timer.new() +var spawns = 0 +var rng = RandomNumberGenerator.new() + +func _ready(): + rng.randomize() + spawn_timer.wait_time = spawn_interval + spawn_timer.one_shot = true + add_child(spawn_timer) + +func _process(delta): + if spawn_timer.is_stopped() && (maximum_spawns < 0 || spawns < maximum_spawns): + var spawn = spawn_type.instance(); + spawn.position = position + spawn.position.x = rng.randf_range(16, ProjectSettings.get("display/window/size/width") - 16) + get_parent().add_child(spawn) + spawns += 1 + spawn_timer.start() diff --git a/objects/spawner/spawner.tscn b/objects/spawner/spawner.tscn new file mode 100644 index 0000000..a7b844b --- /dev/null +++ b/objects/spawner/spawner.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://objects/spawner/spawner.gd" type="Script" id=1] + +[node name="spawner" type="Node2D"] +script = ExtResource( 1 ) diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..7222e1f --- /dev/null +++ b/project.godot @@ -0,0 +1,144 @@ +; 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=4 + +_global_script_classes=[ { +"base": "KinematicBody2D", +"class": "Enemy", +"language": "GDScript", +"path": "res://entities/enemy.gd" +}, { +"base": "KinematicBody2D", +"class": "Player", +"language": "GDScript", +"path": "res://entities/player/player.gd" +}, { +"base": "Node2D", +"class": "Weapon", +"language": "GDScript", +"path": "res://weapons/weapon.gd" +} ] +_global_script_class_icons={ +"Enemy": "", +"Player": "", +"Weapon": "" +} + +[application] + +config/name="ProjectGB8" +run/main_scene="res://ui/main_menu/main_menu.tscn" + +[autoload] + +global="*res://globals/global.gd" + +[debug] + +settings/stdout/print_fps=true + +[display] + +window/size/width=160 +window/size/height=144 +window/size/test_width=960 +window/size/test_height=864 +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[input] + +ui_accept={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) + ] +} +ui_select={ +"deadzone": 0.5, +"events": [ ] +} +ui_cancel={ +"deadzone": 0.5, +"events": [ ] +} +ui_focus_next={ +"deadzone": 0.5, +"events": [ ] +} +ui_focus_prev={ +"deadzone": 0.5, +"events": [ ] +} +ui_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null) + ] +} +ui_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null) + ] +} +ui_up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) + ] +} +ui_down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null) + ] +} +ui_page_up={ +"deadzone": 0.5, +"events": [ ] +} +ui_page_down={ +"deadzone": 0.5, +"events": [ ] +} +ui_home={ +"deadzone": 0.5, +"events": [ ] +} +ui_end={ +"deadzone": 0.5, +"events": [ ] +} +player_shoot={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) + ] +} +player_special={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null) + ] +} + +[layer_names] + +2d_physics/layer_1="player" +2d_physics/layer_2="bullets" +2d_physics/layer_3="enemies" +2d_physics/layer_4="powerups" + +[logging] + +file_logging/enable_file_logging=true + +[rendering] + +quality/driver/driver_name="GLES2" +quality/2d/use_pixel_snap=true +vram_compression/import_etc=true +vram_compression/import_etc2=false +environment/default_environment="res://globals/default_env.tres" diff --git a/ui/Kenney Mini.ttf b/ui/Kenney Mini.ttf new file mode 100644 index 0000000000000000000000000000000000000000..5cbfd3760d9afe712fba7dd845728add3bdcf5af GIT binary patch literal 26156 zcmeI5TZ~=TS;xOKb0&^2Nu1_>X}z1IX;K=Goj8yN7n}=eLXswpqYy!)W^9jVruNLZ zGn3k`5ZV$I0;x!SC{hG%DF}%QBEmzZ7O6-<%^P_Dl!`u7!VQ%W4@i9|B9PR>@B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`8@42H2&s97h3nXX&Uo4C#G(s9iV-Khk_OD zF&g77jJF)8{T(;cduYgPrQiAm8nWAV(4cL5g|9&Er+waR2eci??D(G9CHrVKjq#<( zUCR2UXZSl8UE0I6muUQrjGe6Qgl{K&m!s$MFPps!J?}a}`w9(=SFF)q<4Q&m?W>-H(ga2x5T#b!u?xFoQjq$atU5m_h*V2yApkMcz+4b;T&;0stnErQ; zb_3%Z7~gm$?OEE_&EAd7yPuXhT;#bWM9H1e0-x1pDX7_{f{#VT&fcJqn%^uuCWBlN2X1{bJ?ek_2?WZC0 zk$tr9m_7WW*&|?lOgl~k-$%bn`!?-u mvnN=80{Rp1KJk6CC$FR(p~3U9E)5(X`vHIJ<$3+Rm;VN4LNhA> literal 0 HcmV?d00001 diff --git a/ui/background.png b/ui/background.png new file mode 100644 index 0000000000000000000000000000000000000000..c0551f74bc7dcab164da12f400cfb84f355e656a GIT binary patch literal 78 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq!k#XUAsWHSDG3Qb&Nr|d^zpDV aw5D({{<3jT07^4>y85}Sb4qApU;qG2OA##q literal 0 HcmV?d00001 diff --git a/ui/background.png.import b/ui/background.png.import new file mode 100644 index 0000000..15f7b37 --- /dev/null +++ b/ui/background.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background.png-2693c3f581a46c19cdd8c76a9b20c564.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/background.png" +dest_files=[ "res://.import/background.png-2693c3f581a46c19cdd8c76a9b20c564.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/ui/empty.png b/ui/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..306544c133c832996613656b4a279b2119fb6eef GIT binary patch literal 88 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqEX7WqAsj$Z!;#Vf hiscore: + hiscore_display = highest_score + + score_label.text = str("Score: ", score) + hiscore_label.text = str("High Score: ", hiscore_display) + hiscores = global.get_hiscores() + +func _process(delta): + if Input.is_action_just_pressed("player_shoot"): + hiscores.push_back([name_selector.get_name(), hiscore]) + global.game_state["hiscores"] = hiscores + global.save_game() + go_to_main_menu() + elif Input.is_action_just_pressed("player_special"): + go_to_main_menu() + +func go_to_main_menu(): + var screen = main_menu_screen.instance() + queue_free() + get_tree().get_root().add_child(screen) diff --git a/ui/game_over/game_over.tscn b/ui/game_over/game_over.tscn new file mode 100644 index 0000000..450d4aa --- /dev/null +++ b/ui/game_over/game_over.tscn @@ -0,0 +1,115 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://ui/pixelated_style.tres" type="StyleBox" id=1] +[ext_resource path="res://ui/background.png" type="Texture" id=2] +[ext_resource path="res://ui/Kenney Mini.ttf" type="DynamicFontData" id=3] +[ext_resource path="res://ui/kenny_mini_8px.tres" type="DynamicFont" id=4] +[ext_resource path="res://ui/name_selector/name_selector.tscn" type="PackedScene" id=5] +[ext_resource path="res://ui/game_over/game_over.gd" type="Script" id=6] + +[sub_resource type="DynamicFont" id=1] +font_data = ExtResource( 3 ) + +[node name="game_over" type="Control" groups=[ +"Persistent", +]] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 6 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="title" type="Label" parent="."] +margin_left = 32.0 +margin_top = 32.0 +margin_right = 128.0 +margin_bottom = 52.0 +custom_fonts/font = SubResource( 1 ) +text = "GAME OVER" +align = 1 +valign = 1 +uppercase = true +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="score" type="Label" parent="."] +margin_left = 32.0 +margin_top = 56.0 +margin_right = 128.0 +margin_bottom = 66.0 +custom_fonts/font = ExtResource( 4 ) +text = "Score: 99999999" +align = 2 +uppercase = true +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="next" type="Label" parent="."] +margin_left = 4.91322 +margin_top = 117.755 +margin_right = 100.913 +margin_bottom = 140.755 +custom_fonts/font = ExtResource( 4 ) +text = "Z - Submit score +X - Back to menu" +uppercase = true +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="hiscore" type="Label" parent="."] +margin_left = 32.0 +margin_top = 72.0 +margin_right = 128.0 +margin_bottom = 82.0 +custom_fonts/font = ExtResource( 4 ) +text = "High Score: 99999999" +align = 2 +uppercase = true +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="name" type="LineEdit" parent="."] +visible = false +margin_left = 48.0 +margin_top = 88.0 +margin_right = 112.0 +margin_bottom = 102.0 +custom_styles/read_only = ExtResource( 1 ) +custom_styles/focus = ExtResource( 1 ) +custom_styles/normal = ExtResource( 1 ) +custom_fonts/font = ExtResource( 4 ) +custom_colors/font_color_selected = Color( 1, 1, 1, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +align = 1 +max_length = 10 +placeholder_text = "Name" +placeholder_alpha = 1.0 +caret_blink = true +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="background" type="Sprite" parent="."] +position = Vector2( 80, 72 ) +scale = Vector2( 22, 20 ) +z_index = -100 +texture = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="name_selector" parent="." instance=ExtResource( 5 )] +margin_left = 56.0 +margin_top = 88.0 +margin_right = 56.08 +margin_bottom = 88.0 diff --git a/ui/hiscores/highscores_list.gd b/ui/hiscores/highscores_list.gd new file mode 100644 index 0000000..48dc7c2 --- /dev/null +++ b/ui/hiscores/highscores_list.gd @@ -0,0 +1,22 @@ +extends Control + +var main_menu_screen = load("ui/main_menu/main_menu.tscn") + +func _ready(): + main_menu_screen = main_menu_screen.instance() + var highscores = global.get_hiscores() + for node in get_children(): + node.hide() + var index = 0 + var scores = [] + for i in range(0, highscores.size()): + get_child(i).show() + var key = highscores[i][0] + var score = highscores[i][1] + scores.append(str(key, " - ", score)) + get_child(i).get_node("name").text = str(key, " - ", score) + +func _process(delta): + if Input.is_action_just_pressed("player_special"): + get_node("../../").queue_free() + get_tree().get_root().add_child(main_menu_screen) diff --git a/ui/hiscores/hiscores.tscn b/ui/hiscores/hiscores.tscn new file mode 100644 index 0000000..1ffd2cb --- /dev/null +++ b/ui/hiscores/hiscores.tscn @@ -0,0 +1,238 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://ui/Kenney Mini.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://ui/background.png" type="Texture" id=2] +[ext_resource path="res://ui/kenny_mini_8px.tres" type="DynamicFont" id=3] +[ext_resource path="res://ui/hiscores/highscores_list.gd" type="Script" id=4] + +[sub_resource type="DynamicFont" id=1] +font_data = ExtResource( 1 ) + +[node name="hiscores" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="background" type="Sprite" parent="."] +position = Vector2( 80, 72 ) +scale = Vector2( 22, 20 ) +z_index = -100 +texture = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="layer" type="CanvasLayer" parent="."] +layer = 100 + +[node name="title" type="Label" parent="layer"] +margin_left = 32.0 +margin_right = 128.0 +margin_bottom = 20.0 +custom_fonts/font = SubResource( 1 ) +text = "HIGHSCORES" +align = 1 +valign = 1 +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="back" type="Label" parent="layer"] +margin_top = 128.0 +margin_right = 80.0 +margin_bottom = 138.0 +custom_fonts/font = ExtResource( 3 ) +text = "X - back to menu" +align = 1 +valign = 1 +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="list" type="Control" parent="layer"] +margin_left = 32.0 +margin_top = 16.0 +margin_right = 128.0 +margin_bottom = 128.0 +script = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_1" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 40.0 +margin_bottom = 16.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_1"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "1." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_1"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "AAA - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_2" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 24.0 +margin_right = 40.0 +margin_bottom = 32.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_2"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "2." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_2"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "BBB - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_3" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 40.0 +margin_right = 40.0 +margin_bottom = 48.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_3"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "3." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_3"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "CCC - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_4" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 56.0 +margin_right = 40.0 +margin_bottom = 64.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_4"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "4." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_4"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "DDD - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_5" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 72.0 +margin_right = 40.0 +margin_bottom = 80.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_5"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "5." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_5"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "EEE - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position_6" type="Control" parent="layer/list"] +margin_left = 8.0 +margin_top = 88.0 +margin_right = 40.0 +margin_bottom = 96.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="position" type="Label" parent="layer/list/position_6"] +margin_right = 8.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "6." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="name" type="Label" parent="layer/list/position_6"] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 3 ) +text = "FFF - 99999999" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/ui/hud/hud.gd b/ui/hud/hud.gd new file mode 100644 index 0000000..a5db499 --- /dev/null +++ b/ui/hud/hud.gd @@ -0,0 +1,24 @@ +extends Control + +onready var score_label: Label = $layer/score_label +onready var bombs_label: Label = $layer/bombs_label +onready var lives_label: Label = $layer/lives_label +onready var timer_label: Label = $layer/timer_label +onready var timer: Timer = $layer/timer_label/round_timer + +var player + +func _ready(): + player = get_parent().get_node("player") + update_labels() + +func _process(delta): + timer_label.text = str("T: ", timer.time_left).pad_decimals(0) + +func update_labels(): + score_label.text = str("Score: ", player.score).pad_zeros(8) + lives_label.text = str(player.lives) + bombs_label.text = str(player.bombs) + +func _on_round_timer_timeout(): + player.kill(true) diff --git a/ui/hud/hud.tscn b/ui/hud/hud.tscn new file mode 100644 index 0000000..ef3e15d --- /dev/null +++ b/ui/hud/hud.tscn @@ -0,0 +1,86 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://ui/kenny_mini_8px.tres" type="DynamicFont" id=1] +[ext_resource path="res://ui/life.png" type="Texture" id=2] +[ext_resource path="res://ui/special.png" type="Texture" id=3] +[ext_resource path="res://ui/hud/hud.gd" type="Script" id=4] + +[node name="hud" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="layer" type="CanvasLayer" parent="."] + +[node name="score_label" type="Label" parent="layer"] +margin_top = 134.0 +margin_right = 80.0 +margin_bottom = 144.0 +custom_fonts/font = ExtResource( 1 ) +text = "Score: 00000000" +uppercase = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="lives_label" type="Label" parent="layer"] +margin_left = 152.118 +margin_top = 134.135 +margin_right = 160.118 +margin_bottom = 144.135 +custom_fonts/font = ExtResource( 1 ) +text = "9" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="lives_texture" type="TextureRect" parent="layer"] +margin_left = 143.375 +margin_top = 136.062 +margin_right = 151.375 +margin_bottom = 144.062 +texture = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="bombs_label" type="Label" parent="layer"] +margin_left = 134.904 +margin_top = 134.33 +margin_right = 142.904 +margin_bottom = 144.33 +custom_fonts/font = ExtResource( 1 ) +text = "9" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="bombs_texture" type="TextureRect" parent="layer"] +margin_left = 125.891 +margin_top = 135.84 +margin_right = 133.891 +margin_bottom = 143.84 +texture = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="timer_label" type="Label" parent="layer"] +margin_left = 100.192 +margin_top = 133.603 +margin_right = 127.192 +margin_bottom = 143.603 +custom_fonts/font = ExtResource( 1 ) +text = "T: 120" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="round_timer" type="Timer" parent="layer/timer_label"] +wait_time = 120.0 +autostart = true +[connection signal="timeout" from="layer/timer_label/round_timer" to="." method="_on_round_timer_timeout"] diff --git a/ui/kenny_mini_16px.tres b/ui/kenny_mini_16px.tres new file mode 100644 index 0000000..5f6cfc9 --- /dev/null +++ b/ui/kenny_mini_16px.tres @@ -0,0 +1,6 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://ui/Kenney Mini.ttf" type="DynamicFontData" id=1] + +[resource] +font_data = ExtResource( 1 ) diff --git a/ui/kenny_mini_8px.tres b/ui/kenny_mini_8px.tres new file mode 100644 index 0000000..ace65ac --- /dev/null +++ b/ui/kenny_mini_8px.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://ui/Kenney Mini.ttf" type="DynamicFontData" id=1] + +[resource] +size = 8 +font_data = ExtResource( 1 ) diff --git a/ui/life.png b/ui/life.png new file mode 100644 index 0000000000000000000000000000000000000000..072da545424a4a0e389d33cf06725a804894351a GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqmYyz-AsWHSDG3P)KmPy!UoUX> z#EBCf=h9m|n^ZP1YH2uZ6TZteVRnE_YcQi(aKfyEY6lp0l{-FSXo^+-`*C6eKhO{c MPgg&ebxsLQ07QZ%kpKVy literal 0 HcmV?d00001 diff --git a/ui/life.png.import b/ui/life.png.import new file mode 100644 index 0000000..18804ee --- /dev/null +++ b/ui/life.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/life.png-26a1e835748485449585dc4afd1e5b75.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/life.png" +dest_files=[ "res://.import/life.png-26a1e835748485449585dc4afd1e5b75.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/main_menu/caret_1.png b/ui/main_menu/caret_1.png new file mode 100644 index 0000000000000000000000000000000000000000..8feec11ca517d746e6aeb852c3bf90a43e99781b GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq`kpS1AsWHSDGCe{j-UPm0skUN zNy&pXDGiGlW-IZqzUbPZI-g$eg9=RJCrW80ktxCy85}Sb4qAp003Xt B9%=vp literal 0 HcmV?d00001 diff --git a/ui/main_menu/caret_1.png.import b/ui/main_menu/caret_1.png.import new file mode 100644 index 0000000..9b6ea6b --- /dev/null +++ b/ui/main_menu/caret_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/caret_1.png-520d249e7d3ea2fc39711cc061f5f3ea.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/main_menu/caret_1.png" +dest_files=[ "res://.import/caret_1.png-520d249e7d3ea2fc39711cc061f5f3ea.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/main_menu/caret_2.png b/ui/main_menu/caret_2.png new file mode 100644 index 0000000000000000000000000000000000000000..7ead8b1e44da84b3bccd0d0881547911d6ebcaba GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq`kpS1AsWHSDGCe{iJ$%h0e_OQ zk 90): + ascii[0] = 65 + chars[index].text = ascii.get_string_from_ascii() + +func down_ascii(): + var ascii = chars[index].text.to_ascii() + var current_ascii = ascii[0] + ascii[0] = current_ascii - 1 + if(ascii[0] < 65): + ascii[0] = 90 + chars[index].text = ascii.get_string_from_ascii() + +func get_name(): + var input = PoolStringArray([]) + for ch in chars: + input.append(str(ch.text)) + return input.join("") diff --git a/ui/name_selector/name_selector.tscn b/ui/name_selector/name_selector.tscn new file mode 100644 index 0000000..f1e6fd7 --- /dev/null +++ b/ui/name_selector/name_selector.tscn @@ -0,0 +1,63 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://ui/kenny_mini_16px.tres" type="DynamicFont" id=1] +[ext_resource path="res://ui/name_selector/selected.png" type="Texture" id=3] +[ext_resource path="res://ui/name_selector/selected_2.png" type="Texture" id=4] +[ext_resource path="res://ui/name_selector/name_selector.gd" type="Script" id=5] + +[sub_resource type="AnimatedTexture" id=1] +frames = 2 +fps = 2.0 +frame_0/texture = ExtResource( 3 ) +frame_1/texture = ExtResource( 4 ) +frame_1/delay_sec = 0.0 + +[node name="name_selector" type="Control"] +anchor_right = 0.312 +anchor_bottom = 0.16 +margin_right = 0.079998 +margin_bottom = -0.0400009 +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="first_char" type="Label" parent="."] +margin_right = 16.0 +margin_bottom = 20.0 +custom_fonts/font = ExtResource( 1 ) +text = "A" +align = 1 +valign = 1 +uppercase = true + +[node name="second_char" type="Label" parent="."] +margin_left = 16.0 +margin_right = 32.0 +margin_bottom = 20.0 +custom_fonts/font = ExtResource( 1 ) +text = "A" +align = 1 +valign = 1 +uppercase = true + +[node name="third_char" type="Label" parent="."] +margin_left = 32.0 +margin_right = 48.0 +margin_bottom = 20.0 +custom_fonts/font = ExtResource( 1 ) +text = "A" +align = 1 +valign = 1 +uppercase = true + +[node name="selector" type="TextureRect" parent="."] +margin_left = -2.0 +margin_top = -0.125 +margin_right = 16.0 +margin_bottom = 21.875 +texture = SubResource( 1 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/ui/name_selector/selected.png.import b/ui/name_selector/selected.png.import new file mode 100644 index 0000000..46963ea --- /dev/null +++ b/ui/name_selector/selected.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/selected.png-7e8b81ec794c7a086bdda714fe342740.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/name_selector/selected.png" +dest_files=[ "res://.import/selected.png-7e8b81ec794c7a086bdda714fe342740.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/name_selector/selected_1.png b/ui/name_selector/selected_1.png new file mode 100644 index 0000000000000000000000000000000000000000..4475b3a6b656a5db0c2f2c6438b20a68d5ad5a5c GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqEX7WqAsj$Z!;#Vfnz8X$j6sVTS!HP$l&Sf K=d#Wzp$P!7Mk5*k literal 0 HcmV?d00001 diff --git a/ui/name_selector/selected_1.png.import b/ui/name_selector/selected_1.png.import new file mode 100644 index 0000000..0b0a428 --- /dev/null +++ b/ui/name_selector/selected_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/selected_1.png-e880126c69ab2381ca7ab9e50753e276.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/name_selector/selected_1.png" +dest_files=[ "res://.import/selected_1.png-e880126c69ab2381ca7ab9e50753e276.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/ui/name_selector/selected_2.png b/ui/name_selector/selected_2.png new file mode 100644 index 0000000000000000000000000000000000000000..0515a8686c677ffa1e2e5dbeb5bab80b9f0c08cf GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqrk*a2AsWHSDGCe{j-UPm0skUN zNlC*W1&lLP&Nxg^n;;RvXy-78X-44*wS^Im7bgC=!@#igjsoX(wHY!%0~kDA{an^L IB{VSr04lm5`~Uy| literal 0 HcmV?d00001 diff --git a/ui/name_selector/selected_2.png.import b/ui/name_selector/selected_2.png.import new file mode 100644 index 0000000..30a7cdf --- /dev/null +++ b/ui/name_selector/selected_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/selected_2.png-1ac340c4d268919bb2bc9ef076176a2b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/name_selector/selected_2.png" +dest_files=[ "res://.import/selected_2.png-1ac340c4d268919bb2bc9ef076176a2b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/ui/pixelated_style.tres b/ui/pixelated_style.tres new file mode 100644 index 0000000..c4dded1 --- /dev/null +++ b/ui/pixelated_style.tres @@ -0,0 +1,14 @@ +[gd_resource type="StyleBoxFlat" format=2] + +[resource] +bg_color = Color( 0.301961, 0.301961, 0.301961, 1 ) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color( 1, 1, 1, 1 ) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 +anti_aliasing = false diff --git a/ui/special.png b/ui/special.png new file mode 100644 index 0000000000000000000000000000000000000000..66da776931d83c4f217a47e5424945781adb954d GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqnw~C>AsWHSDG3P)KmPy!UoX(h wC*jy&#kFB3lkwcRumgM8KkJ>Tn_$7vqOHLBHq)$ literal 0 HcmV?d00001 diff --git a/ui/special.png.import b/ui/special.png.import new file mode 100644 index 0000000..2983617 --- /dev/null +++ b/ui/special.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/special.png-ed76150abde163f1fe3a6443890e092f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/special.png" +dest_files=[ "res://.import/special.png-ed76150abde163f1fe3a6443890e092f.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/weapons/default/default.gd b/weapons/default/default.gd new file mode 100644 index 0000000..e152118 --- /dev/null +++ b/weapons/default/default.gd @@ -0,0 +1,4 @@ +extends "../weapon.gd" + +func shoot(): + .shoot() diff --git a/weapons/default/default.tscn b/weapons/default/default.tscn new file mode 100644 index 0000000..04645e2 --- /dev/null +++ b/weapons/default/default.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://weapons/default/default.gd" type="Script" id=1] +[ext_resource path="res://entities/bullet/bullet.tscn" type="PackedScene" id=2] + +[node name="node" type="Node2D"] +script = ExtResource( 1 ) +bullet_speed = 3 +shoot_cooldown = 0.3 +bullet_type = ExtResource( 2 ) diff --git a/weapons/double/double.gd b/weapons/double/double.gd new file mode 100644 index 0000000..6fc736e --- /dev/null +++ b/weapons/double/double.gd @@ -0,0 +1,20 @@ +extends "../weapon.gd" + +func shoot(): + if !shoot_timer.is_stopped(): + return + var bullet1 = bullet_type.instance() + bullet1.position = player.position + bullet1.position.y -= 3 + bullet1.position.x -= 7.5 + bullet1.velocity.y -= bullet_speed + get_tree().get_root().add_child(bullet1) + + var bullet2 = bullet_type.instance() + bullet2.position = player.position + bullet2.position.y -= 3 + bullet2.position.x += 7.5 + bullet2.velocity.y -= bullet_speed + get_tree().get_root().add_child(bullet2) + + shoot_timer.start() diff --git a/weapons/double/double.tscn b/weapons/double/double.tscn new file mode 100644 index 0000000..d6887d2 --- /dev/null +++ b/weapons/double/double.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://weapons/double/double.gd" type="Script" id=1] + +[node name="node" type="Node2D"] +script = ExtResource( 1 ) +bullet_speed = 4 +shoot_cooldown = 0.2 diff --git a/weapons/laser/laser.gd b/weapons/laser/laser.gd new file mode 100644 index 0000000..8d744fb --- /dev/null +++ b/weapons/laser/laser.gd @@ -0,0 +1,12 @@ +extends "../weapon.gd" + +func shoot(): + if !shoot_timer.is_stopped(): + return + var bullet = bullet_type.instance() + bullet.position = player.position + bullet.position.y -= 8 + bullet.velocity.y -= bullet_speed + bullet.damage = 0.2 + get_parent().get_parent().add_child(bullet) + shoot_timer.start() diff --git a/weapons/laser/laser.tscn b/weapons/laser/laser.tscn new file mode 100644 index 0000000..3e023f0 --- /dev/null +++ b/weapons/laser/laser.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://weapons/laser/laser.gd" type="Script" id=1] + +[node name="node" type="Node2D"] +script = ExtResource( 1 ) +bullet_speed = 5 +shoot_cooldown = 0.05 diff --git a/weapons/weapon.gd b/weapons/weapon.gd new file mode 100644 index 0000000..6cb38cb --- /dev/null +++ b/weapons/weapon.gd @@ -0,0 +1,24 @@ +extends Node2D +class_name Weapon + +export (int) var bullet_speed = 2 +export (float) var shoot_cooldown = 0.1 +export (Resource) var bullet_type = load("entities/bullet/bullet.tscn") + +var shoot_timer = Timer.new() +var player + +func _ready(): + shoot_timer.wait_time = shoot_cooldown + shoot_timer.one_shot = true + add_child(shoot_timer) + +func shoot(): + if !shoot_timer.is_stopped(): + return + var bullet = bullet_type.instance() + bullet.position = player.position + bullet.position.y -= 8 + bullet.velocity.y -= bullet_speed + shoot_timer.start() + player.level.add_child(bullet)