killing is a messy business

This commit is contained in:
Haze Weathers 2023-09-21 18:04:15 -04:00
parent 19465f37ca
commit a40347a52f
6 changed files with 39 additions and 1 deletions

View file

@ -2,6 +2,7 @@ extends Area2D
const BloodStain := preload("res://objects/environment/blood/blood_stain.tscn")
const PlayerStain := preload("res://objects/player/player_stain.tscn")
export var color: Color = Color(0xf53342ff)
@ -32,3 +33,9 @@ func _on_body_entered(body: Node) -> void:
queue_free()
elif body is TileMap:
queue_free()
elif body.is_in_group("player"):
var stain = PlayerStain.instance()
stain.color = color
body.get_node("Graphics/Sprite").add_child(stain)
stain.global_position = global_position
queue_free()

View file

@ -7,6 +7,7 @@
radius = 0.5
[node name="BloodSpray" type="Area2D"]
collision_mask = 129
script = ExtResource( 3 )
[node name="Sprite" type="Sprite" parent="."]

View file

@ -1024,6 +1024,7 @@ double_jump_force = 124.0
[node name="Sprite" type="Sprite" parent="Graphics"]
unique_name_in_owner = true
light_mask = 5
material = SubResource( 1 )
position = Vector2( 0, -10 )
texture = ExtResource( 4 )

View file

@ -0,0 +1,16 @@
extends Light2D
export var lifetime: float = 5.0
func _ready() -> void:
rotation = randf() * TAU
func _process(delta: float) -> void:
lifetime -= delta
if lifetime < 0.5:
scale = Vector2(lifetime * 2.0, lifetime * 2.0)
if lifetime <= 0.0:
queue_free()

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=1]
[ext_resource path="res://objects/player/player_stain.gd" type="Script" id=2]
[node name="PlayerStain" type="Light2D"]
texture = ExtResource( 1 )
mode = 2
range_item_cull_mask = 4
script = ExtResource( 2 )

View file

@ -23,7 +23,10 @@ bool is_border(sampler2D tex, vec2 uv, vec2 pixel_size) {
void fragment() {
vec4 color = texture(TEXTURE, UV);
if (color.a == 0.0 && is_border(TEXTURE, UV, TEXTURE_PIXEL_SIZE)) {
// fucked up lighting change to make blood work perfectly
if (AT_LIGHT_PASS) {
COLOR = vec4(1.0, 1.0, 1.0, color.a);
} else if (color.a == 0.0 && is_border(TEXTURE, UV, TEXTURE_PIXEL_SIZE)) {
COLOR = border_color;
} else {
COLOR = texture(palette, color.rg );