Knockback tag implementation
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
float random(vec2 uv) {
|
||||
return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 438.5453);
|
||||
}
|
||||
|
||||
uniform float sensitivity : hint_range(0.0, 1.0) = .5;
|
||||
|
||||
void fragment() {
|
||||
// Get size of texture in pixels
|
||||
float size_x = float(textureSize(TEXTURE, 0).x);
|
||||
float size_y = float(textureSize(TEXTURE, 0).y);
|
||||
//
|
||||
vec4 pixelColor = texture(TEXTURE, UV);
|
||||
// Create a new "UV" which remaps every UV value to a snapped pixel value
|
||||
vec2 UVr = vec2(floor(UV.x*size_x)/size_x, floor(UV.y*size_y)/size_y);
|
||||
// Determine whether pixel should be visible or not
|
||||
float visible = step(sensitivity, random(UVr));
|
||||
// Draw the pixel, or not depending on if it is visible or not
|
||||
COLOR = vec4(pixelColor.r, pixelColor.g, pixelColor.b, min(visible, pixelColor.a));
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public partial class ThrowableItem : Node3D, IInventoryItem
|
||||
|
||||
public void Throw(ThrowableItemStats throwableItemStats)
|
||||
{
|
||||
var throwableScene = GD.Load<PackedScene>("res://src/items/throwable/ThrownItem.tscn");
|
||||
var throwableScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownGeometricDice.tscn");
|
||||
var throwable = throwableScene.Instantiate<ThrownItem>();
|
||||
Game.AddChild(throwable);
|
||||
throwable.Throw(throwableItemStats);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b1twcuneob5kt"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b1twcuneob5kt"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/throwable/ThrownItem.cs" id="1_l0mpw"]
|
||||
[ext_resource type="Shader" path="res://src/items/throwable/Dissolve.gdshader" id="2_lukp6"]
|
||||
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="2_oyhi4"]
|
||||
[ext_resource type="Script" path="res://src/items/thrown/ThrownItem.cs" id="1_ig3yn"]
|
||||
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="2_ia1qk"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_s4ym5"]
|
||||
size = Vector3(0.288967, 0.302734, 0.28064)
|
||||
@@ -10,10 +9,6 @@ size = Vector3(0.288967, 0.302734, 0.28064)
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_vebu3"]
|
||||
viewport_path = NodePath("Sprite3D/SubViewport")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vnlpn"]
|
||||
shader = ExtResource("2_lukp6")
|
||||
shader_parameter/sensitivity = 0.0
|
||||
|
||||
[node name="Hitbox" type="RigidBody3D"]
|
||||
collision_layer = 17
|
||||
collision_mask = 16
|
||||
@@ -21,7 +16,7 @@ mass = 0.001
|
||||
gravity_scale = 0.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
script = ExtResource("1_l0mpw")
|
||||
script = ExtResource("1_ig3yn")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00739601, 0.0986328, 0.137878)
|
||||
@@ -41,8 +36,7 @@ size = Vector2i(100, 100)
|
||||
[node name="Sprite" type="Sprite2D" parent="Sprite3D/SubViewport"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
material = SubResource("ShaderMaterial_vnlpn")
|
||||
scale = Vector2(0.1, 0.1)
|
||||
texture = ExtResource("2_oyhi4")
|
||||
texture = ExtResource("2_ia1qk")
|
||||
centered = false
|
||||
flip_h = true
|
||||
@@ -1,5 +1,4 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
Reference in New Issue
Block a user