This commit is contained in:
Ultrablob 2024-05-06 10:05:42 -04:00
parent 100572749a
commit 11a54f2b94
22 changed files with 304 additions and 532 deletions

BIN
.DS_Store vendored

Binary file not shown.

10
Blink.gd Normal file
View file

@ -0,0 +1,10 @@
extends "res://LockedRotation.gd"
@export var off_color = Color.TRANSPARENT
func blink():
while true:
self_modulate = off_color
await $Timer.timeout
self_modulate = Color.WHITE
await $Timer.timeout

View file

@ -3,6 +3,7 @@ extends ShapeCast2D
func is_clear(area: Vector2, radius=100):
position = area
shape.radius = radius
#$Sprite2D.scale = Vector2.ONE * 0.375 * (radius/100)
force_shapecast_update()
return get_collision_count() == 0

View file

@ -34,6 +34,7 @@ func _on_request_completed(result, response_code, headers, body):
var placement = float(json["position"])
print(placement)
$"../Summary".text = "You reached wave %d in %s" % [spawner.wave_count-1, seconds2mmss(stopwatch.time_since_wave if stopwatch.time_since_wave != 0 else stopwatch.time_elapsed)]
if placement >= 1:
text = "[center]You placed #%d\n[/center]" % [placement]
else:

View file

@ -5,9 +5,6 @@ var rotation_speed = 3 # turning speed in radians/sec
var quare = preload("res://quare.tscn")
var exagon = preload("res://exagon.tscn")
@onready var notifier = $"../Notification"
var num_quares = 0
var max_quares = 3
var exagons = 0
var absolute_movement = false
var config = ConfigFile.new()
@ -16,7 +13,6 @@ const moving_anim = preload("res://player_moving.gif")
var moving = false
func _ready():
update_display()
update_animation()
if config.load("user://settings.cfg") == OK:
absolute_movement = not config.get_value("config", "relative_controls")
@ -41,62 +37,10 @@ func _physics_process(delta):
update_animation()
if absolute_movement:
apply_central_force(Vector2(side_input * speed, move_input * speed) * -1)
apply_central_force(Vector2(side_input, move_input).normalized() * -speed)
else:
apply_central_force(transform.y * side_input * speed / -2 + transform.x * move_input * speed)
func _input(event):
if event.is_action_pressed("jump"):
global_position = get_global_mouse_position()
if event.is_action_pressed("quare"):
if num_quares >= max_quares:
notifier.notify("All Quares in Use!")
return
if not $"../CollisionCheck".is_clear(get_global_mouse_position(), 60):
$"../CollisionCheck".flash()
notifier.notify("Too Close!")
return
num_quares += 1
var new_quare = quare.instantiate()
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
if exagons <= 0:
notifier.notify("No Exagons!")
return
if not $"../CollisionCheck".is_clear(get_global_mouse_position()):
$"../CollisionCheck".flash()
notifier.notify("Too Close!")
return
exagons -= 1
var new_exagon = exagon.instantiate()
new_exagon.position = get_global_mouse_position()
$/root/Node2D.add_child(new_exagon)
new_exagon.name = "Exagon"
update_display()
#$Gun.shoot()
func aquire_quare():
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():
$"../UI/Quare Count".text = "%d Quares\n" % [(max_quares - num_quares)]
func destroy():
$DeathFX.play()
get_tree().paused = true

View file

@ -4,7 +4,8 @@ extends Node2D
@export var wave_label: Label
var portal = preload("res://portal.tscn")
var enemies_previous = false
var wave_count = 0
@export var start_wave = 0
var wave_count = start_wave
func _ready():
spawn_loop()
@ -19,48 +20,55 @@ func check_enemies_loop():
enemies_previous = has_enemies
func spawn_loop():
for wave in waves:
for wave in waves.slice(start_wave):
wave_count += 1
wave_label.text = "Wave %d" % wave_count
print("Starting Next Wave")
for i in range(len(wave.enemies)):
spawn_enemies(wave.quantities[i], wave.spawning_duration, wave.enemies[i])
if wave.wait_for_killed:
await all_enemies_perished
else:
await get_tree().create_timer(wave.spawning_duration).timeout
if wave.wait_for_killed:
enemies_previous = true
await all_enemies_perished
print("all enemies perished")
await get_tree().create_timer(wave.wait).timeout
wave_complete.emit()
wave_count += 1
$"../GameOver".text = "YOU WIN!"
$"../Player".destroy()
func spawn_enemies(count: int, duration: float, enemy: WaveEnemy):
var delay = duration / count
for i in range(count):
await get_tree().create_timer(delay).timeout
spawn(enemy)
await get_tree().create_timer(delay).timeout
func spawn(item: WaveEnemy):
var spawn_loc = Vector2.ZERO
if item.boss:
print("Spawning Boss!")
spawn_loc = Vector2(1920/2, 1080/2)
else:
for i in range(10):
for i in range(100):
var test_pos = Vector2(randf(), randf()) * Vector2(1920, 1080)
if not $"../CollisionCheck".is_clear(test_pos, item.check_distance):
continue
spawn_loc = test_pos
break
if spawn_loc == Vector2.ZERO:
return
if not item.boss:
var portal_effect = portal.instantiate()
portal_effect.global_position = spawn_loc
portal_effect.sprite_frames = item.portal_texture
$/root/Node2D.add_child(portal_effect)
await get_tree().create_timer(0.6).timeout
await get_tree().create_timer((item.portal_texture.get_frame_count("default") / 2) * (1 / item.portal_texture.get_animation_speed("default"))).timeout
var node = item.enemy.instantiate()
node.global_position = spawn_loc
if not item.boss:

View file

@ -7,5 +7,6 @@
[resource]
script = ExtResource("3_t4kaf")
enemy = ExtResource("1_mfudl")
boss = false
portal_texture = ExtResource("2_2xm8e")
check_distance = 100
check_distance = 400

View file

@ -1,11 +1,82 @@
[gd_scene load_steps=7 format=3 uid="uid://c87easb8570vd"]
[gd_scene load_steps=17 format=3 uid="uid://c87easb8570vd"]
[ext_resource type="PhysicsMaterial" uid="uid://c5tm7od8mwjjb" path="res://elastic.tres" id="1_1oplx"]
[ext_resource type="Script" path="res://Shield.gd" id="2_q7qjq"]
[ext_resource type="Texture2D" uid="uid://xq1dd6w22i6f" path="res://Hexagon outline.png" id="2_x53yb"]
[ext_resource type="Texture2D" uid="uid://comgu2t784y8f" path="res://shield.png" id="3_hrquq"]
[ext_resource type="SpriteFrames" uid="uid://6oj6l7lnsjhi" path="res://exagon.gif" id="4_cfpay"]
[ext_resource type="AudioStream" uid="uid://b73ik24u615jc" path="res://phaserDown1.ogg" id="5_8ceda"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fi50y"]
atlas = ExtResource("3_hrquq")
region = Rect2(0, 0, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_evg51"]
atlas = ExtResource("3_hrquq")
region = Rect2(128, 0, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_gq34g"]
atlas = ExtResource("3_hrquq")
region = Rect2(256, 0, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_b1q8y"]
atlas = ExtResource("3_hrquq")
region = Rect2(0, 128, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_q6ecx"]
atlas = ExtResource("3_hrquq")
region = Rect2(128, 128, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_mlwqr"]
atlas = ExtResource("3_hrquq")
region = Rect2(256, 128, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_faf3x"]
atlas = ExtResource("3_hrquq")
region = Rect2(0, 256, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_1s48p"]
atlas = ExtResource("3_hrquq")
region = Rect2(128, 256, 128, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_e7kdo"]
atlas = ExtResource("3_hrquq")
region = Rect2(256, 256, 128, 128)
[sub_resource type="SpriteFrames" id="SpriteFrames_2kvmu"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fi50y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_evg51")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gq34g")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_b1q8y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_q6ecx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mlwqr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_faf3x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1s48p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e7kdo")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_evq3y"]
radius = 25.0
@ -17,13 +88,19 @@ collision_mask = 2
physics_material_override = ExtResource("1_1oplx")
script = ExtResource("2_q7qjq")
[node name="Sprite" type="Sprite2D" parent="Shield"]
[node name="Sprite" type="AnimatedSprite2D" parent="Shield"]
self_modulate = Color(0.529412, 0.819608, 1, 0.27451)
texture = ExtResource("2_x53yb")
z_index = 2
position = Vector2(17, 2)
rotation = 1.5708
scale = Vector2(4.39062, 4.39062)
sprite_frames = SubResource("SpriteFrames_2kvmu")
frame_progress = 0.973867
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shield"]
visible = false
position = Vector2(13, 194)
polygon = PackedVector2Array(-13, -443, 204, -317, 206, -69, -12, 57, -231, -71, -231, -316)
polygon = PackedVector2Array(-13, -443, 209, -330, 206, -69, -12, 57, -231, -38, -231, -343)
[node name="PowerDownFX" type="AudioStreamPlayer2D" parent="Shield"]
stream = ExtResource("5_8ceda")

View file

@ -8,7 +8,7 @@ custom_features=""
export_filter="exclude"
export_files=PackedStringArray("res://godotgif/godotgif.gdextension")
include_filter="*.txt"
exclude_filter="*.cache"
exclude_filter=""
export_path="../Build/index.html"
encryption_include_filters=""
encryption_exclude_filters=""

View file

@ -7,5 +7,6 @@
[resource]
script = ExtResource("3_0eg7c")
enemy = ExtResource("1_rot3q")
boss = false
portal_texture = ExtResource("2_7xiki")
check_distance = 100
check_distance = 200

499
main.tscn

File diff suppressed because one or more lines are too long

View file

@ -177,9 +177,15 @@ grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("4_ybv7t")
theme_override_font_sizes/font_size = 60
text = "! GAMING !"
text = "enemies spawn in waves, kill them all to proceeed to the next wave.
Place a quare with q, to block shots or redirect the ectangle.
Get leaderboard positions by beating waves as fast as possible
"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 3
[node name="ColorRect" type="ColorRect" parent="Tutorial Text"]
z_index = -1
@ -248,8 +254,8 @@ text = "[center][wave]LOADING..."
[connection signal="pressed" from="Layout/Play" to="." method="play"]
[connection signal="pressed" from="Layout/Settings" to="Settings Panel" method="show"]
[connection signal="pressed" from="Layout/Tutorial" to="Tutorial Text" method="show"]
[connection signal="pressed" from="Settings Panel/Close" to="Settings Panel" method="save"]
[connection signal="pressed" from="Settings Panel/Close" to="Settings Panel" method="hide"]
[connection signal="pressed" from="Settings Panel/Close" to="Settings Panel" method="save"]
[connection signal="text_changed" from="Settings Panel/Menu/Username" to="Settings Panel" method="check_valid"]
[connection signal="text_changed" from="Settings Panel/Menu/Username" to="Settings Panel/Menu/Username" method="check"]
[connection signal="pressed" from="Tutorial Text/Close" to="Tutorial Text" method="hide"]

64
player-row.gd Normal file
View file

@ -0,0 +1,64 @@
extends "res://player.gd"
func _ready():
update_display()
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"):
global_position = get_global_mouse_position()
if event.is_action_pressed("quare"):
if num_quares >= max_quares:
notifier.notify("All Quares in Use!")
return
if not $"../CollisionCheck".is_clear(get_global_mouse_position(), 60):
$"../CollisionCheck".flash()
notifier.notify("Too Close!")
return
num_quares += 1
var new_quare = quare.instantiate()
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
if exagons <= 0:
notifier.notify("No Exagons!")
return
if not $"../CollisionCheck".is_clear(get_global_mouse_position()):
$"../CollisionCheck".flash()
notifier.notify("Too Close!")
return
exagons -= 1
var new_exagon = exagon.instantiate()
new_exagon.position = get_global_mouse_position()
$/root/Node2D.add_child(new_exagon)
new_exagon.name = "Exagon"
update_display()
#$Gun.shoot()
func aquire_quare():
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():
$"../UI/Quare Count".text = "%d Quares\n" % [(max_quares - num_quares)]
var num_quares = 0
var max_quares = 3
var exagons = 0

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=7 format=3 uid="uid://cgcjicue76wsr"]
[ext_resource type="Script" path="res://Player.gd" id="1_bu0dg"]
[ext_resource type="Script" path="res://player-row.gd" id="1_4k5de"]
[ext_resource type="SpriteFrames" uid="uid://cmkptgd3k37bl" path="res://player_idle.gif" id="2_c8tq3"]
[ext_resource type="AudioStream" uid="uid://cuu1qqskoqabg" path="res://Taco_Bell_Bong.ogg" id="3_urvwh"]
[ext_resource type="AudioStream" uid="uid://cbghiy80qmaa0" path="res://powerUp6.ogg" id="4_i2tip"]
@ -13,7 +13,7 @@ radius = 19.0263
position = Vector2(-42, 74)
gravity_scale = 1.66533e-16
linear_damp = 1.0
script = ExtResource("1_bu0dg")
script = ExtResource("1_4k5de")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
@ -21,6 +21,8 @@ position = Vector2(-33, 0)
scale = Vector2(1.2, 1.2)
sprite_frames = ExtResource("2_c8tq3")
animation = &"gif"
frame = 5
frame_progress = 0.885413
speed_scale = 0.75
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -79,6 +79,7 @@ quit={
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
anti_aliasing/screen_space_roughness_limiter/enabled=false

View file

@ -14,7 +14,7 @@ func destroy():
queue_free()
func _physics_process(delta):
apply_central_force((global_position - player.global_position).normalized() * -200)
apply_central_force((global_position - player.global_position).normalized() * -100)
$ExplosionRadius.visible = false
for body in $Explosion.get_overlapping_bodies():
@ -42,4 +42,6 @@ func _on_explosion_body_entered(body):
#print(body.name)
if body.name == "Player":
$Sprite2D.play("default")
$ExplosionRadius.blink()
get_tree().create_tween().tween_property($ExplosionRadius/Timer, "wait_time", 0.05, 1.5).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_OUT)
$ExplosionRadius.visible = true

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://riangle-tar.gd" id="1_81oja"]
[ext_resource type="Texture2D" uid="uid://c562ut0sxn6we" path="res://riangle-tar.png" id="2_1actw"]
[ext_resource type="Script" path="res://LockedRotation.gd" id="4_eemlr"]
[ext_resource type="Script" path="res://Blink.gd" id="4_dm5t8"]
[ext_resource type="Texture2D" uid="uid://yq2flqkxnw7u" path="res://dotted circle.png" id="5_e5pjh"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_btknm"]
@ -108,7 +108,7 @@ animations = [{
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_cq436"]
radius = 254.0
radius = 193.023
[node name="Riangle" type="RigidBody2D" groups=["destructible", "enemy"]]
physics_material_override = SubResource("PhysicsMaterial_btknm")
@ -121,27 +121,30 @@ script = ExtResource("1_81oja")
texture_filter = 1
position = Vector2(-7, 8.84254e-14)
rotation = 1.5708
scale = Vector2(0.903, 0.903)
scale = Vector2(1.2, 1.2)
sprite_frames = SubResource("SpriteFrames_xlxob")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
position = Vector2(2.08165e-12, 2.08165e-12)
scale = Vector2(0.25, 0.25)
polygon = PackedVector2Array(-80, -104, 100, 0, -80, 104)
scale = Vector2(1.2, 1.2)
polygon = PackedVector2Array(-20.8333, -31.6667, 25.8333, 0, -20.8333, 32.5)
[node name="ExplosionRadius" type="Sprite2D" parent="."]
visible = false
modulate = Color(0.768627, 0.254902, 0.254902, 1)
texture_filter = 1
scale = Vector2(4, 4)
scale = Vector2(3, 3)
texture = ExtResource("5_e5pjh")
script = ExtResource("4_eemlr")
script = ExtResource("4_dm5t8")
off_color = Color(1, 1, 1, 0.596078)
[node name="Timer" type="Timer" parent="ExplosionRadius"]
wait_time = 0.5
autostart = true
[node name="Explosion" type="Area2D" parent="."]
rotation = -1.5708
collision_layer = 3
collision_mask = 3
monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Explosion"]
shape = SubResource("CircleShape2D_cq436")

View file

@ -7,5 +7,6 @@
[resource]
script = ExtResource("3_nyiux")
enemy = ExtResource("1_y74g3")
boss = false
portal_texture = ExtResource("2_1rl0g")
check_distance = 200
check_distance = 300

BIN
shield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

34
shield.png.import Normal file
View file

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

5
tar.gd
View file

@ -2,10 +2,13 @@ extends RigidBody2D
var phase2_active = false
var health = 10
var spawn_remaining = 10
var spawn_remaining = 7
@onready var player = $"../Player"
func hit(body):
if not phase2_active:
return
if body.is_in_group("destructible"):
if body.has_method("destroy"):
body.destroy()

View file

@ -6,4 +6,4 @@ class_name Wave
@export var quantities: Array[int]
@export var spawning_duration: float = 1
@export var wait: float = 1
@export var wait_for_killed = false
@export var wait_for_killed = true