Better lava

This commit is contained in:
bingus_violet 2024-03-17 21:56:16 -05:00
parent 4f70414ed9
commit d0d7899340
82 changed files with 1747 additions and 738 deletions

View file

@ -1,8 +1,9 @@
extends Node2D
var detecting = true
@export var once = false
func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
if detecting:
detecting = false
@ -16,15 +17,18 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
await tween.finished
tween = get_tree().create_tween()
tween.set_ease(Tween.EASE_IN)
tween.set_trans(Tween.TRANS_SINE)
tween.set_parallel(true)
tween.tween_property($SmasherBody, "position", Vector2(0, -100), 2).set_delay(1)
tween.tween_property($SmasherBody2, "position", Vector2(0, 100), 2).set_delay(1)
await tween.finished
detecting = true
if not once:
tween = get_tree().create_tween()
tween.set_ease(Tween.EASE_IN)
tween.set_trans(Tween.TRANS_SINE)
tween.set_parallel(true)
tween.tween_property($SmasherBody, "position", Vector2(0, -100), 2).set_delay(1)
tween.tween_property($SmasherBody2, "position", Vector2(0, 100), 2).set_delay(1)
await tween.finished
detecting = true
else:
$AnimTrigger.queue_free()

View file

@ -5,6 +5,7 @@
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_6f7iw"]
[node name="Smasher" type="Node2D"]
z_index = -1
script = ExtResource("1_px0wu")
[node name="AnimTrigger" parent="." instance=ExtResource("1_cq28h")]

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

View file

@ -1,6 +1,10 @@
extends AnimatableBody2D
@onready var tip = $"Tip"
@onready var warnSign = $"../WarnSign"
@onready var warnBorder = $"../WarnBorder"
@export var once = false
var detecting = true
@ -8,8 +12,9 @@ var velocity = Vector2.ZERO
@onready var startPos = global_position
func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
if detecting:
detecting = false
var tween = get_tree().create_tween()
var space_state = get_world_2d().direct_space_state
@ -21,26 +26,57 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
if result:
finalPos = result.position - tip.global_position
warnBorder.points[0] = Vector2(15.5, -0.25)
warnBorder.points[1] = Vector2(-15.5, -0.25)
warnBorder.points[3] = Vector2(15.5, (finalPos.length() / $"../".scale.y) + 4.5)
warnBorder.points[2] = Vector2(-15.5, (finalPos.length() / $"../".scale.y) + 4.5)
warnSign.global_rotation = 0
warnSign.global_position = tip.global_position + (finalPos / 2) + Vector2(0, 4.5).rotated(global_rotation)
tween.set_trans(Tween.TRANS_CUBIC)
tween.set_ease(Tween.EASE_IN)
tween.set_parallel(true)
tween.tween_property(self, "global_position", global_position + finalPos, 0.4).set_delay(0.05)
tween.tween_property(self, "velocity", Vector2(0, 400).rotated(global_rotation), 0.4).set_ease(Tween.EASE_OUT)
tween.tween_property(self, "global_position", global_position + finalPos, 0.5).set_ease(Tween.EASE_IN)
tween.tween_property(self, "velocity", Vector2(0, 700).rotated(global_rotation), 0.5).set_ease(Tween.EASE_IN)
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 255), 0.3).set_ease(Tween.EASE_OUT)
tween.tween_property(warnBorder, "modulate", Color8(255, 0, 0, 255), 0.3).set_ease(Tween.EASE_OUT)
tween.chain()
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 0), 0.5).set_ease(Tween.EASE_IN)
tween.tween_property(warnBorder, "modulate", Color8(255, 0, 0, 0), 0.5).set_ease(Tween.EASE_IN)
await tween.finished
if not once:
await get_tree().create_timer(0.5).timeout
tween = get_tree().create_tween()
tween.set_parallel(true)
var launcherHitbox = $Tip/LauncherHitbox
var hitTable = launcherHitbox.get_overlapping_bodies()
for object in hitTable:
if object is CharacterBody2D and "velocity" in object and object.has_method("forceLaunch"):
object.forceLaunch(velocity.x * 3)
#object.velocity.y = velocity.y * 1.5
if velocity.x < 5:
object.forceLowGrav = true
tween = get_tree().create_tween()
tween.set_parallel(true)
tween.set_trans(Tween.TRANS_SINE)
tween.set_ease(Tween.EASE_IN)
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 0), 0.6)
tween.tween_property(self, "global_position", startPos, 1).set_delay(0.5)
tween.tween_property(self, "velocity", Vector2.ZERO, 0.5).set_delay(0.25)
#await get_tree().create_timer(0.25).timeout
#constant_linear_velocity = Vector2.ZERO
tween.tween_property(self, "global_position", startPos, 2).set_trans(Tween.TRANS_SINE).set_delay(1).set_ease(Tween.EASE_IN)
tween.tween_property(self, "velocity", Vector2.ZERO, 0.5).set_trans(Tween.TRANS_SINE).set_delay(0.25).set_ease(Tween.EASE_IN)
#await get_tree().create_timer(0.25).timeout
#constant_linear_velocity = Vector2.ZERO
await tween.finished
detecting = true
await tween.finished
detecting = true
#func _on_launcher_hitbox_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
#if "velocity" in body:
#body.velocity /= 10

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

