This commit is contained in:
Ultrablob 2024-05-09 14:23:34 -04:00
parent f4dc1a79fd
commit f92b3a6f75
16 changed files with 217 additions and 39 deletions

View file

@ -38,6 +38,6 @@ func play():
var tip = pick(tip_options)
$LoadingScreen/Tip.text = "Tip: %s" % tip
await get_tree().create_timer(0.4).timeout
await get_tree().create_timer(0.8).timeout
var game = ResourceLoader.load_threaded_get(MAIN_SCENE_PATH)
get_tree().change_scene_to_packed(game)

19
RechargeProgress.gd Normal file
View file

@ -0,0 +1,19 @@
extends TextureProgressBar
var animating = false
func start_countdown(time: float):
animating = true
value = 100
var tween = get_tree().create_tween()
tween.tween_property(self, "value", 0, time)
await tween.finished
animating = false
func start_countup(time: float):
animating = true
value = 0
var tween = get_tree().create_tween()
tween.tween_property(self, "value", 100, time)
await tween.finished
animating = false

11
laser-ability.tscn Normal file
View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://1ex46dwbqgdn"]
[ext_resource type="PackedScene" uid="uid://d2xigwib6hka4" path="res://quare_ability.tscn" id="1_k107v"]
[ext_resource type="Texture2D" uid="uid://dtipytdgtqr88" path="res://laser-icon.png" id="2_wo0et"]
[node name="Laser" instance=ExtResource("1_k107v")]
stretch_margin_left = 0
stretch_margin_top = 0
stretch_margin_right = 0
stretch_margin_bottom = 0
texture_under = ExtResource("2_wo0et")

BIN
laser-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

