forked from team-sg/hero-mark-2
they say i'm the best at handling balls
This commit is contained in:
parent
a40347a52f
commit
d3e402bb5b
7 changed files with 137 additions and 0 deletions
27
objects/environment/zball/zball.gd
Normal file
27
objects/environment/zball/zball.gd
Normal file
|
@ -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
|
37
objects/environment/zball/zball.tscn
Normal file
37
objects/environment/zball/zball.tscn
Normal file
|
@ -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"]
|
Loading…
Add table
Add a link
Reference in a new issue