From 8468769d70795b71120213f3952f00980a5b5830 Mon Sep 17 00:00:00 2001 From: Dukantic Date: Wed, 3 Sep 2025 17:36:59 +0200 Subject: [PATCH] init --- .gitattributes | 4 +++ assets/asteroidx1.png | 3 ++ assets/asteroidx1.png.import | 34 ++++++++++++++++++ assets/asteroidx2.png | 3 ++ assets/asteroidx2.png.import | 34 ++++++++++++++++++ assets/asteroidx3.png | 3 ++ assets/asteroidx3.png.import | 34 ++++++++++++++++++ assets/asteroidx4.png | 3 ++ assets/asteroidx4.png.import | 34 ++++++++++++++++++ assets/ship.kra | Bin 0 -> 33541 bytes assets/ship.png | 3 ++ assets/ship.png.import | 34 ++++++++++++++++++ assets/shoot.png | 3 ++ assets/shoot.png.import | 34 ++++++++++++++++++ asteroid.gd | 60 +++++++++++++++++++++++++++++++ asteroid.gd.uid | 1 + asteroidx1.tscn | 25 +++++++++++++ asteroidx2.tscn | 20 +++++++++++ asteroidx3.tscn | 20 +++++++++++ asteroidx4.tscn | 20 +++++++++++ destroy.gd | 14 ++++++++ destroy.gd.uid | 1 + destroy.tscn | 22 ++++++++++++ icon.svg | 1 + icon.svg.import | 37 +++++++++++++++++++ main_game.tscn | 45 +++++++++++++++++++++++ project.godot | 64 +++++++++++++++++++++++++++++++++ ship.gd | 44 +++++++++++++++++++++++ ship.gd.uid | 1 + ship.tscn | 21 +++++++++++ shoot.gd | 17 +++++++++ shoot.gd.uid | 1 + shoot.tscn | 22 ++++++++++++ spawner.gd | 67 +++++++++++++++++++++++++++++++++++ spawner.gd.uid | 1 + spawner.tscn | 16 +++++++++ 36 files changed, 746 insertions(+) create mode 100644 .gitattributes create mode 100644 assets/asteroidx1.png create mode 100644 assets/asteroidx1.png.import create mode 100644 assets/asteroidx2.png create mode 100644 assets/asteroidx2.png.import create mode 100644 assets/asteroidx3.png create mode 100644 assets/asteroidx3.png.import create mode 100644 assets/asteroidx4.png create mode 100644 assets/asteroidx4.png.import create mode 100644 assets/ship.kra create mode 100644 assets/ship.png create mode 100644 assets/ship.png.import create mode 100644 assets/shoot.png create mode 100644 assets/shoot.png.import create mode 100644 asteroid.gd create mode 100644 asteroid.gd.uid create mode 100644 asteroidx1.tscn create mode 100644 asteroidx2.tscn create mode 100644 asteroidx3.tscn create mode 100644 asteroidx4.tscn create mode 100644 destroy.gd create mode 100644 destroy.gd.uid create mode 100644 destroy.tscn create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 main_game.tscn create mode 100644 project.godot create mode 100644 ship.gd create mode 100644 ship.gd.uid create mode 100644 ship.tscn create mode 100644 shoot.gd create mode 100644 shoot.gd.uid create mode 100644 shoot.tscn create mode 100644 spawner.gd create mode 100644 spawner.gd.uid create mode 100644 spawner.tscn diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8c57fac --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +**/*.png filter=lfs diff=lfs merge=lfs -text +**/*.png~ filter=lfs diff=lfs merge=lfs -text +**/*.wav filter=lfs diff=lfs merge=lfs -text +**/*.ogg filter=lfs diff=lfs merge=lfs -text diff --git a/assets/asteroidx1.png b/assets/asteroidx1.png new file mode 100644 index 0000000..568815d --- /dev/null +++ b/assets/asteroidx1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72080f5944ca7572ad00d38972cbf92f971962fcdfb92230d695dfbb38b6a99c +size 743 diff --git a/assets/asteroidx1.png.import b/assets/asteroidx1.png.import new file mode 100644 index 0000000..238ebab --- /dev/null +++ b/assets/asteroidx1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dbingmvgsgvfv" +path="res://.godot/imported/asteroidx1.png-2ed952e99a25c06a27d0b5f6e371de94.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/asteroidx1.png" +dest_files=["res://.godot/imported/asteroidx1.png-2ed952e99a25c06a27d0b5f6e371de94.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/assets/asteroidx2.png b/assets/asteroidx2.png new file mode 100644 index 0000000..c5f3053 --- /dev/null +++ b/assets/asteroidx2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54c1822636ef7236a6d55882ed350f2a56a569ebf0936029ce4227ebc71c678b +size 1466 diff --git a/assets/asteroidx2.png.import b/assets/asteroidx2.png.import new file mode 100644 index 0000000..f0c3e36 --- /dev/null +++ b/assets/asteroidx2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bby053xsfn3cp" +path="res://.godot/imported/asteroidx2.png-230aca16ad91032a4d8ada0623ba2e3a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/asteroidx2.png" +dest_files=["res://.godot/imported/asteroidx2.png-230aca16ad91032a4d8ada0623ba2e3a.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/assets/asteroidx3.png b/assets/asteroidx3.png new file mode 100644 index 0000000..89df14e --- /dev/null +++ b/assets/asteroidx3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7ae5b2933db63ee3e398cf3950a7354c008663c9ae2188d11cd345e6865a652 +size 2361 diff --git a/assets/asteroidx3.png.import b/assets/asteroidx3.png.import new file mode 100644 index 0000000..0897dc8 --- /dev/null +++ b/assets/asteroidx3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dt08ism4ulfay" +path="res://.godot/imported/asteroidx3.png-bea0ed5c703653cfa8253ac8a803ff8c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/asteroidx3.png" +dest_files=["res://.godot/imported/asteroidx3.png-bea0ed5c703653cfa8253ac8a803ff8c.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/assets/asteroidx4.png b/assets/asteroidx4.png new file mode 100644 index 0000000..c7944c4 --- /dev/null +++ b/assets/asteroidx4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:790085f9a41062c78b7c11040c90389110e45fdb7f34aa7ee2b72d4cc55ff79b +size 3310 diff --git a/assets/asteroidx4.png.import b/assets/asteroidx4.png.import new file mode 100644 index 0000000..52da27f --- /dev/null +++ b/assets/asteroidx4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bs836c8u5j3y6" +path="res://.godot/imported/asteroidx4.png-b1991afc2a5c83382f2490c9baab5973.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/asteroidx4.png" +dest_files=["res://.godot/imported/asteroidx4.png-b1991afc2a5c83382f2490c9baab5973.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/assets/ship.kra b/assets/ship.kra new file mode 100644 index 0000000000000000000000000000000000000000..9f269648121cd001937675a0bffe6b3d4b69af47 GIT binary patch literal 33541 zcmeI51yCH@)~E*$gaE-U$l&f4WC-pMT!VYi!QDN$dmsUV2e;q>0trrV7y<-HaDvOc zA?LsUxhLnG|K9sv)vH&pXwuWWSMRmu zRj-Lhu>baa<143;STzJp%I)=(P|-VEH6}HNEw!)5J14VjV!H&>kg@UfIU5%a z!w9;m+;?9ncA+#>e&Jnd?^YZY_qYMAg?WExI(^dZS0YGlsueK3}2Vzca=et zpK?94G|x)%eHH>-v#FcZismjHbpTR9nV+KM^O`Nq>-pIQXHnY~q~UWw_L>G+$%C&`;~G-m6=+u>=FtIm!b>wY`PI?KAlz@riN|1!36UC0>164!!LQ z3s&^P?+P(e!Y(MLLhOT#a>j5riyZ_u^A!`p#qGZBr>m<-qw87>LCQrBw4BNM#;DQL zUomdfq=%PnBP;aC3yINftpdIMbdj42G(NmS(zjRNuWM=VFhDc~tQfR}uzwn-k|uqR z#Y*1Sb@pj)2fe$cl1eTF5=xse9=aD8Oa}2PSomtn=iZb)U&ej3zswZsflE=Nnc@l* zP1WmS4+0q~J6n`|)%)Hp=y$eJR;1g(Wn=JKEjO|LZKj9MVU0{xOm3 za%L+eaDU>*5~*f8v>Hd( z6Uit8M}db=2t_8C=QEfrk8`$yHy(~y`7}yP zPrHB^eX?PbWJoILWcYD+R-k#2(`N^I^!x_Y(zj%K=CEfjEDPeU?IM=%SYF8m zbLd@Mof@DXkaVO%J-p}_ze<^OL_E$sFsf+H^@OH_8e7JoFCRB@_%AO}F|lwwa_&9K z{0_>f1&jDUUmRHO*ptXve83R7me~kg1k)NHn{6{4g&)^Pw?p43`kbin+AUXB#k}8G z+JHx>wZBB(<0bV{hdP#N<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jik}BzASXAF?Y5S)vAyL#YPi5Mwf{T^ zQn)z4hJhV63>MA~cEUjR-zuBBIy=KMK&!**{iV_Ws%Gxt=-}+a0ycMnC5yHM!GlzLTrB?a1q$Ili=XV5dJ>7{p~$?yHN+;{{AD?{cl=-pV|JlE^G#aX$jnF z{hsIkSH)j*aR072fbi#x+`nr7n*I4!`*x!ajDh8Y{-<2fzbgKkQ}#EtTSW)hr=$My zH2n`5W`8yKYhu*j4PL^=_TMo0hYwQyYW>#~slQuSzW*odza@41)x@uv;C?qzhW$4t z{>Lu;GvRof5bhrvb>NS`wFe^}f9=+<9|!y03>(j1cZ>U16Tg1%>vt1*e`n%<)3eRL zwf7gE{qq3bBB1}+r~|3AfA{PcAoN$?etjMI-H5)|pI#1rRsMC6_+2>|mKyIL_vC+1 d3T*$qWT?m^-M&h|UO+GbxUkfL^M1Ey{|i7Gd8z;a literal 0 HcmV?d00001 diff --git a/assets/ship.png b/assets/ship.png new file mode 100644 index 0000000..7adc2f2 --- /dev/null +++ b/assets/ship.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fd461c48d1c3567d42d607a525dd0464fe7cfdacf41ae514893e0635ef00ff3 +size 501 diff --git a/assets/ship.png.import b/assets/ship.png.import new file mode 100644 index 0000000..74cd971 --- /dev/null +++ b/assets/ship.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b037piy3tkefs" +path="res://.godot/imported/ship.png-0b2a8e7064d2d88a0149f9491a8ea676.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ship.png" +dest_files=["res://.godot/imported/ship.png-0b2a8e7064d2d88a0149f9491a8ea676.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/assets/shoot.png b/assets/shoot.png new file mode 100644 index 0000000..d526d83 --- /dev/null +++ b/assets/shoot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d77e2aefbc47cac5085444de93b52640d6fc6fd3982a86ea32c5fbfe538bb469 +size 210 diff --git a/assets/shoot.png.import b/assets/shoot.png.import new file mode 100644 index 0000000..ae2ceb5 --- /dev/null +++ b/assets/shoot.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ckgjtmh5asu4w" +path="res://.godot/imported/shoot.png-f6904f09e65e49cfdabc82df82040940.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/shoot.png" +dest_files=["res://.godot/imported/shoot.png-f6904f09e65e49cfdabc82df82040940.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/asteroid.gd b/asteroid.gd new file mode 100644 index 0000000..78a0c0e --- /dev/null +++ b/asteroid.gd @@ -0,0 +1,60 @@ +extends RigidBody2D + +var SPEED : float +var direction : Vector2 +var type:= 1 + +@export var particles := load("res://destroy.tscn") + +@export var asteroidx1 : = load("res://asteroidx1.tscn") +@export var asteroidx2 : = load("res://asteroidx2.tscn") +@export var asteroidx3 : = load("res://asteroidx3.tscn") + + +func _ready() -> void: + add_to_group("asteroid") + SPEED = randf() / 50 +50 + rotation = randf_range(0.0, 360.0) + +func _process(_delta: float) -> void: + linear_velocity = direction * SPEED + +func split(): + var packed_use: PackedScene + + if type == 1: + var part = particles.instantiate() + part.global_position = global_position + get_parent().call_deferred("add_child", part) + queue_free() + return + elif type == 2: + packed_use = asteroidx1 + elif type == 3: + packed_use = asteroidx2 + elif type == 4: + packed_use = asteroidx3 + + var first = packed_use.instantiate() + var second = packed_use.instantiate() + var nor = direction.rotated(PI/2).normalized() + first.direction = direction + second.direction = direction + first.global_position = position + (2**type * nor) + first.type = type-1 + second.global_position = position - (2**type * nor) + second.type = type-1 + var parent = get_parent() + var part = particles.instantiate() + part.global_position = global_position + parent.call_deferred("add_child", first) + parent.call_deferred("add_child", second) + parent.call_deferred("add_child", part) + queue_free() + +func _on_body_entered(body: Node) -> void: + if body.is_in_group("asteroid"): + get_parent().emit_signal("add_collision", body, self) + if body.is_in_group("shoot"): + body.queue_free() + split() diff --git a/asteroid.gd.uid b/asteroid.gd.uid new file mode 100644 index 0000000..90af7cf --- /dev/null +++ b/asteroid.gd.uid @@ -0,0 +1 @@ +uid://b8a23hkmesx0l diff --git a/asteroidx1.tscn b/asteroidx1.tscn new file mode 100644 index 0000000..93f9d25 --- /dev/null +++ b/asteroidx1.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=4 format=3 uid="uid://ditud5veuxqyb"] + +[ext_resource type="Script" uid="uid://b8a23hkmesx0l" path="res://asteroid.gd" id="1_p0ukn"] +[ext_resource type="Texture2D" uid="uid://dbingmvgsgvfv" path="res://assets/asteroidx1.png" id="1_u87q6"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_p0ukn"] +radius = 14.0357 + +[node name="asteroid" type="RigidBody2D"] +collision_layer = 2 +collision_mask = 2 +mass = 5.0 +contact_monitor = true +max_contacts_reported = 4 +script = ExtResource("1_p0ukn") + +[node name="Asteroid" type="Sprite2D" parent="."] +texture = ExtResource("1_u87q6") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +light_mask = 2 +visibility_layer = 2 +shape = SubResource("CircleShape2D_p0ukn") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/asteroidx2.tscn b/asteroidx2.tscn new file mode 100644 index 0000000..b15fb63 --- /dev/null +++ b/asteroidx2.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://d2jxc24g18ab1"] + +[ext_resource type="Script" uid="uid://b8a23hkmesx0l" path="res://asteroid.gd" id="1_ka8bu"] +[ext_resource type="Texture2D" uid="uid://bby053xsfn3cp" path="res://assets/asteroidx2.png" id="2_e2m2r"] + +[node name="asteroid" type="RigidBody2D"] +collision_layer = 2 +collision_mask = 2 +mass = 10.0 +contact_monitor = true +max_contacts_reported = 4 +script = ExtResource("1_ka8bu") + +[node name="Asteroid" type="Sprite2D" parent="."] +texture = ExtResource("2_e2m2r") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(16, -23, 3, -29, -11, -27, -22, -12, -27, 2, -25, 21, -6, 30, 17, 23, 23, 10, 29, 1, 20, -8) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/asteroidx3.tscn b/asteroidx3.tscn new file mode 100644 index 0000000..93870a3 --- /dev/null +++ b/asteroidx3.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://buy8yafwaicq8"] + +[ext_resource type="Script" uid="uid://b8a23hkmesx0l" path="res://asteroid.gd" id="1_e451a"] +[ext_resource type="Texture2D" uid="uid://dt08ism4ulfay" path="res://assets/asteroidx3.png" id="2_beklf"] + +[node name="asteroid" type="RigidBody2D"] +collision_layer = 2 +collision_mask = 2 +mass = 20.0 +contact_monitor = true +max_contacts_reported = 4 +script = ExtResource("1_e451a") + +[node name="Asteroid" type="Sprite2D" parent="."] +texture = ExtResource("2_beklf") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(23, 10, 36, -11, 22, -32, 8, -43, -32, -40, -40, -25, -43, 1, -40, 23, -24, 41, 3, 43, 38, 19) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/asteroidx4.tscn b/asteroidx4.tscn new file mode 100644 index 0000000..50f8d5b --- /dev/null +++ b/asteroidx4.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://xldavgivpb3j"] + +[ext_resource type="Script" uid="uid://b8a23hkmesx0l" path="res://asteroid.gd" id="1_pojcu"] +[ext_resource type="Texture2D" uid="uid://bs836c8u5j3y6" path="res://assets/asteroidx4.png" id="2_gv6mu"] + +[node name="asteroid" type="RigidBody2D"] +collision_layer = 2 +collision_mask = 2 +mass = 40.0 +contact_monitor = true +max_contacts_reported = 4 +script = ExtResource("1_pojcu") + +[node name="Asteroid" type="Sprite2D" parent="."] +texture = ExtResource("2_gv6mu") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(55, 3, 35, -20, 34, -40, 1, -49, -35, -52, -55, -29, -58, -1, -48, 30, -22, 53, 13, 58, 40, 30) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/destroy.gd b/destroy.gd new file mode 100644 index 0000000..4db895c --- /dev/null +++ b/destroy.gd @@ -0,0 +1,14 @@ +extends CPUParticles2D + +var time :=0.0 + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + emitting = true + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + time+=delta + if time >= 10: + queue_free() diff --git a/destroy.gd.uid b/destroy.gd.uid new file mode 100644 index 0000000..118ab38 --- /dev/null +++ b/destroy.gd.uid @@ -0,0 +1 @@ +uid://bgbncoa145y1l diff --git a/destroy.tscn b/destroy.tscn new file mode 100644 index 0000000..c6a8c97 --- /dev/null +++ b/destroy.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://bl3ans3gkp8ll"] + +[ext_resource type="Texture2D" uid="uid://ckgjtmh5asu4w" path="res://assets/shoot.png" id="1_4xjek"] +[ext_resource type="Script" uid="uid://bgbncoa145y1l" path="res://destroy.gd" id="2_owou8"] + +[sub_resource type="Gradient" id="Gradient_owou8"] +offsets = PackedFloat32Array(0, 0.553333, 1) +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0.772549, 1, 1, 1, 0) + +[node name="CPUParticles2D" type="CPUParticles2D"] +emitting = false +amount = 16 +texture = ExtResource("1_4xjek") +lifetime = 2.5 +one_shot = true +explosiveness = 0.5 +randomness = 0.46 +spread = 180.0 +gravity = Vector2(0, 0) +initial_velocity_max = 50.0 +color_ramp = SubResource("Gradient_owou8") +script = ExtResource("2_owou8") 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..1c25286 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bt0r4svityy4x" +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/main_game.tscn b/main_game.tscn new file mode 100644 index 0000000..878a026 --- /dev/null +++ b/main_game.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=5 format=3 uid="uid://btcb75wp78ory"] + +[ext_resource type="PackedScene" uid="uid://36q833dx6dmq" path="res://ship.tscn" id="1_1oj5k"] +[ext_resource type="PackedScene" uid="uid://b6hqwxrexoa2n" path="res://spawner.tscn" id="2_yx7mw"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1oj5k"] +size = Vector2(20, 640) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_yx7mw"] +size = Vector2(640, 20) + +[node name="main_game" type="Node2D"] + +[node name="ColorRect" type="ColorRect" parent="."] +offset_right = 640.0 +offset_bottom = 640.0 +color = Color(0, 0, 0, 1) + +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2(320, 320) + +[node name="CharacterBody2D" parent="." instance=ExtResource("1_1oj5k")] +position = Vector2(156, 206) + +[node name="StaticBody2D" type="StaticBody2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(0, 320) +shape = SubResource("RectangleShape2D_1oj5k") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(640, 320) +shape = SubResource("RectangleShape2D_1oj5k") + +[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(320, 0) +shape = SubResource("RectangleShape2D_yx7mw") + +[node name="CollisionShape2D4" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(320, 640) +shape = SubResource("RectangleShape2D_yx7mw") + +[node name="spawner" parent="." node_paths=PackedStringArray("player") instance=ExtResource("2_yx7mw")] +player = NodePath("../CharacterBody2D") +distance = 500.0 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..4c51379 --- /dev/null +++ b/project.godot @@ -0,0 +1,64 @@ +; 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="asteroid" +run/main_scene="uid://btcb75wp78ory" +config/features=PackedStringArray("4.4", "Forward Plus") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=640 +window/size/viewport_height=640 + +[input] + +ui_left={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) +] +} +ui_right={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +] +} +ui_up={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +] +} +ui_down={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +] +} + +[physics] + +2d/default_gravity_vector=Vector2(0, 0) + +[rendering] + +textures/canvas_textures/default_texture_filter=0 diff --git a/ship.gd b/ship.gd new file mode 100644 index 0000000..6ff2ea8 --- /dev/null +++ b/ship.gd @@ -0,0 +1,44 @@ +extends CharacterBody2D + +@export var MAX_SPEED: float = 200 +@export var SHOOT_NODE: PackedScene + +const SPEED = 25.0 +const JUMP_VELOCITY = -400.0 +var mouse_position: Vector2 = Vector2.ZERO +var horizontal : float +var vertical : float +var vector_temp:= Vector2(1, 0) +var rota_temp: float +var delay := 0.0 + +func _input(event): + pass + if event is InputEventMouseMotion: + mouse_position = event.position + + +func _physics_process(delta: float) -> void: + delay += delta + if Input.is_action_pressed("ui_accept") and delay >= 0.5: + shoot() + delay = 0 + + + horizontal = Input.get_axis("ui_up", "ui_down") + vertical = Input.get_axis("ui_left", "ui_right") + + velocity.x = move_toward(velocity.x, MAX_SPEED * vertical, SPEED) + velocity.y = move_toward(velocity.y, MAX_SPEED * horizontal, SPEED) + if horizontal != 0 or vertical != 0: + vector_temp = Vector2(vertical, horizontal) + rotation = atan2(vector_temp.y, vector_temp.x) + + move_and_slide() + + +func shoot()->void: + var new = SHOOT_NODE.instantiate() + new.direction = vector_temp + new.position = position + (18 * vector_temp.normalized()) + get_parent().add_child(new) diff --git a/ship.gd.uid b/ship.gd.uid new file mode 100644 index 0000000..a599d8b --- /dev/null +++ b/ship.gd.uid @@ -0,0 +1 @@ +uid://c3i2bhlectmoo diff --git a/ship.tscn b/ship.tscn new file mode 100644 index 0000000..e231af2 --- /dev/null +++ b/ship.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=5 format=3 uid="uid://36q833dx6dmq"] + +[ext_resource type="Script" uid="uid://c3i2bhlectmoo" path="res://ship.gd" id="1_4cq66"] +[ext_resource type="Texture2D" uid="uid://b037piy3tkefs" path="res://assets/ship.png" id="1_l3rv8"] +[ext_resource type="PackedScene" uid="uid://b1jtii12cqye1" path="res://shoot.tscn" id="2_v4325"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_4cq66"] +size = Vector2(16, 28) + +[node name="CharacterBody2D" type="CharacterBody2D"] +script = ExtResource("1_4cq66") +SHOOT_NODE = ExtResource("2_v4325") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource("RectangleShape2D_4cq66") + +[node name="Ship" type="Sprite2D" parent="."] +texture_filter = 1 +rotation = 1.5708 +texture = ExtResource("1_l3rv8") diff --git a/shoot.gd b/shoot.gd new file mode 100644 index 0000000..c27b49b --- /dev/null +++ b/shoot.gd @@ -0,0 +1,17 @@ +extends RigidBody2D + +@export var SPEED : float = 100.0 +var direction: Vector2: + set(val): + direction = val.normalized() * SPEED +var time := 0.0 + +func _ready() -> void: + add_to_group("shoot") + +func _process(delta: float) -> void: + linear_velocity = direction + + time += delta + #if time >= 2: + # self.queue_free() diff --git a/shoot.gd.uid b/shoot.gd.uid new file mode 100644 index 0000000..46d3cdb --- /dev/null +++ b/shoot.gd.uid @@ -0,0 +1 @@ +uid://dsd0opfd8kyow diff --git a/shoot.tscn b/shoot.tscn new file mode 100644 index 0000000..43aa131 --- /dev/null +++ b/shoot.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://b1jtii12cqye1"] + +[ext_resource type="Texture2D" uid="uid://ckgjtmh5asu4w" path="res://assets/shoot.png" id="1_ttj7r"] +[ext_resource type="Script" uid="uid://dsd0opfd8kyow" path="res://shoot.gd" id="1_vnmmp"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_yt1ub"] +radius = 5.0 + +[node name="shoot" type="RigidBody2D"] +collision_layer = 2 +collision_mask = 2 +mass = 0.001 +gravity_scale = 0.0 +script = ExtResource("1_vnmmp") +SPEED = 400.0 + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +texture = ExtResource("1_ttj7r") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_yt1ub") diff --git a/spawner.gd b/spawner.gd new file mode 100644 index 0000000..41349da --- /dev/null +++ b/spawner.gd @@ -0,0 +1,67 @@ +extends Node2D + +@export var asteroidx1 : PackedScene +@export var asteroidx2 : PackedScene +@export var asteroidx3 : PackedScene +@export var asteroidx4 : PackedScene +@export var player : CharacterBody2D +@export var distance:= 600.0 + +var current_time := 0.0 + + +var list_of_collision_1 : Array[Node] +var list_of_collision_2 : Array[Node] + +signal add_collision + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + var tmp : Vector2 + for i in range(list_of_collision_1.size()): + if list_of_collision_1[i] and list_of_collision_2[i]: + var normal_vec = (list_of_collision_1[i].position - list_of_collision_2[i].position).normalized() + tmp = list_of_collision_1[i].direction + list_of_collision_1[i].direction = (list_of_collision_2[i].direction + normal_vec).normalized() + list_of_collision_2[i].direction = (tmp - normal_vec).normalized() + list_of_collision_1 = [] + list_of_collision_2 = [] + current_time += delta + if current_time >= 2.0: + current_time = 0 + spawn() + +func spawn(): + var choice = randi_range(1, 4) + var new + if choice == 1: + new = asteroidx1.instantiate() + new.type = 1 + elif choice == 2: + new = asteroidx2.instantiate() + new.type = 2 + elif choice == 3: + new = asteroidx3.instantiate() + new.type = 3 + elif choice == 4: + new = asteroidx4.instantiate() + new.type = 4 + var new_global_position = Vector2(distance,0).rotated(randf_range(0.0, 360)) + Vector2(320, 320) + new.global_position = new_global_position + new.direction = (player.global_position - new_global_position).normalized() + add_child(new) + + +func _add_collision(body1 : Node, body2: Node) -> void: + for i in range(list_of_collision_1.size()): + if list_of_collision_1[i] == body1 and list_of_collision_2[i]== body2: + return + if list_of_collision_1[i] == body2 and list_of_collision_2[i] == body1: + return + list_of_collision_1.append(body1) + list_of_collision_2.append(body2) diff --git a/spawner.gd.uid b/spawner.gd.uid new file mode 100644 index 0000000..9c2c552 --- /dev/null +++ b/spawner.gd.uid @@ -0,0 +1 @@ +uid://bclp1tkc2npvv diff --git a/spawner.tscn b/spawner.tscn new file mode 100644 index 0000000..7ebba51 --- /dev/null +++ b/spawner.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=6 format=3 uid="uid://b6hqwxrexoa2n"] + +[ext_resource type="Script" uid="uid://bclp1tkc2npvv" path="res://spawner.gd" id="1_yp5lu"] +[ext_resource type="PackedScene" uid="uid://ditud5veuxqyb" path="res://asteroidx1.tscn" id="2_7ocbr"] +[ext_resource type="PackedScene" uid="uid://d2jxc24g18ab1" path="res://asteroidx2.tscn" id="3_mv5bd"] +[ext_resource type="PackedScene" uid="uid://buy8yafwaicq8" path="res://asteroidx3.tscn" id="4_h3fkd"] +[ext_resource type="PackedScene" uid="uid://xldavgivpb3j" path="res://asteroidx4.tscn" id="5_qmymf"] + +[node name="spawner" type="Node2D"] +script = ExtResource("1_yp5lu") +asteroidx1 = ExtResource("2_7ocbr") +asteroidx2 = ExtResource("3_mv5bd") +asteroidx3 = ExtResource("4_h3fkd") +asteroidx4 = ExtResource("5_qmymf") + +[connection signal="add_collision" from="." to="." method="_add_collision"]