View file

@ -1,8 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://c7vbin1wckti1"]
[gd_scene load_steps=6 format=3 uid="uid://c7vbin1wckti1"]
[ext_resource type="PackedScene" uid="uid://dc8odchuhx80d" path="res://Objects/AnimTrigger/anim_trigger.tscn" id="1_qvh2l"]
[ext_resource type="Script" path="res://Objects/GroundSmasher/SmasherCollide.gd" id="2_0g66p"]
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_s8d83"]
[ext_resource type="Script" path="res://Objects/GroundSmasher/SmasherCollide.gd" id="3_2qfts"]
[ext_resource type="Texture2D" uid="uid://3gsjdgvlscl" path="res://Objects/GroundSmasher/WarningSymbol.png" id="4_5psq0"]
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="4_kj73c"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pnc2c"]
size = Vector2(30, 10)
[node name="Smasher" type="Node2D"]
@ -12,19 +16,37 @@ collision_layer = 2
collision_mask = 2
script = null
[node name="SmasherBody" type="AnimatableBody2D" parent="."]
position = Vector2(0, -137)
script = ExtResource("2_0g66p")
[node name="WarnSign" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0)
show_behind_parent = true
scale = Vector2(0.5, 0.5)
texture = ExtResource("4_5psq0")
[node name="Sprite2D" type="Sprite2D" parent="SmasherBody"]
texture = ExtResource("2_s8d83")
offset = Vector2(0, 40)
[node name="WarnBorder" type="Line2D" parent="."]
modulate = Color(1, 0, 0, 0)
position = Vector2(0, -39)
points = PackedVector2Array(-15.5, 0, 15.5, 0, 15.5, 78.5, -15.5, 78.5)
closed = true
width = 1.25
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SmasherBody"]
position = Vector2(0, 24)
polygon = PackedVector2Array(-16, -47, -16, 73, -13, 79, 13, 79, 16, 73, 16, -47)
[node name="Crusher" type="AnimatableBody2D" parent="."]
position = Vector2(0, -97)
script = ExtResource("3_2qfts")
[node name="Tip" type="Node2D" parent="SmasherBody"]
position = Vector2(0, 103)
[node name="Sprite" type="Sprite2D" parent="Crusher"]
modulate = Color(0, 0, 1, 1)
texture = ExtResource("4_kj73c")
[connection signal="body_shape_entered" from="AnimTrigger" to="SmasherBody" method="_on_anim_trigger_body_shape_entered"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Crusher"]
polygon = PackedVector2Array(-13, 63, -16, 63, -16, -63, 16, -63, 16, 57, 16, 63, 13, 63)
[node name="Tip" type="Node2D" parent="Crusher"]
position = Vector2(0, 63)
[node name="LauncherHitbox" type="Area2D" parent="Crusher/Tip"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Crusher/Tip/LauncherHitbox"]
shape = SubResource("RectangleShape2D_pnc2c")
[connection signal="body_shape_entered" from="AnimTrigger" to="Crusher" method="_on_anim_trigger_body_shape_entered"]
[connection signal="body_shape_entered" from="Crusher/Tip/LauncherHitbox" to="Crusher" method="_on_launcher_hitbox_body_shape_entered"]