Roughed in dynamic CRT enemy movement; tweaked parallax cloud movement
and sprites.
This commit is contained in:
parent
26803702b1
commit
661098529d
12 changed files with 134 additions and 27 deletions
|
|
@ -14,7 +14,7 @@ var enemy_shoot_aggression = randf_range(4, 20)
|
|||
|
||||
|
||||
func start(pos):
|
||||
speed = 0
|
||||
speed = 0
|
||||
position = Vector2(pos.x, -pos.y)
|
||||
start_pos = pos
|
||||
await get_tree().create_timer(randf_range(0.25, 0.55)).timeout
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ scale = Vector2(0.7, 0.7)
|
|||
script = ExtResource("1_s7c3p")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2115910138]
|
||||
scale = Vector2(1.44, 1.44)
|
||||
texture = ExtResource("2_h1rgn")
|
||||
hframes = 3
|
||||
region_enabled = true
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ extends Area2D
|
|||
var bullet_scene = preload("res://scenes/enemy_bullet.tscn")
|
||||
var start_pos = Vector2.ZERO
|
||||
var speed = 0
|
||||
var direction = Vector2(0,1)
|
||||
var tween_speed: float = 1.4
|
||||
|
||||
var exploding = false
|
||||
|
|
@ -11,11 +12,17 @@ var enemy_move_aggression = randf_range(5, 20)
|
|||
var enemy_shoot_aggression = randf_range(4, 20)
|
||||
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
@onready var timer = $MoveTimer
|
||||
|
||||
|
||||
func _ready():
|
||||
timer.start()
|
||||
|
||||
func start(pos):
|
||||
speed = 0
|
||||
position = Vector2(pos.x, -pos.y)
|
||||
speed = 2
|
||||
var pos_mod = randf_range(-32,32) #modify the start position randomly
|
||||
position = Vector2(pos.x + pos_mod, -pos.y) #add the modifier
|
||||
#position = Vector2(pos.x, -pos.y)
|
||||
start_pos = pos
|
||||
await get_tree().create_timer(randf_range(0.25, 0.55)).timeout
|
||||
var tween = create_tween().set_trans(Tween.TRANS_BACK)
|
||||
|
|
@ -26,9 +33,21 @@ func start(pos):
|
|||
$ShootTimer.wait_time = enemy_shoot_aggression
|
||||
$ShootTimer.start()
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
func _on_timer_timeout():
|
||||
speed = randf_range(75, 100)
|
||||
$DirectionTimer.start()
|
||||
|
||||
func _on_direction_timer_timeout():
|
||||
direction = Vector2(randf_range(-1, 1), randf_range(0, 1))
|
||||
direction = direction.snapped(Vector2(0,1))
|
||||
match direction:
|
||||
Vector2(0,1):
|
||||
$EnemyCRT.set_frame(0)
|
||||
Vector2(1,0):
|
||||
$EnemyCRT.set_frame(1)
|
||||
Vector2(-1,0):
|
||||
$EnemyCRT.set_frame(2)
|
||||
$DirectionTimer.start()
|
||||
|
||||
func _on_shoot_timer_timeout():
|
||||
var b = bullet_scene.instantiate()
|
||||
|
|
@ -38,9 +57,36 @@ func _on_shoot_timer_timeout():
|
|||
$ShootTimer.start()
|
||||
|
||||
func _process(delta):
|
||||
position.y += speed * delta
|
||||
position += direction * speed * delta
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#direction = direction.snapped(Vector2(1, 0)) # Snap to horizontal
|
||||
#direction = direction.snapped(Vector2(0, 1)) # Snap to vertical
|
||||
|
||||
|
||||
|
||||
if position.y > screensize.y + 32:
|
||||
start(start_pos)
|
||||
|
||||
#if position.x > screensize.x + 32:
|
||||
#start(start_pos)
|
||||
#
|
||||
#if position.x < screensize.x + 32:
|
||||
#start(start_pos)
|
||||
|
||||
#if Input.is_action_just_pressed("ui_right"):
|
||||
#direction = Vector2(1, 0) # Move right
|
||||
#elif Input.is_action_just_pressed("ui_left"):
|
||||
#direction = Vector2(-1, 0) # Move left
|
||||
#elif Input.is_action_just_pressed("ui_up"):
|
||||
#direction = Vector2(0, -1) # Move up
|
||||
#elif Input.is_action_just_pressed("ui_down"):
|
||||
#direction = Vector2(0, 1) # Move down
|
||||
|
||||
|
||||
|
||||
|
||||
func explode():
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
[gd_scene format=3 uid="uid://dm0pkef7wmwuq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://i0r17jo6838m" path="res://scenes/enemy_chicken.gd" id="1_0vjqj"]
|
||||
[ext_resource type="Script" uid="uid://7ls7phfcupal" path="res://scenes/enemy_crt.gd" id="1_ugdur"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5pswf7r8b7j4" path="res://sprites/crt.png" id="2_emiuq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy4jggxmnohbb" path="res://sprites/chicken.png" id="2_ugdur"]
|
||||
[ext_resource type="Texture2D" uid="uid://bm7fgqwqfqmf4" path="res://sprites/explosion_pallete-swap.png" id="3_emiuq"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4gyqm"]
|
||||
size = Vector2(45.71434, 40.000053)
|
||||
size = Vector2(32.727318, 27.272764)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_h1rgn"]
|
||||
length = 0.001
|
||||
|
|
@ -32,7 +32,7 @@ tracks/1/keys = {
|
|||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_ugdur")]
|
||||
"values": [ExtResource("2_emiuq")]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
|
|
@ -56,7 +56,7 @@ tracks/3/keys = {
|
|||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Rect2(0, 0, 84, 32)]
|
||||
"values": [Rect2(0, 0, 96, 28)]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
|
|
@ -196,18 +196,16 @@ _data = {
|
|||
}
|
||||
|
||||
[node name="EnemyCRT" type="Area2D" unique_id=1433837580 groups=["enemies"]]
|
||||
scale = Vector2(1.1, 1.1)
|
||||
script = ExtResource("1_0vjqj")
|
||||
script = ExtResource("1_ugdur")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2115910138]
|
||||
scale = Vector2(1.44, 1.44)
|
||||
texture = ExtResource("2_emiuq")
|
||||
hframes = 3
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 96, 28)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1841693239]
|
||||
position = Vector2(-1.8732879e-06, -1.9584381e-06)
|
||||
position = Vector2(4.334883e-07, 4.334883e-07)
|
||||
scale = Vector2(0.99999857, 0.99999857)
|
||||
shape = SubResource("RectangleShape2D_4gyqm")
|
||||
|
||||
|
|
@ -218,8 +216,11 @@ one_shot = true
|
|||
one_shot = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=702523492]
|
||||
active = false
|
||||
libraries/ = SubResource("AnimationLibrary_7ellt")
|
||||
|
||||
[node name="DirectionTimer" type="Timer" parent="." unique_id=2080229505]
|
||||
wait_time = 5.0
|
||||
|
||||
[connection signal="timeout" from="MoveTimer" to="." method="_on_timer_timeout"]
|
||||
[connection signal="timeout" from="ShootTimer" to="." method="_on_shoot_timer_timeout"]
|
||||
[connection signal="timeout" from="DirectionTimer" to="." method="_on_direction_timer_timeout"]
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@ func _on_goose_talk(frame_index: int):
|
|||
tween.tween_property(self, "position:x", position.x + 50, .5).set_ease(tween.EASE_IN)
|
||||
await tween.finished
|
||||
goose_talking = false
|
||||
self.hide()
|
||||
self.hide()
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ size = Vector2(73, 100)
|
|||
script = ExtResource("1_wf0t2")
|
||||
|
||||
[node name="DapperGoose" type="Sprite2D" parent="." unique_id=1690665905]
|
||||
z_index = -4
|
||||
texture = ExtResource("1_wo8sg")
|
||||
|
||||
[node name="Bubble" type="Sprite2D" parent="DapperGoose" unique_id=2012258473]
|
||||
z_index = -5
|
||||
position = Vector2(-108, -21)
|
||||
texture = ExtResource("3_g7ad0")
|
||||
hframes = 4
|
||||
|
|
|
|||
|
|
@ -124,6 +124,5 @@ stream = ExtResource("10_choun")
|
|||
volume_db = -0.5
|
||||
|
||||
[node name="Wave" parent="." unique_id=2117861058 instance=ExtResource("11_ya4ey")]
|
||||
wave_complete = null
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/CenterContainer/Start" to="." method="_on_start_pressed"]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene format=3 uid="uid://tlcdxoupi2lb"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b5ukhu38gqv6" path="res://sprites/cloud layers.png" id="1_b1x6b"]
|
||||
[ext_resource type="Texture2D" uid="uid://cu1hmiru4slak" path="res://sprites/coffee-buoy.png" id="2_pcgsf"]
|
||||
|
||||
[node name="Parallax Starfield" type="Node2D" unique_id=1859128454]
|
||||
[node name="Parallax Clouds" type="Node2D" unique_id=1859128454]
|
||||
z_index = -100
|
||||
|
||||
[node name="Foreground" type="Parallax2D" parent="." unique_id=1810383542]
|
||||
|
|
@ -107,6 +108,23 @@ flip_h = true
|
|||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 64, 64)
|
||||
|
||||
[node name="Coffee Buoy" type="Parallax2D" parent="." unique_id=813362228]
|
||||
self_modulate = Color(0.5931336, 0.59313357, 0.59313357, 1)
|
||||
scroll_scale = Vector2(1, -2)
|
||||
repeat_size = Vector2(0, 375)
|
||||
autoscroll = Vector2(0, 1)
|
||||
repeat_times = 3
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Coffee Buoy" unique_id=997370246]
|
||||
position = Vector2(150, 205)
|
||||
texture = ExtResource("2_pcgsf")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="Coffee Buoy" unique_id=603875955]
|
||||
position = Vector2(85, 45)
|
||||
scale = Vector2(0.75, 0.75)
|
||||
texture = ExtResource("2_pcgsf")
|
||||
flip_h = true
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=23364495]
|
||||
z_index = -5
|
||||
offset_right = 239.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func _ready():
|
|||
|
||||
func spawn_enemies():
|
||||
|
||||
if wave_count == 0: #This is for CHICKENS
|
||||
if wave_count == 1: #This is for CHICKENS
|
||||
print("Enemy Wave: ", wave_count)
|
||||
enemy = CHICKEN
|
||||
for x in range(COLS):
|
||||
|
|
@ -32,18 +32,20 @@ func spawn_enemies():
|
|||
await get_tree().process_frame
|
||||
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
|
||||
|
||||
if wave_count == 1: #This is for CRTs
|
||||
if wave_count == 0: #This is for CRTs
|
||||
print("Enemy Wave: ", wave_count)
|
||||
enemy = CRT
|
||||
for x in range(COLS):
|
||||
for y in range(ROWS):
|
||||
var cols_mod = COLS - 1
|
||||
var rows_mod = ROWS - 1
|
||||
for x in range(cols_mod):
|
||||
for y in range(rows_mod):
|
||||
var pos_mod = int (randf_range(-42,32))
|
||||
var e = enemy.instantiate()
|
||||
var pos = Vector2(x * (28 + 4) + 56, 28 * 2 + y * 38)
|
||||
var pos = Vector2(x * (36 + 12) + 56, 28 * 2 + y * 38)
|
||||
add_child(e)
|
||||
e.start(pos)
|
||||
enemy_count = ROWS * COLS
|
||||
e.start(pos + Vector2(pos_mod, y))
|
||||
enemy_count = rows_mod * cols_mod
|
||||
await get_tree().process_frame
|
||||
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
sprites/coffee-buoy.png
Normal file
BIN
sprites/coffee-buoy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 496 B |
40
sprites/coffee-buoy.png.import
Normal file
40
sprites/coffee-buoy.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cu1hmiru4slak"
|
||||
path="res://.godot/imported/coffee-buoy.png-b7fec6fc51a2926623b0d4a4c83e8305.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/coffee-buoy.png"
|
||||
dest_files=["res://.godot/imported/coffee-buoy.png-b7fec6fc51a2926623b0d4a4c83e8305.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue