From d3e402bb5b6a5a065c0f6166b3b550e6933fcb3c Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Thu, 21 Sep 2023 18:41:13 -0400 Subject: [PATCH] they say i'm the best at handling balls --- autoloads/debug.gd | 3 +++ graphics/secret/zball.png | Bin 0 -> 656 bytes graphics/secret/zball.png.import | 35 ++++++++++++++++++++++++ graphics/secret/zball_glow.png | Bin 0 -> 643 bytes graphics/secret/zball_glow.png.import | 35 ++++++++++++++++++++++++ objects/environment/zball/zball.gd | 27 +++++++++++++++++++ objects/environment/zball/zball.tscn | 37 ++++++++++++++++++++++++++ 7 files changed, 137 insertions(+) create mode 100644 graphics/secret/zball.png create mode 100644 graphics/secret/zball.png.import create mode 100644 graphics/secret/zball_glow.png create mode 100644 graphics/secret/zball_glow.png.import create mode 100644 objects/environment/zball/zball.gd create mode 100644 objects/environment/zball/zball.tscn diff --git a/autoloads/debug.gd b/autoloads/debug.gd index ef5ff48..1d1b0c4 100644 --- a/autoloads/debug.gd +++ b/autoloads/debug.gd @@ -117,6 +117,9 @@ func _enter_code(): "MACOSX": var player = get_tree().get_nodes_in_group("player").pop_back() if player != null: Game.instance_node(load("res://objects/environment/beach_ball/beach_ball.tscn"),player.global_position.x,player.global_position.y - 8,Game.get_map()) + "CANYOUDUNK": + var player = get_tree().get_nodes_in_group("player").pop_back() + if player != null: Game.instance_node(preload("res://objects/environment/zball/zball.tscn"),player.global_position.x,player.global_position.y - 18.0,Game.get_map()) "YUMMY": var player = get_tree().get_nodes_in_group("player").pop_back() if player != null: diff --git a/graphics/secret/zball.png b/graphics/secret/zball.png new file mode 100644 index 0000000000000000000000000000000000000000..b7d4bcc8d4f389db6b8d8a91218f42af9fb3c433 GIT binary patch literal 656 zcmV;B0&o3^P)EX>4Tx04R}tkv&MmKpe$i(@Iq;4n`4i$WWc^q9Ts93Pq?8YK2xE%tybVNkfw2 z;wZQl9Q;_UI=DFN>fkB}f*&BRE>4OrQsV!TLW>v=j{EWM-sA2az%?q0W`*K_rrTyZ znGmwMRU!O}9t>g#A@Gu78FQkTg75gcM}Vz&F_z_j?$6Pu<}C#X2*h#4Fm2)u;+aj` zV7yPvD4L&0eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{003x7L_t&-(|wP@4Zt7_15MQxn1U4$%2M#i06dtgVh84N z9|&5g)caa?E(Q<8iUELQgj7NF7E}RMX2FbbkZMB-u219(=QfKH98zt|9Y$|wxJcxy qJCxu)%^gyORAKa%RN-6l_stvU(I?mr>K=3e0000EX>4Tx04R}tkv&MmKpe$i(@Iq;4n`4i$WWc^q9Ts93Pq?8YK2xE%tybVNkfw2 z;wZQl9Q;_UI=DFN>fkB}f*&BRE>4OrQsV!TLW>v=j{EWM-sA2az%?q0W`*K_rrTyZ znGmwMRU!O}9t>g#A@Gu78FQkTg75gcM}Vz&F_z_j?$6Pu<}C#X2*h#4Fm2)u;+aj` zV7yPvD4L&0eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{003J_L_t&-(}j=05r9Al1NR&nNDFD<`fnvIP=da2^rLx( zC4>c>0FsadKzGyKu%G~JWBUapAqgc3+w8ru4M36`tcf0Ilmtl}{HUhT#Lo8k^&CEL d541kt1TOMxLgwnN!w>)f002ovPDHLkV1ns`7H$9l literal 0 HcmV?d00001 diff --git a/graphics/secret/zball_glow.png.import b/graphics/secret/zball_glow.png.import new file mode 100644 index 0000000..b808838 --- /dev/null +++ b/graphics/secret/zball_glow.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/zball_glow.png-a903baaaddcbe84df17501813dffd3fd.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/secret/zball_glow.png" +dest_files=[ "res://.import/zball_glow.png-a903baaaddcbe84df17501813dffd3fd.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/objects/environment/zball/zball.gd b/objects/environment/zball/zball.gd new file mode 100644 index 0000000..e49a053 --- /dev/null +++ b/objects/environment/zball/zball.gd @@ -0,0 +1,27 @@ +extends RigidBody2D + + +export var max_glow: float = 5.0 + + +onready var glow: Light2D = $Glow + + +func _on_Hurtbox_area_entered(area: Area2D) -> void: + if area.is_in_group("enemy_hitbox"): + var target = area.get_parent() + target.die() + + +func _physics_process(delta: float) -> void: + var speed: float = inverse_lerp(0.0, 250.0, linear_velocity.length()) + print(speed) + glow.energy = lerp(0.0, max_glow, speed) + + +func _on_body_entered(body: Node) -> void: + pass +# if glow.energy < max_glow: +# pass +# glow.energy += glow_increase +# smoke_particles.amount += 1 diff --git a/objects/environment/zball/zball.tscn b/objects/environment/zball/zball.tscn new file mode 100644 index 0000000..a48ce1a --- /dev/null +++ b/objects/environment/zball/zball.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://objects/environment/zball/zball.gd" type="Script" id=1] +[ext_resource path="res://graphics/secret/zball.png" type="Texture" id=2] +[ext_resource path="res://graphics/secret/zball_glow.png" type="Texture" id=3] + +[sub_resource type="PhysicsMaterial" id=2] +bounce = 0.75 + +[sub_resource type="CircleShape2D" id=1] +radius = 4.0 + +[node name="ZBall" type="RigidBody2D"] +mass = 5.0 +physics_material_override = SubResource( 2 ) +script = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="Sprite" type="Sprite" parent="."] +light_mask = 9 +texture = ExtResource( 2 ) + +[node name="Glow" type="Light2D" parent="."] +texture = ExtResource( 3 ) +energy = 5.0 +range_item_cull_mask = 8 + +[node name="Hurtbox" type="Area2D" parent="."] +collision_mask = 5 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"] +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]