Files
godot-demo-projects/viewport/dynamic_split_screen/2d/split_screen.tscn
Benjamin Navarro fe1ccaea77 [3.x] Add a 2D version of the dynamic split screen demo (#762)
* add a 2D version of the dynamic split screen demo

* refactor the dynamic split screen demo

 - both 2D and 3D scenes have the exact same hierarchy
 - a single camera_controller.gd script instead of one per mode
 - the third viewport for 2D mode has been removed
2025-10-02 17:03:12 -07:00

57 lines
1.6 KiB
Plaintext

[gd_scene load_steps=7 format=2]
[ext_resource path="res://camera_controller.gd" type="Script" id=1]
[ext_resource path="res://split_screen.shader" type="Shader" id=2]
[ext_resource path="res://icon.png" type="Texture" id=3]
[ext_resource path="res://exit_to_menu.gd" type="Script" id=4]
[ext_resource path="res://2d/level.tscn" type="PackedScene" id=5]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 2 )
shader_param/viewport_size = null
shader_param/split_active = null
shader_param/player1_position = null
shader_param/player2_position = null
shader_param/split_line_thickness = null
shader_param/split_line_color = null
[node name="Game" type="Node2D"]
script = ExtResource( 4 )
[node name="SplitScreen" type="Node" parent="."]
script = ExtResource( 1 )
max_separation = 100.0
[node name="View" type="TextureRect" parent="SplitScreen"]
material = SubResource( 1 )
margin_right = 1024.0
margin_bottom = 600.0
texture = ExtResource( 3 )
expand = true
[node name="Main" type="Viewport" parent="SplitScreen"]
size = Vector2( 1024, 600 )
hdr = false
disable_3d = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 3
[node name="Level" parent="SplitScreen/Main" instance=ExtResource( 5 )]
[node name="Camera" type="Camera2D" parent="SplitScreen/Main"]
current = true
zoom = Vector2( 0.2, 0.2 )
[node name="Secondary" type="Viewport" parent="SplitScreen"]
size = Vector2( 100, 100 )
hdr = false
disable_3d = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 3
[node name="Camera" type="Camera2D" parent="SplitScreen/Secondary"]
current = true
zoom = Vector2( 0.2, 0.2 )