From 745d9cd2a46fad5edd10a0e7491f287358469f26 Mon Sep 17 00:00:00 2001 From: ottona Date: Sat, 17 Aug 2024 02:17:15 +0200 Subject: [PATCH] added internal tank sights --- .gitattributes | 1 + assets/images/orig/std-aim.svg | 3 ++ assets/images/orig/std-aim.svg.import | 37 ++++++++++++++++++++++ assets/images/std-aim.png | 3 ++ assets/images/std-aim.png.import | 34 ++++++++++++++++++++ assets/scenes/tank_scout.tscn | 12 ++++++- assets/scripts/vehicles/scout/tank-base.gd | 2 ++ 7 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 assets/images/orig/std-aim.svg create mode 100644 assets/images/orig/std-aim.svg.import create mode 100644 assets/images/std-aim.png create mode 100644 assets/images/std-aim.png.import diff --git a/.gitattributes b/.gitattributes index 3f2f057..1fd4569 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ *.png filter=lfs diff=lfs merge=lfs -text *.blend filter=lfs diff=lfs merge=lfs -text *.ogg filter=lfs diff=lfs merge=lfs -text +*.svg filter=lfs diff=lfs merge=lfs -text diff --git a/assets/images/orig/std-aim.svg b/assets/images/orig/std-aim.svg new file mode 100644 index 0000000..a8c838a --- /dev/null +++ b/assets/images/orig/std-aim.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0427f3a6fec57a628b93c186c849e072bb8e35485e94d34aca0b1cfcf8d473c +size 3895 diff --git a/assets/images/orig/std-aim.svg.import b/assets/images/orig/std-aim.svg.import new file mode 100644 index 0000000..3e09710 --- /dev/null +++ b/assets/images/orig/std-aim.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b41smjmfrvy2c" +path="res://.godot/imported/std-aim.svg-abb931d75445fff632d732497bd89638.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/orig/std-aim.svg" +dest_files=["res://.godot/imported/std-aim.svg-abb931d75445fff632d732497bd89638.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/assets/images/std-aim.png b/assets/images/std-aim.png new file mode 100644 index 0000000..6dfa67e --- /dev/null +++ b/assets/images/std-aim.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:548678d44eb996c2b3f4aa130550d4e45393046ef011c5e7d6bb0ffda1a7d97d +size 1756 diff --git a/assets/images/std-aim.png.import b/assets/images/std-aim.png.import new file mode 100644 index 0000000..289c722 --- /dev/null +++ b/assets/images/std-aim.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bajp34yia340k" +path="res://.godot/imported/std-aim.png-b2556b7524823387f18d383b4bdac92c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/std-aim.png" +dest_files=["res://.godot/imported/std-aim.png-b2556b7524823387f18d383b4bdac92c.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 diff --git a/assets/scenes/tank_scout.tscn b/assets/scenes/tank_scout.tscn index 1225033..0aae133 100644 --- a/assets/scenes/tank_scout.tscn +++ b/assets/scenes/tank_scout.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://d4nj7piinyfug"] +[gd_scene load_steps=17 format=3 uid="uid://d4nj7piinyfug"] [ext_resource type="Script" path="res://assets/scripts/vehicles/scout/tank-base.gd" id="1_isgb6"] [ext_resource type="ArrayMesh" uid="uid://bmabm3fx72638" path="res://assets/meshes/scout/body.obj" id="1_v8pu3"] @@ -7,6 +7,7 @@ [ext_resource type="Script" path="res://assets/scripts/weapons/autocannon.gd" id="5_17fqp"] [ext_resource type="ArrayMesh" uid="uid://dg3d01n2gh18q" path="res://assets/meshes/scout/gun.obj" id="5_ymni4"] [ext_resource type="AudioStream" uid="uid://dphgof1shqpni" path="res://assets/sounds/autocannon.ogg" id="6_0iaip"] +[ext_resource type="Texture2D" uid="uid://bajp34yia340k" path="res://assets/images/std-aim.png" id="7_wc5xn"] [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_5htdn"] points = PackedVector3Array(1, 0.249958, 2.49971, -1, 0.249958, 2.49971, 0.442639, 0.110577, 2.71994, 1, -0.250026, 2.49971, 1, 0.249958, -2.5, 0.877056, 0.520238, 1.42108, -1, -0.250026, 2.49971, -0.442835, 0.110577, 2.71994, -0.877251, 0.520238, 1.42108, -1, 0.249958, -2.5, 0.442639, -0.110759, 2.71994, 0.492561, -0.650746, 1.62393, 1, -0.250026, -2.5, 0.877056, 0.520238, -2.19291, -1, -0.250026, -2.5, -0.490211, -0.650746, 1.62393, -0.442835, -0.110759, 2.71994, -0.877251, 0.520238, -2.19291, 0.492561, -0.650746, -2.04167, -0.490211, -0.650746, -2.04167) @@ -168,6 +169,15 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0747893, 10) [node name="cam_int" type="Camera3D" parent="turret/autocannon"] transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0.24, -0.0747893, 0.805) +[node name="aim" type="TextureRect" parent="turret/autocannon/cam_int"] +visible = false +offset_left = 746.0 +offset_top = 476.0 +offset_right = 1175.0 +offset_bottom = 604.0 +pivot_offset = Vector2(214, 64) +texture = ExtResource("7_wc5xn") + [node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="turret/autocannon"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0747893, 2.055) stream = ExtResource("6_0iaip") diff --git a/assets/scripts/vehicles/scout/tank-base.gd b/assets/scripts/vehicles/scout/tank-base.gd index 41f3753..340ae76 100644 --- a/assets/scripts/vehicles/scout/tank-base.gd +++ b/assets/scripts/vehicles/scout/tank-base.gd @@ -38,9 +38,11 @@ func _input(ie): elif ie.button_index == MOUSE_BUTTON_RIGHT and ie.is_pressed(): if ext_view: $turret/autocannon/cam_int.make_current() + $turret/autocannon/cam_int/aim.visible = true ext_view = false else: $turret/autocannon/cam_ext.make_current() + $turret/autocannon/cam_int/aim.visible = false ext_view = true func shot_hit(obj):