Add crosshair

main
copygirl 2 years ago
parent 6a153150ad
commit c4324182ec
  1. BIN
      assets/crosshair.png
  2. 34
      assets/crosshair.png.import
  3. 29
      scenes/Main.tscn
  4. 4
      scripts/Crosshair.gd
  5. 2
      scripts/PickupController.gd

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

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

@ -1,8 +1,10 @@
[gd_scene load_steps=5 format=3 uid="uid://bn6y24u16jtdj"] [gd_scene load_steps=7 format=3 uid="uid://bn6y24u16jtdj"]
[ext_resource type="PackedScene" uid="uid://b7o2y54duqxft" path="res://scenes/World.tscn" id="1_px6sj"] [ext_resource type="PackedScene" uid="uid://b7o2y54duqxft" path="res://scenes/World.tscn" id="1_px6sj"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="2_dd8cf"] [ext_resource type="Shader" path="res://shaders/outline.gdshader" id="2_dd8cf"]
[ext_resource type="Script" path="res://scripts/CloneMainCamera.gd" id="2_m7qgc"] [ext_resource type="Script" path="res://scripts/CloneMainCamera.gd" id="2_m7qgc"]
[ext_resource type="Texture2D" uid="uid://dkc0fn50ueqc5" path="res://assets/crosshair.png" id="4_6ai7y"]
[ext_resource type="Script" path="res://scripts/Crosshair.gd" id="5_mrx5k"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7rvwk"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_7rvwk"]
shader = ExtResource("2_dd8cf") shader = ExtResource("2_dd8cf")
@ -31,3 +33,28 @@ render_target_update_mode = 4
[node name="ClonedCamera" type="Camera3D" parent="SubViewportContainer/OutlineViewport"] [node name="ClonedCamera" type="Camera3D" parent="SubViewportContainer/OutlineViewport"]
cull_mask = 2 cull_mask = 2
script = ExtResource("2_m7qgc") script = ExtResource("2_m7qgc")
[node name="HUD" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
[node name="Crosshair" type="TextureRect" parent="HUD"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.5
offset_top = -10.5
offset_right = 10.5
offset_bottom = 10.5
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("4_6ai7y")
script = ExtResource("5_mrx5k")

@ -0,0 +1,4 @@
extends TextureRect
func _process(_delta: float) -> void:
visible = Input.mouse_mode == Input.MOUSE_MODE_CAPTURED

@ -17,6 +17,8 @@ func _ready() -> void:
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if Input.mouse_mode != Input.MOUSE_MODE_CAPTURED: return
ensure_current_item_valid() ensure_current_item_valid()
if !current_item: return if !current_item: return

Loading…
Cancel
Save