Stickersss

This commit is contained in:
Rob Kelly 2025-06-28 17:14:54 -06:00
parent b3af967745
commit ff379484ca
23 changed files with 384 additions and 21 deletions

Binary file not shown.

BIN
assets/stickers/glowing_star_3d.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dsrm2mw4e4gx1"
path="res://.godot/imported/glowing_star_3d.png-5114e5219616e1224c3af11f20cc8171.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/stickers/glowing_star_3d.png"
dest_files=["res://.godot/imported/glowing_star_3d.png-5114e5219616e1224c3af11f20cc8171.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=0

BIN
assets/stickers/heart_suit_3d.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cl8ui8nnoaa1i"
path="res://.godot/imported/heart_suit_3d.png-13871ac315a96fa440a66ea89478611e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/stickers/heart_suit_3d.png"
dest_files=["res://.godot/imported/heart_suit_3d.png-13871ac315a96fa440a66ea89478611e.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=0

BIN
assets/ui/hud/tools/hand_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://db85cfwlticnb"
path="res://.godot/imported/hand_bg.png-dba561c746d5d9d7eda16967a74a41dd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/hud/tools/hand_bg.png"
dest_files=["res://.godot/imported/hand_bg.png-dba561c746d5d9d7eda16967a74a41dd.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=0

BIN
assets/ui/hud/tools/hand_fg.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cju4oxjgaf0ee"
path="res://.godot/imported/hand_fg.png-9b58f7a1a95a5390121469b6f08ef067.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/hud/tools/hand_fg.png"
dest_files=["res://.godot/imported/hand_fg.png-9b58f7a1a95a5390121469b6f08ef067.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=0

View File

@ -180,11 +180,16 @@ select_mp3_player={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
]
}
select_manual={
select_stickers={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
]
}
select_manual={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":48,"key_label":0,"unicode":48,"location":0,"echo":false,"script":null)
]
}
pause={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)

View File

@ -34,6 +34,7 @@ anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="DeviceTexture" type="TextureRect" parent="HUDTool/Rumbler/Position/HUDElement"]
texture_filter = 1
@ -44,6 +45,7 @@ offset_right = -162.0
offset_bottom = 25.0
scale = Vector2(5, 5)
texture = ExtResource("3_de88k")
metadata/_edit_use_anchors_ = true
[node name="DeviceScreenMask" type="TextureRect" parent="HUDTool/Rumbler/Position/HUDElement"]
clip_children = 1

View File

@ -0,0 +1,70 @@
extends SurfaceSnapTool
const USER_STICKER_DIR := "user://stickers"
const RUMBLE_INTENSITY = 0.0009
const RUMBLE_DROPOFF = 0.8
@export var stickers_available: Array[Texture2D] = []
@export var selection_idx: int = 0:
set = _set_selection_idx
@export_category("Game Scenes")
@export var sticker_scene: PackedScene
@onready var rumbler: Rumbler3D = %Rumbler
@onready var sticker_texture: TextureRect = %StickerTexture
func _ready() -> void:
_set_selection_idx(0)
func unlocked() -> bool:
return World.instance.manager.stickers_unlocked
func get_selected_sticker() -> Texture2D:
return stickers_available[selection_idx]
func _set_selection_idx(value: int) -> void:
selection_idx = wrapi(value, 0, stickers_available.size())
sticker_texture.texture = get_selected_sticker()
rumbler.intensity = RUMBLE_INTENSITY
func switch_mode() -> void:
selection_idx += 1
func fire() -> void:
if not firing and raycast.is_colliding():
firing = true
place_sticker()
rumbler.intensity = RUMBLE_INTENSITY
func place_sticker() -> void:
var instance: Decal = sticker_scene.instantiate()
var target: Node = raycast.get_collider() as Node
if not target:
push_warning("Tried to apply decal to non-node target ", raycast.get_collider())
return
target.add_sibling(instance)
instance.texture_albedo = get_selected_sticker()
instance.global_position = raycast.get_collision_point()
# Build basis
var up := raycast.get_collision_normal()
var right := up.cross(global_basis.y).normalized()
var forward := -right.cross(up).normalized()
instance.global_basis = Basis(right, up, forward)
print_debug("Sticker placed")
func _physics_process(delta: float) -> void:
rumbler.intensity *= RUMBLE_DROPOFF
super._physics_process(delta)

View File

@ -0,0 +1 @@
uid://bgj4es0w5b30e

View File

@ -0,0 +1,101 @@
[gd_scene load_steps=9 format=3 uid="uid://cmnokjbv3vuqt"]
[ext_resource type="Script" uid="uid://b274q7uvn0cvp" path="res://src/ui/rumbler_3d.gd" id="1_8t584"]
[ext_resource type="Script" uid="uid://bgj4es0w5b30e" path="res://src/equipment/sticker_pack/sticker_pack.gd" id="1_eaw05"]
[ext_resource type="Script" uid="uid://dj2x7x5qkbym1" path="res://src/ui/canvas_projector.gd" id="2_vcsmi"]
[ext_resource type="PackedScene" uid="uid://dqc1a8xaqac8h" path="res://src/equipment/sticker_pack/world_sticker.tscn" id="2_yigow"]
[ext_resource type="Texture2D" uid="uid://cl8ui8nnoaa1i" path="res://assets/stickers/heart_suit_3d.png" id="3_8t584"]
[ext_resource type="Texture2D" uid="uid://db85cfwlticnb" path="res://assets/ui/hud/tools/hand_bg.png" id="3_o1h4s"]
[ext_resource type="Texture2D" uid="uid://dsrm2mw4e4gx1" path="res://assets/stickers/glowing_star_3d.png" id="3_p2skl"]
[ext_resource type="Texture2D" uid="uid://cju4oxjgaf0ee" path="res://assets/ui/hud/tools/hand_fg.png" id="4_vcsmi"]
[node name="StickerPack" type="Node3D"]
script = ExtResource("1_eaw05")
stickers_available = Array[Texture2D]([ExtResource("3_8t584"), ExtResource("3_p2skl")])
sticker_scene = ExtResource("2_yigow")
[node name="Raycast" type="RayCast3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.997564, -0.0697565, 0, 0.0697565, 0.997564, 0, 0, -0.15)
target_position = Vector3(0, 0, -1)
collision_mask = 4
hit_from_inside = true
[node name="RestingPosition" type="Marker3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2)
[node name="HUDTool" type="Node3D" parent="RestingPosition"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2)
top_level = true
[node name="Rumbler" type="Node3D" parent="RestingPosition/HUDTool"]
unique_name_in_owner = true
script = ExtResource("1_8t584")
metadata/_custom_type_script = "uid://b274q7uvn0cvp"
[node name="CanvasProjector" type="Marker3D" parent="RestingPosition/HUDTool/Rumbler"]
script = ExtResource("2_vcsmi")
[node name="HUDElement" type="Control" parent="RestingPosition/HUDTool/Rumbler/CanvasProjector"]
texture_filter = 3
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="HandRoot" type="Control" parent="RestingPosition/HUDTool/Rumbler/CanvasProjector/HUDElement"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -380.0
offset_top = -323.0
offset_right = -380.0
offset_bottom = -323.0
grow_horizontal = 2
grow_vertical = 2
[node name="HandBG" type="TextureRect" parent="RestingPosition/HUDTool/Rumbler/CanvasProjector/HUDElement/HandRoot"]
texture_filter = 1
layout_mode = 0
offset_right = 128.0
offset_bottom = 256.0
scale = Vector2(5, 5)
texture = ExtResource("3_o1h4s")
[node name="StickerTexture" type="TextureRect" parent="RestingPosition/HUDTool/Rumbler/CanvasProjector/HUDElement/HandRoot"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 232.0
offset_top = 175.0
offset_right = 488.0
offset_bottom = 431.0
grow_horizontal = 2
grow_vertical = 2
rotation = -0.139626
pivot_offset = Vector2(128, 128)
texture = ExtResource("3_8t584")
metadata/_edit_use_anchors_ = true
[node name="HandFG" type="TextureRect" parent="RestingPosition/HUDTool/Rumbler/CanvasProjector/HUDElement/HandRoot"]
texture_filter = 1
layout_mode = 0
offset_right = 128.0
offset_bottom = 256.0
scale = Vector2(5, 5)
texture = ExtResource("4_vcsmi")

View File

@ -0,0 +1,26 @@
[gd_scene load_steps=4 format=3 uid="uid://dqc1a8xaqac8h"]
[ext_resource type="Texture2D" uid="uid://cl8ui8nnoaa1i" path="res://assets/stickers/heart_suit_3d.png" id="1_e4i3l"]
[sub_resource type="PlaneMesh" id="PlaneMesh_e4i3l"]
[sub_resource type="CylinderMesh" id="CylinderMesh_e4i3l"]
top_radius = 0.01
bottom_radius = 0.01
height = 0.2
[node name="WorldSticker" type="Decal"]
size = Vector3(0.25, 0.1, 0.25)
texture_albedo = ExtResource("1_e4i3l")
upper_fade = 0.01
lower_fade = 0.01
[node name="DebugPlane" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.848002, -0.529993, 0, 0.529993, 0.848002, 0, 0, 0)
visible = false
mesh = SubResource("PlaneMesh_e4i3l")
[node name="DebugNormal" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.15, 0)
visible = false
mesh = SubResource("CylinderMesh_e4i3l")

View File

@ -0,0 +1,15 @@
class_name SurfaceSnapTool extends Tool
## A Tool whose HUD component snaps to a surface
@onready var raycast: RayCast3D = %Raycast
@onready var resting_position: Marker3D = %RestingPosition
func _physics_process(delta: float) -> void:
hud_tool.global_basis = global_basis
var weight := 1 - exp(-hud_accel * delta)
var target_position := resting_position.global_position
if raycast.is_colliding():
target_position = raycast.get_collision_point()
hud_tool.global_position = hud_tool.global_position.lerp(target_position, weight)

View File

@ -0,0 +1 @@
uid://c260xr7jpemho

View File

@ -1,4 +1,4 @@
extends Tool
extends SurfaceSnapTool
# the wimpy toothbrush
const PAINT_COLOR := Color(1, 0, 0, 0.3)
@ -6,14 +6,10 @@ const BRUSH_SCALE := 0.2
@export var damage := 0.0063 # ~8 seconds to destroy standard nodule
@onready var raycast: RayCast3D = %Raycast
@onready var texture_idle: TextureRect = %TextureIdle
@onready var texture_used: TextureRect = %TextureUsed
@onready var brush_animation: AnimationPlayer = %BrushAnimation
@onready var resting_position: Marker3D = %RestingPosition
func unlocked() -> bool:
return World.instance.manager.toothbrush_unlocked
@ -42,13 +38,3 @@ func _fire() -> void:
func _idle() -> void:
texture_idle.visible = true
texture_used.visible = false
func _physics_process(delta: float) -> void:
hud_tool.global_basis = global_basis
var weight := 1 - exp(-hud_accel * delta)
var target_position := resting_position.global_position
if raycast.is_colliding():
target_position = raycast.get_collision_point()
hud_tool.global_position = hud_tool.global_position.lerp(target_position, weight)

View File

@ -63,6 +63,7 @@ var _was_on_floor := false
@onready var wide_spray: WideSpray = %WideSpray
@onready var toothbrush: Tool = %Toothbrush
@onready var mp3_player: Tool = %MP3Player
@onready var sticker_pack: Tool = %StickerPack
@onready var crouch_head_area: Area3D = %CrouchHeadArea
@onready var crouch_animation: AnimationPlayer = %CrouchAnimation
@ -173,7 +174,7 @@ func _on_milestone(milestone: Milestone) -> void:
if milestone.toothbrush:
tool_mount.set_active(toothbrush)
if milestone.stickers:
pass # TODO equip stickers
tool_mount.set_active(sticker_pack)
func _signal_death() -> void:
@ -211,6 +212,8 @@ func _physics_process(delta: float) -> void:
tool_mount.set_active(toothbrush)
elif Input.is_action_just_pressed("select_mp3_player"):
tool_mount.set_active(mp3_player)
elif Input.is_action_just_pressed("select_stickers"):
tool_mount.set_active(sticker_pack)
# Tool use
if Input.is_action_pressed("fire"):

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=63 format=3 uid="uid://bwe2jdmvinhqd"]
[gd_scene load_steps=64 format=3 uid="uid://bwe2jdmvinhqd"]
[ext_resource type="Script" uid="uid://buwh0g1ga2aka" path="res://src/player/player.gd" id="1_npueo"]
[ext_resource type="Script" uid="uid://cx1yt0drthpw3" path="res://src/player/camera_controller.gd" id="2_veeqv"]
@ -10,6 +10,7 @@
[ext_resource type="PackedScene" uid="uid://c21ksxjyixqe1" path="res://src/equipment/mp3_player/mp3_player.tscn" id="7_e7e1q"]
[ext_resource type="Script" uid="uid://b274q7uvn0cvp" path="res://src/ui/rumbler_3d.gd" id="7_p6grl"]
[ext_resource type="Script" uid="uid://b1vyq7e81nyt0" path="res://src/player/headbob_controller.gd" id="7_x42xx"]
[ext_resource type="PackedScene" uid="uid://cmnokjbv3vuqt" path="res://src/equipment/sticker_pack/sticker_pack.tscn" id="8_xmpm3"]
[ext_resource type="Script" uid="uid://ecrhsueph7at" path="res://src/player/footsteps/footstep_controller.gd" id="9_hja65"]
[ext_resource type="Script" uid="uid://brqa2wbtaspw4" path="res://src/player/footsteps/foot_controller.gd" id="9_l271a"]
[ext_resource type="AudioStream" uid="uid://di0e1l1l6l3qc" path="res://assets/sfx/footsteps/metal/metal1.wav" id="10_jcdrv"]
@ -626,6 +627,10 @@ visible = false
unique_name_in_owner = true
visible = false
[node name="StickerPack" parent="CameraPosition/CameraPivot/ToolMount" instance=ExtResource("8_xmpm3")]
unique_name_in_owner = true
visible = false
[node name="TransformedPosition" type="Node3D" parent="CameraPosition/CameraPivot"]
[node name="CamRumbler" type="Node3D" parent="CameraPosition/CameraPivot/TransformedPosition"]

View File

@ -4,7 +4,7 @@
[ext_resource type="Resource" uid="uid://tgac5tnfx56r" path="res://src/world/world_manager.tres" id="2_5kmgb"]
[ext_resource type="PackedScene" uid="uid://byvjsvavbg5xe" path="res://src/ui/menus/pause_menu/pause_menu.tscn" id="2_6fy3g"]
[ext_resource type="Resource" uid="uid://0i72bf8ip1lx" path="res://src/world/spook_manager.tres" id="3_l0av5"]
[ext_resource type="PackedScene" uid="uid://bov4ok76woyc" path="res://levels/ghost_ship/ghost_ship.tscn" id="4_5kmgb"]
[ext_resource type="PackedScene" uid="uid://dc4tts6342cuj" path="res://levels/prop_test/prop_test.tscn" id="4_5kmgb"]
[ext_resource type="PackedScene" uid="uid://c0uitm5cg88h1" path="res://src/ui/menus/kill_screen/kill_screen.tscn" id="6_l0av5"]
[ext_resource type="PackedScene" uid="uid://brknr57xc2cp0" path="res://src/ui/elements/save_icon/save_icon.tscn" id="7_5kmgb"]

View File

@ -301,7 +301,7 @@ vault_milestones = Dictionary[int, ExtResource("2_c37ff")]({
})
mp3_player_unlocked = false
toothbrush_unlocked = false
stickers_unlocked = false
stickers_unlocked = true
mp3_collection = Array[ExtResource("3_yiuq5")]([])
grunk_tank = 0.0
grunk_vault = 0.0

View File

@ -45,7 +45,7 @@
- [ ] HUD tools:
- [x] [[spray beam]]
- [x] [[toothbrush]]
- [ ] [[mp3 player]]
- [x] [[mp3 player]]
- [ ] [[manual]]
- [ ] [[radar]]
- [ ] [[roomba]]