Add new cool light beam for the flashlight
Co-authored-by: Евгений Титаренко <frundle@teasanctuary.ru>
This commit is contained in:
parent
3832a05c1b
commit
f307a7ef00
20 changed files with 230 additions and 68 deletions
|
@ -1,49 +1,92 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dhn7yt46fyac8"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dhn7yt46fyac8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bhulqhxesd5gc" path="res://prefabs/player.tscn" id="1_65a7v"]
|
||||
[ext_resource type="Texture2D" uid="uid://py6qiu3rm7cu" path="res://sprites/brickwall.png" id="2_edqdh"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlbl6d4yghvht" path="res://sprites/mask.png" id="3_8o315"]
|
||||
[ext_resource type="Script" path="res://scripts/Flashlight.cs" id="3_cylxo"]
|
||||
[ext_resource type="Material" uid="uid://xuvxq5hy1dt" path="res://shaders/light_shader_material.tres" id="4_ro05e"]
|
||||
[ext_resource type="Script" path="res://scripts/GameCamera.cs" id="6_quua3"]
|
||||
[ext_resource type="Script" path="res://scripts/PointLight2DWorkaround.cs" id="6_slohe"]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_wg1ao"]
|
||||
light_mode = 2
|
||||
|
||||
[node name="Root" type="Node2D"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_nnmvo"]
|
||||
viewport_path = NodePath("FlashlightViewport")
|
||||
|
||||
[node name="Player" parent="." node_paths=PackedStringArray("FlashlightUI", "FlashlightWorld") instance=ExtResource("1_65a7v")]
|
||||
position = Vector2(19, 4)
|
||||
FlashlightUI = NodePath("../CanvasLayer/FlashlightUI")
|
||||
FlashlightWorld = NodePath("../Camera2D/PointLight2D")
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_au1d0"]
|
||||
light_mode = 2
|
||||
|
||||
[node name="Root" type="Node2D"]
|
||||
|
||||
[node name="TestWall" type="Sprite2D" parent="."]
|
||||
light_mask = 2
|
||||
material = SubResource("CanvasItemMaterial_wg1ao")
|
||||
position = Vector2(-108, -74)
|
||||
position = Vector2(58, 37)
|
||||
texture = ExtResource("2_edqdh")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
[node name="Player" parent="." instance=ExtResource("1_65a7v")]
|
||||
position = Vector2(19, 4)
|
||||
|
||||
[node name="FlashlightUI" type="Sprite2D" parent="CanvasLayer"]
|
||||
clip_children = 1
|
||||
[node name="FlashlightViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
snap_2d_transforms_to_pixel = true
|
||||
snap_2d_vertices_to_pixel = true
|
||||
canvas_item_default_texture_filter = 0
|
||||
size = Vector2i(256, 192)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Circle" type="Sprite2D" parent="FlashlightViewport"]
|
||||
texture = ExtResource("3_8o315")
|
||||
|
||||
[node name="InvertRect" type="ColorRect" parent="CanvasLayer/FlashlightUI"]
|
||||
material = ExtResource("4_ro05e")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -32.0
|
||||
offset_top = -32.0
|
||||
offset_right = -32.0
|
||||
offset_bottom = -32.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
metadata/_edit_use_anchors_ = true
|
||||
[node name="PlayerCircle" type="Sprite2D" parent="FlashlightViewport"]
|
||||
position = Vector2(13.61, 14.405)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("3_8o315")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
[node name="Triangle" type="Polygon2D" parent="FlashlightViewport"]
|
||||
polygon = PackedVector2Array(-21, -25, 31, 29, -42, 31)
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="Camera2D"]
|
||||
[node name="Controller" type="Node" parent="FlashlightViewport" node_paths=PackedStringArray("Player", "Camera", "Circle", "PlayerCircle", "Polygon")]
|
||||
script = ExtResource("3_cylxo")
|
||||
Player = NodePath("../../Player")
|
||||
Camera = NodePath("../../PlayerCamera")
|
||||
Circle = NodePath("../Circle")
|
||||
PlayerCircle = NodePath("../PlayerCircle")
|
||||
Polygon = NodePath("../Triangle")
|
||||
|
||||
[node name="PlayerCamera" type="Camera2D" parent="."]
|
||||
script = ExtResource("6_quua3")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="PlayerCamera" node_paths=PackedStringArray("LightViewport")]
|
||||
energy = 16.0
|
||||
blend_mode = 2
|
||||
range_item_cull_mask = 2
|
||||
script = ExtResource("6_slohe")
|
||||
LightViewport = NodePath("../../FlashlightViewport")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="FlashlightUI" type="TextureRect" parent="CanvasLayer"]
|
||||
clip_children = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("ViewportTexture_nnmvo")
|
||||
|
||||
[node name="InvertRect" type="ColorRect" parent="CanvasLayer/FlashlightUI"]
|
||||
material = ExtResource("4_ro05e")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
light_mask = 2
|
||||
material = SubResource("CanvasItemMaterial_au1d0")
|
||||
position = Vector2(-83, 43)
|
||||
texture = ExtResource("3_8o315")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue