mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
player_palette_swap.gdshader! (-;
This commit is contained in:
parent
cec6346f70
commit
71390ec0e5
5 changed files with 94 additions and 6 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 596 B |
BIN
media/image/player_swap.png
Normal file
BIN
media/image/player_swap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 492 B |
|
|
@ -1,13 +1,64 @@
|
|||
[gd_scene load_steps=12 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://src/actor/Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://media/audio/sfx/player_jump.wav" type="AudioStream" id=2]
|
||||
[ext_resource path="res://media/image/player.png" type="Texture" id=3]
|
||||
[ext_resource path="res://media/image/player_swap.png" type="Texture" id=3]
|
||||
[ext_resource path="res://media/audio/sfx/btn3.wav" type="AudioStream" id=4]
|
||||
[ext_resource path="res://media/audio/sfx/sfx10.wav" type="AudioStream" id=5]
|
||||
[ext_resource path="res://media/audio/sfx/box_drop.wav" type="AudioStream" id=6]
|
||||
[ext_resource path="res://media/audio/sfx/push.wav" type="AudioStream" id=7]
|
||||
|
||||
[sub_resource type="Shader" id=8]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform vec4 hat : hint_color = vec4(0.0);
|
||||
uniform vec4 eye : hint_color = vec4(0.0);
|
||||
uniform vec4 skin : hint_color = vec4(0.0);
|
||||
uniform vec4 suit : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe : hint_color = vec4(0.0);
|
||||
|
||||
uniform vec4 hat_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 eye_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 skin_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 suit_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe_swap : hint_color = vec4(0.0);
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec4 col = texture(TEXTURE, UV);
|
||||
|
||||
if (col == hat){
|
||||
col = hat_swap;
|
||||
}
|
||||
else if (col == eye){
|
||||
col = eye_swap;
|
||||
}
|
||||
else if (col == skin){
|
||||
col = skin_swap;
|
||||
}
|
||||
else if (col == suit){
|
||||
col = suit_swap;
|
||||
}
|
||||
else if (col == shoe){
|
||||
col = shoe_swap;
|
||||
}
|
||||
|
||||
COLOR = col;
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=9]
|
||||
shader = SubResource( 8 )
|
||||
shader_param/hat = Color( 1, 0, 0, 1 )
|
||||
shader_param/eye = Color( 0, 1, 0, 1 )
|
||||
shader_param/skin = Color( 0, 0, 1, 1 )
|
||||
shader_param/suit = Color( 1, 1, 0, 1 )
|
||||
shader_param/shoe = Color( 1, 0, 1, 1 )
|
||||
shader_param/hat_swap = Color( 1, 0.92549, 0.152941, 1 )
|
||||
shader_param/eye_swap = Color( 1, 0.8, 0.666667, 1 )
|
||||
shader_param/skin_swap = Color( 0.670588, 0.321569, 0.211765, 1 )
|
||||
shader_param/suit_swap = Color( 0.160784, 0.678431, 1, 1 )
|
||||
shader_param/shoe_swap = Color( 1, 0.8, 0.666667, 1 )
|
||||
|
||||
[sub_resource type="Animation" id=7]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
|
|
@ -84,9 +135,10 @@ jump_speed = 1.4
|
|||
jump_frames = 16
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -4 )
|
||||
material = SubResource( 9 )
|
||||
position = Vector2( 4, 0 )
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 14
|
||||
hframes = 7
|
||||
region_rect = Rect2( 40, 0, 8, 24 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ script = ExtResource( 1 )
|
|||
modulate = Color( 1, 1, 1, 0.65098 )
|
||||
material = SubResource( 2 )
|
||||
texture = ExtResource( 2 )
|
||||
offset = Vector2( 4, -4 )
|
||||
hframes = 14
|
||||
offset = Vector2( 4, 0 )
|
||||
hframes = 7
|
||||
region_rect = Rect2( 0, 0, 8, 24 )
|
||||
|
||||
[node name="Ghosts" type="Node2D" parent="."]
|
||||
|
|
|
|||
36
src/shader/player_palette_swap.gdshader
Normal file
36
src/shader/player_palette_swap.gdshader
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 hat : hint_color = vec4(0.0);
|
||||
uniform vec4 eye : hint_color = vec4(0.0);
|
||||
uniform vec4 skin : hint_color = vec4(0.0);
|
||||
uniform vec4 suit : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe : hint_color = vec4(0.0);
|
||||
|
||||
uniform vec4 hat_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 eye_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 skin_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 suit_swap : hint_color = vec4(0.0);
|
||||
uniform vec4 shoe_swap : hint_color = vec4(0.0);
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec4 col = texture(TEXTURE, UV);
|
||||
|
||||
if (col == hat){
|
||||
col = hat_swap;
|
||||
}
|
||||
else if (col == eye){
|
||||
col = eye_swap;
|
||||
}
|
||||
else if (col == skin){
|
||||
col = skin_swap;
|
||||
}
|
||||
else if (col == suit){
|
||||
col = suit_swap;
|
||||
}
|
||||
else if (col == shoe){
|
||||
col = shoe_swap;
|
||||
}
|
||||
|
||||
COLOR = col;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue