[gd_scene load_steps=8 format=2] [ext_resource path="res://scripts/GameTable.gd" type="Script" id=1] [ext_resource path="res://textures/wood_board_knotty.png" type="Texture" id=2] [ext_resource path="res://scripts/Board.gd" type="Script" id=3] [sub_resource type="Environment" id=1] background_mode = 1 background_energy = 0.0 ambient_light_color = Color( 1, 0.960784, 0.921569, 1 ) ambient_light_energy = 0.5 ambient_light_sky_contribution = 0.0 fog_enabled = true fog_color = Color( 0, 0, 0, 1 ) fog_depth_end = 20.0 [sub_resource type="SpatialMaterial" id=2] albedo_color = Color( 0.345098, 0.282353, 0.184314, 1 ) albedo_texture = ExtResource( 2 ) [sub_resource type="QuadMesh" id=3] material = SubResource( 2 ) size = Vector2( 30, 30 ) [sub_resource type="GDScript" id=4] resource_name = "testing_camera" script/source = "extends Camera const max_scroll_distance : float = 10.0 const min_scroll_distance : float = 2.0 onready var scroll_distance : float = transform.origin.z const scroll_step : float = 0.2 var mouse_clicked : bool = false const max_pitch : float = -15.0 # deg const min_pitch : float = -90.0 const pan_factor : float = 0.5 onready var yaw = get_node(\"../..\") onready var pitch = get_node(\"..\") func _ready(): pass func _input(event): if event is InputEventMouseButton: if event.button_index == BUTTON_LEFT: mouse_clicked = event.pressed if event.button_index == BUTTON_WHEEL_UP and event.pressed: if scroll_distance > min_scroll_distance: scroll_distance -= scroll_step if event.button_index == BUTTON_WHEEL_DOWN and event.pressed: if scroll_distance < max_scroll_distance: scroll_distance += scroll_step transform.origin.z = scroll_distance if event is InputEventMouseMotion and mouse_clicked: var mouse_dir : Vector2 = event.get_relative() yaw.rotation_degrees.y -= mouse_dir.x * pan_factor var new_pitch = pitch.rotation_degrees.x - mouse_dir.y * pan_factor*2 if new_pitch < max_pitch and new_pitch > min_pitch: transform.origin.y = -2 * (1 - (new_pitch - max_pitch) / (min_pitch - max_pitch)) pitch.rotation_degrees.x = new_pitch " [node name="GameTable" type="Spatial"] script = ExtResource( 1 ) [node name="Board" type="Spatial" parent="."] script = ExtResource( 3 ) [node name="ActivePieces" type="Spatial" parent="."] [node name="SpotLight" type="SpotLight" parent="."] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 15.3023, 0 ) light_color = Color( 1, 0.941176, 0.733333, 1 ) light_energy = 1.512 light_specular = 0.0 shadow_enabled = true spot_range = 45.4139 [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource( 1 ) [node name="Tabletop" type="MeshInstance" parent="."] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 ) mesh = SubResource( 3 ) [node name="CameraHingeYaw" type="Spatial" parent="."] [node name="CameraHingePitch" type="Spatial" parent="CameraHingeYaw"] transform = Transform( 1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 0, 0 ) [node name="Camera" type="Camera" parent="CameraHingeYaw/CameraHingePitch"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7 ) script = SubResource( 4 )