diff --git a/assets/_RAW_/comet.pxo b/assets/_RAW_/comet.pxo new file mode 100644 index 0000000..6ab61d4 Binary files /dev/null and b/assets/_RAW_/comet.pxo differ diff --git a/assets/img/comet.png b/assets/img/comet.png new file mode 100644 index 0000000..a4a4d77 Binary files /dev/null and b/assets/img/comet.png differ diff --git a/assets/img/comet.png.import b/assets/img/comet.png.import new file mode 100644 index 0000000..ba98d55 --- /dev/null +++ b/assets/img/comet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://54mfrkbp1kcg" +path="res://.godot/imported/comet.png-dae93592e3bed3dc4301ca1bc441e685.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/img/comet.png" +dest_files=["res://.godot/imported/comet.png-dae93592e3bed3dc4301ca1bc441e685.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/comet.gd b/scenes/comet.gd new file mode 100644 index 0000000..1a79093 --- /dev/null +++ b/scenes/comet.gd @@ -0,0 +1,14 @@ +extends Area2D + +@export var movement_speed := 600 + +var rotation_speed : int +var rotaion_direction : int + +func _ready() -> void: + rotaion_direction = randi_range(-1, 1) + rotation_speed = randi_range(50, 250) + +func _physics_process(delta: float) -> void: + rotate(deg_to_rad(rotaion_direction * rotation_speed * delta)) + diff --git a/scenes/comet.tscn b/scenes/comet.tscn index 35cabb2..0241d65 100644 --- a/scenes/comet.tscn +++ b/scenes/comet.tscn @@ -1,3 +1,13 @@ -[gd_scene format=3 uid="uid://bsonrs8vhtly8"] +[gd_scene load_steps=3 format=3 uid="uid://bsonrs8vhtly8"] + +[ext_resource type="Texture2D" uid="uid://54mfrkbp1kcg" path="res://assets/img/comet.png" id="1_6q67h"] +[ext_resource type="Script" path="res://scenes/comet.gd" id="1_33qxe"] [node name="Comet" type="Area2D"] +script = ExtResource("1_33qxe") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_6q67h") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(19, -27, 22, -25, 25, -24, 27, -21, 31, -17, 32, -3, 32, 27, 27, 30, -8, 29, -17, 28, -25, 26, -32, 22, -32, 18, -23, 8, -20, 7, -21, 2, -29, -17, -29, -26, -27, -29, -25, -32, -14, -32, 0, -30) diff --git a/scenes/game.tscn b/scenes/game.tscn index 6059089..bf1e3e2 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://bdarunpk3c2eh"] +[gd_scene load_steps=3 format=3 uid="uid://bdarunpk3c2eh"] [ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"] +[ext_resource type="PackedScene" uid="uid://bsonrs8vhtly8" path="res://scenes/comet.tscn" id="2_b37uv"] [node name="Game" type="Node2D"] @@ -19,3 +20,6 @@ color = Color(0, 0, 0, 1) [node name="Ship" parent="." instance=ExtResource("1_esyqo")] z_index = 1 position = Vector2(622, 309) + +[node name="Comet" parent="." instance=ExtResource("2_b37uv")] +position = Vector2(276, 249) diff --git a/scripts/ship.gd b/scripts/ship.gd index 6071f06..b005e87 100644 --- a/scripts/ship.gd +++ b/scripts/ship.gd @@ -38,7 +38,7 @@ func fire_gun(pos : Vector2, rot : float) -> void: bullet.position = pos bullet.rotation = rot $Projectiles.add_child(bullet) - $ShootSound.play() + $ShootSounds.play() can_shoot = false $ShotCooldown.start()