34
laser-icon.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dtipytdgtqr88"
path="res://.godot/imported/laser-icon.png-6bdd4bc5f082cbdfbba8375dfc35129b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://laser-icon.png"
dest_files=["res://.godot/imported/laser-icon.png-6bdd4bc5f082cbdfbba8375dfc35129b.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

View file

@ -750,22 +750,6 @@ theme_override_fonts/font = ExtResource("11_s4q6p")
theme_override_font_sizes/font_size = 50
text = "wave 1"
[node name="Quare Count" type="Label" parent="UI"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 44.0
offset_top = -175.0
offset_right = 279.0
offset_bottom = -38.0
grow_vertical = 0
theme_override_constants/line_spacing = 0
theme_override_fonts/font = ExtResource("11_s4q6p")
theme_override_font_sizes/font_size = 50
text = "Gun"
vertical_alignment = 2
[node name="Stopwatch" type="Label" parent="UI"]
layout_mode = 1
anchors_preset = 1
@ -782,6 +766,18 @@ horizontal_alignment = 2
justification_flags = 160
script = ExtResource("13_xhnp2")
[node name="Ability" type="HBoxContainer" parent="UI"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 14.0
offset_top = -51.0
offset_right = 54.0
offset_bottom = -11.0
grow_vertical = 0
[node name="GameOver" type="Label" parent="."]
process_mode = 3
visible = false
@ -915,6 +911,7 @@ process_mode = 3
script = ExtResource("1_k8sg3")
[node name="Music" type="AudioStreamPlayer2D" parent="."]
position = Vector2(-13, 29)
stream = ExtResource("21_7hdkm")
autoplay = true

View file

@ -9,6 +9,7 @@ var active_texture = preload("res://laser_idle.png")
func _ready():
update_animation()
$"../".get_node("%Ability").add_child(preload("res://laser-ability.tscn").instantiate())
if config.load("user://settings.cfg") == OK:
absolute_movement = not config.get_value("config", "relative_controls")
speed = 750
@ -36,6 +37,7 @@ func _process(delta):
func fire_laser():
var tween = get_tree().create_tween()
speed = 0
$"../".get_node("%Ability/Laser").start_countup(1)
$Body.play("shoot")
tween.set_parallel(true)
tween.tween_callback(set_laser_texture.bind(aiming_texture))
@ -48,6 +50,7 @@ func fire_laser():
tween.tween_property(self, "can_damage", false, 0)
tween.tween_callback(set_laser_texture.bind(aiming_texture))
tween.set_parallel(true)
tween.tween_callback($"../".get_node("%Ability/Laser").start_countdown.bind(0.2))
tween.tween_property($Laser, "modulate", Color(Color.WHITE, 0.2), 0.2).set_ease(Tween.EASE_OUT)
tween.set_parallel(false)
tween.tween_callback(set_laser_texture.bind(idle_texture))

View file

@ -1,18 +1,25 @@
extends "res://player.gd"
var can_jump = true
func _ready():
speed = 1200
$"../".get_node("%Ability").add_child(preload("res://portal-ability.tscn").instantiate())
update_animation()
if config.load("user://settings.cfg") == OK:
absolute_movement = not config.get_value("config", "relative_controls")
func _input(event):
if event.is_action_pressed("jump"):
if event.is_action_pressed("jump") and can_jump:
can_jump = false
$"../".get_node("%Ability/Portal").start_countup(0.5)
$Sprite.speed_scale = 1
$Sprite.play("jump")
await $Sprite.animation_finished
$"../".get_node("%Ability/Portal").start_countdown(0.5)
global_position = get_global_mouse_position()
$Sprite.speed_scale = -1
$Sprite.play("jump")
await $Sprite.animation_finished
$Sprite.play("idle")
can_jump = true

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://c4ii0wvj20qe4"]
[gd_scene load_steps=31 format=3 uid="uid://c4ii0wvj20qe4"]
[ext_resource type="PackedScene" uid="uid://cgcjicue76wsr" path="res://player.tscn" id="1_l701f"]
[ext_resource type="Script" path="res://player-iamond.gd" id="2_5t06e"]
@ -176,6 +176,9 @@ animations = [{
[sub_resource type="Gradient" id="Gradient_urfxb"]
colors = PackedColorArray(1, 0.9, 0, 1, 1, 0.9, 0, 0)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_lcrvh"]
height = 52.0
[node name="Player" instance=ExtResource("1_l701f")]
linear_damp = 2.0
script = ExtResource("2_5t06e")
@ -183,17 +186,19 @@ script = ExtResource("2_5t06e")
[node name="Sprite" type="AnimatedSprite2D" parent="." index="1"]
scale = Vector2(2, 2)
sprite_frames = SubResource("SpriteFrames_7i6wq")
animation = &"idle"
animation = &"jump"
autoplay = "idle"
speed_scale = -1.0
[node name="Hitbox" type="CollisionPolygon2D" parent="." index="2"]
position = Vector2(12, 0)
polygon = PackedVector2Array(33, 0, 5, -14, -21, 0, 5, 14)
[node name="CPUParticles2D" type="CPUParticles2D" parent="." index="3"]
position = Vector2(-23, 0)
[node name="CPUParticles2D" type="CPUParticles2D" parent="." index="2"]
z_index = -2
position = Vector2(-9, 0)
amount = 80
texture = ExtResource("5_fmfr6")
gravity = Vector2(2.08165e-12, 2.08165e-12)
color_ramp = SubResource("Gradient_urfxb")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="3"]
position = Vector2(19, 0)
rotation = -1.5708
shape = SubResource("CapsuleShape2D_lcrvh")

View file

@ -1,5 +1,11 @@
extends "res://player.gd"
var num_quares = 0
var max_quares = 3
var exagons = 0
var quare_ability = preload("res://quare_ability.tscn")
func update_animation():
if moving:
$AnimatedSprite2D.play("moving")
@ -7,7 +13,8 @@ func update_animation():
$AnimatedSprite2D.play("idle")
func _ready():
update_display()
for i in range(max_quares):
$"../".get_node("%Ability").add_child(quare_ability.instantiate())
update_animation()
if config.load("user://settings.cfg") == OK:
absolute_movement = not config.get_value("config", "relative_controls")
@ -17,7 +24,10 @@ func _input(event):
if num_quares >= max_quares:
notifier.notify("All Quares in Use!")
return
for child in $"../".get_node("%Ability").get_children():
if child.value == 0 and not child.animating:
child.value = 100
break
if not $"../CollisionCheck".is_clear(get_global_mouse_position(), 60):
$"../CollisionCheck".flash()
notifier.notify("Too Close!")
@ -27,7 +37,6 @@ func _input(event):
new_quare.position = get_global_mouse_position()
$/root/Node2D.add_child(new_quare)
new_quare.name = "Quare"
update_display()
if event.is_action_pressed("exagon"):
if exagons > 1:
exagons = 1
@ -44,25 +53,19 @@ func _input(event):
new_exagon.position = get_global_mouse_position()
$/root/Node2D.add_child(new_exagon)
new_exagon.name = "Exagon"
update_display()
#$Gun.shoot()
func aquire_quare():
for child in $"../".get_node("%Ability").get_children():
if child.value == 100 and not child.animating:
child.start_countdown(3)
break
await get_tree().create_timer(3).timeout
num_quares -= 1
$QuareFX.play()
update_display()
func aquire_exagon():
await get_tree().create_timer(15).timeout
exagons += 1
$ExagonFX.play()
update_display()
func update_display():
$"/root/Node2D/UI/Quare Count".text = "%d Quares\n" % [(max_quares - num_quares)]
var num_quares = 0
var max_quares = 3
var exagons = 0

7
portal-ability.tscn Normal file
View file

@ -0,0 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://bl3178jc8lq1x"]
[ext_resource type="PackedScene" uid="uid://d2xigwib6hka4" path="res://quare_ability.tscn" id="1_ttx3n"]
[ext_resource type="Texture2D" uid="uid://dgd2mofq75e01" path="res://portal-icon.png" id="2_2epev"]
[node name="Portal" instance=ExtResource("1_ttx3n")]
texture_under = ExtResource("2_2epev")

BIN
portal-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

34
portal-icon.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dgd2mofq75e01"
path="res://.godot/imported/portal-icon.png-3b1ae569eea6160c02da833f62fdd212.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://portal-icon.png"
dest_files=["res://.godot/imported/portal-icon.png-3b1ae569eea6160c02da833f62fdd212.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

24
quare_ability.tscn Normal file
View file

@ -0,0 +1,24 @@
[gd_scene load_steps=5 format=3 uid="uid://d2xigwib6hka4"]
[ext_resource type="Texture2D" uid="uid://ba2tcipuc8rdi" path="res://quare 2.png" id="1_thx02"]
[ext_resource type="Texture2D" uid="uid://barlie6sierj" path="res://square.png" id="2_odtey"]
[ext_resource type="Script" path="res://RechargeProgress.gd" id="3_gufwx"]
[sub_resource type="AtlasTexture" id="AtlasTexture_lvo18"]
atlas = ExtResource("1_thx02")
region = Rect2(2.08165e-12, 2.08165e-12, 64, 64)
[node name="Quare" type="TextureProgressBar"]
custom_minimum_size = Vector2(64, 64)
step = 0.1
fill_mode = 5
nine_patch_stretch = true
stretch_margin_left = 2
stretch_margin_top = 2
stretch_margin_right = 2
stretch_margin_bottom = 2
texture_under = SubResource("AtlasTexture_lvo18")
texture_progress = ExtResource("2_odtey")
texture_progress_offset = Vector2(2.08165e-12, 2.08165e-12)
tint_progress = Color(0, 0, 0, 0.443137)
script = ExtResource("3_gufwx")

BIN
square.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

34
square.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://barlie6sierj"
path="res://.godot/imported/square.png-51b8b31f216285d75f625619e7157806.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://square.png"
dest_files=["res://.godot/imported/square.png-51b8b31f216285d75f625619e7157806.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