diff --git a/assets/PNG/Effects/star2.png b/assets/PNG/Effects/star2.png index a047ef6..da5941d 100644 Binary files a/assets/PNG/Effects/star2.png and b/assets/PNG/Effects/star2.png differ diff --git a/assets/PNG/Effects/star2.png.import b/assets/PNG/Effects/star2.png.import index 637774b..315fec2 100644 --- a/assets/PNG/Effects/star2.png.import +++ b/assets/PNG/Effects/star2.png.import @@ -2,7 +2,7 @@ importer="texture" type="CompressedTexture2D" -uid="uid://c8v1702r7x6u0" +uid="uid://dfuim8wosxlf6" path="res://.godot/imported/star2.png-a8da2aefc14c7956b80c236cd1d26ae7.ctex" metadata={ "vram_texture": false diff --git a/assets/PNG/Effects/star3.png b/assets/PNG/Effects/star3.png index c9026d3..583b87b 100644 Binary files a/assets/PNG/Effects/star3.png and b/assets/PNG/Effects/star3.png differ diff --git a/assets/PNG/Effects/star3.png.import b/assets/PNG/Effects/star3.png.import index 9f7ed8f..07a8b32 100644 --- a/assets/PNG/Effects/star3.png.import +++ b/assets/PNG/Effects/star3.png.import @@ -2,7 +2,7 @@ importer="texture" type="CompressedTexture2D" -uid="uid://cdbqio5x3gctt" +uid="uid://svpvjp4tn6sh" path="res://.godot/imported/star3.png-a788aeb564f38183a190461aebb57397.ctex" metadata={ "vram_texture": false diff --git a/laser.gd b/laser.gd index cfa21b3..688280a 100644 --- a/laser.gd +++ b/laser.gd @@ -5,10 +5,10 @@ extends Area2D # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. - + var tween = create_tween() + tween.tween_property($Sprite2D,'scale',Vector2(1,1),0.3).from(Vector2(0,0)) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - position += Vector2(0,-speed) * delta - speed += accel * delta + position += Vector2(0,-speed) * delta + speed += accel * delta diff --git a/level.gd b/level.gd index e1b3e04..aa86295 100644 --- a/level.gd +++ b/level.gd @@ -2,13 +2,29 @@ extends Node2D var meteor_scene: PackedScene = load('res://meteor.tscn') var laser_scene: PackedScene = load("res://laser.tscn") +var star_scene: PackedScene = load("res://star.tscn") +var num_stars = 100 + +func _ready(): + var rng := RandomNumberGenerator.new() + var width = get_viewport().get_visible_rect().size[0] + var height = get_viewport().get_visible_rect().size[1] + for i in num_stars: + var star = star_scene.instantiate() + star.position.x = rng.randi_range(0,width) + star.position.y = rng.randi_range(0,height) + var random_scale = rng.randf_range(0.8,1.3) + star.scale = Vector2(random_scale,random_scale) + star.speed_scale = rng.randf_range(0.5,2) + $Stars.add_child(star) + func _on_meteor_timer_timeout() -> void: - var meteor = meteor_scene.instantiate() - $Meteors.add_child(meteor) + var meteor = meteor_scene.instantiate() + $Meteors.add_child(meteor) func _on_player_laser(pos) -> void: - var laser = laser_scene.instantiate() - $Lasers.add_child(laser) - laser.position = pos + var laser = laser_scene.instantiate() + $Lasers.add_child(laser) + laser.position = pos diff --git a/level.tscn b/level.tscn index c076c1a..2b72d87 100644 --- a/level.tscn +++ b/level.tscn @@ -26,11 +26,12 @@ size = Vector2(1944, 40) script = ExtResource("1_6hg4u") [node name="BG" type="Sprite2D" parent="."] -visible = false position = Vector2(960.328, 542.684) scale = Vector2(1.02466, 1.05614) texture = SubResource("NoiseTexture2D_emidv") +[node name="Stars" type="Node2D" parent="."] + [node name="Player" parent="." instance=ExtResource("1_48d8j")] position = Vector2(960, 541) diff --git a/player.tscn b/player.tscn index c92a2ac..9475470 100644 --- a/player.tscn +++ b/player.tscn @@ -13,7 +13,7 @@ texture = ExtResource("1_atygw") polygon = PackedVector2Array(-7, -38, 8, -38, 13, -13, 35, 2, 47, -7, 46, 24, 14, 28, 9, 38, -7, 38, -14, 28, -45, 22, -48, -5, -36, 2, -12, -12) [node name="LaserSpawnPos" type="Marker2D" parent="."] -position = Vector2(0, -61) +position = Vector2(0, -42) [node name="LaserCooldown" type="Timer" parent="."] wait_time = 0.5 diff --git a/star.gd b/star.gd new file mode 100644 index 0000000..9897787 --- /dev/null +++ b/star.gd @@ -0,0 +1,7 @@ +extends AnimatedSprite2D + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + self.play() + diff --git a/star.tscn b/star.tscn new file mode 100644 index 0000000..d0984a8 --- /dev/null +++ b/star.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=6 format=3 uid="uid://dig4tkq61hqip"] + +[ext_resource type="Texture2D" uid="uid://c6trmwwrqgjqt" path="res://assets/PNG/Effects/star1.png" id="1_sulif"] +[ext_resource type="Texture2D" uid="uid://dfuim8wosxlf6" path="res://assets/PNG/Effects/star2.png" id="2_vgvua"] +[ext_resource type="Texture2D" uid="uid://svpvjp4tn6sh" path="res://assets/PNG/Effects/star3.png" id="3_6t4o4"] +[ext_resource type="Script" path="res://star.gd" id="3_onsr2"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_kvvtk"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("1_sulif") +}, { +"duration": 1.0, +"texture": ExtResource("2_vgvua") +}, { +"duration": 1.0, +"texture": ExtResource("3_6t4o4") +}, { +"duration": 1.0, +"texture": ExtResource("2_vgvua") +}], +"loop": true, +"name": &"default", +"speed": 10.0 +}] + +[node name="Star" type="AnimatedSprite2D"] +sprite_frames = SubResource("SpriteFrames_kvvtk") +frame_progress = 0.525576 +script = ExtResource("3_onsr2")