Skip to content

Commit

Permalink
set up basic split screen in godot 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ole1711 committed Jan 20, 2024
1 parent 55777dc commit c6668b2
Show file tree
Hide file tree
Showing 18 changed files with 1,910 additions and 28 deletions.
52 changes: 26 additions & 26 deletions examples/common_recipes.tscn

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/spawn_at.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ script = ExtResource("2_y634i")
script = ExtResource("3_g61bo")
color = Color(0.737255, 0, 0.780392, 1)
sprite_texture = ExtResource("4_7xxub")
placeholder_size = Vector2(20, 20)
[node name="Key" type="Node2D" parent="."]
position = Vector2(435, 317)
Expand Down
2 changes: 1 addition & 1 deletion examples/spawner.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ script = ExtResource("1_lu5kp")
position = Vector2(107, 5)
script = ExtResource("2_pgkhl")
color = Color(0.439216, 0.580392, 1, 1)
placeholder_size = Vector2(5, 8)
sprite_texture = ExtResource("3_0okxi")
placeholder_size = Vector2(5, 8)
[node name="Always" type="Node2D" parent="."]
position = Vector2(448, 119)
Expand Down
2 changes: 1 addition & 1 deletion examples/state_machine.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,5 @@ metadata/pronto_connections = [SubResource("Resource_rw5bd")]
[node name="PlaceholderBehavior" type="Node2D" parent="."]
position = Vector2(129, 32)
script = ExtResource("5_p6hy4")
placeholder_size = Vector2(216, 43)
sprite_texture = ExtResource("6_aynaj")
placeholder_size = Vector2(216, 43)
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config_version=5
[application]

config/name="pronto"
run/main_scene="res://prototypes/game-shadows-of-surveillance/game-shadows-of-surveillance.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
run/low_processor_mode=true
config/icon="res://icon.svg"
Expand Down
Binary file added prototypes/game-shadows-of-surveillance/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions prototypes/game-shadows-of-surveillance/10.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bhjxc5s34c3cu"
path="res://.godot/imported/10.png-21bb3e1511466bd58cb39629e4bca525.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/10.png"
dest_files=["res://.godot/imported/10.png-21bb3e1511466bd58cb39629e4bca525.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extends Node2D

@onready var players := {
"1": {
viewport = $LeftSubViewportContainer/SubViewport,
camera = $LeftSubViewportContainer/SubViewport/Camera2D,
player = $LeftSubViewportContainer/SubViewport/Level/Player1,
},
"2": {
viewport = $RightSubViewportContainer/SubViewport,
camera = $RightSubViewportContainer/SubViewport/Camera2D,
player = $LeftSubViewportContainer/SubViewport/Level/Player2,
}
}

# Called when the node enters the scene tree for the first time.
func _ready():
players["2"].viewport.world_2d = players["1"].viewport.world_2d

for node in players.values():
var remote_transform := RemoteTransform2D.new()
remote_transform.remote_path = node.camera.get_path()
node.player.add_child(remote_transform)

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[gd_scene load_steps=4 format=3 uid="uid://c83unhh8aqtco"]

[ext_resource type="Script" path="res://addons/pronto/behaviors/ExportBehavior.gd" id="1"]
[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/game-shadows-of-surveillance.gd" id="1_odj0a"]
[ext_resource type="PackedScene" uid="uid://dyvtu758xr2so" path="res://scenes/level.tscn" id="3_3xcs3"]

[node name="Game" type="Node2D"]
script = ExtResource("1_odj0a")

[node name="ExportBehavior" type="Node2D" parent="."]
position = Vector2(576, 324)
script = ExtResource("1")
title = "Shadows of Surveillance"
authors = PackedStringArray("Ole Becker", "David Schroschk", "Matvey Sivashinski")
description = "You are a brilliant scientist who just discovered time travel. Unfortunately, during your first test, something goes wrong and your mind is split into two parts, one part travels to the future and one is stuck in the present.
In this coop split screen game, your goal is to somehow recombine the two parts of your mind. But be careful: In the future, some things have changed..."

[node name="LeftSubViewportContainer" type="SubViewportContainer" parent="."]
offset_right = 565.0
offset_bottom = 646.0
stretch = true

[node name="SubViewport" type="SubViewport" parent="LeftSubViewportContainer"]
handle_input_locally = false
size = Vector2i(565, 646)
render_target_update_mode = 4

[node name="Camera2D" type="Camera2D" parent="LeftSubViewportContainer/SubViewport"]

[node name="Level" parent="LeftSubViewportContainer/SubViewport" instance=ExtResource("3_3xcs3")]

[node name="RightSubViewportContainer" type="SubViewportContainer" parent="."]
offset_left = 576.0
offset_right = 1153.0
offset_bottom = 650.0
stretch = true

[node name="SubViewport" type="SubViewport" parent="RightSubViewportContainer"]
handle_input_locally = false
size = Vector2i(577, 650)
render_target_update_mode = 4

[node name="Camera2D" type="Camera2D" parent="RightSubViewportContainer/SubViewport"]

[node name="ColorRect" type="ColorRect" parent="."]
offset_left = 566.0
offset_top = -4.0
offset_right = 574.0
offset_bottom = 648.0
color = Color(0.0235294, 0.501961, 1, 1)
10 changes: 10 additions & 0 deletions prototypes/game-shadows-of-surveillance/game_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"authors": [
"Ole Becker",
"David Schroschk",
"Matvey Sivashinski"
],
"description": "You are a brilliant scientist who just discovered time travel. Unfortunately, during your first test, something goes wrong and your mind is split into two parts, one part travels to the future and one is stuck in the present. \nIn this coop split screen game, your goal is to somehow recombine the two parts of your mind. But be careful: In the future, some things have changed...",
"time": "2024-01-20",
"title": "Shadows of Surveillance"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions prototypes/game-shadows-of-surveillance/thumbnail.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://fk1ulnsrwyon"
path="res://.godot/imported/thumbnail.png-4decdd16a2263ffe18c5c2388d77a903.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/thumbnail.png"
dest_files=["res://.godot/imported/thumbnail.png-4decdd16a2263ffe18c5c2388d77a903.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions prototypes/game-shadows-of-surveillance/tilemap.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bdve8nywhrdlw"
path="res://.godot/imported/tilemap.png-c21f45507889f24a3e40940c0b9d9912.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/tilemap.png"
dest_files=["res://.godot/imported/tilemap.png-c21f45507889f24a3e40940c0b9d9912.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions prototypes/game-shadows-of-surveillance/tilemap_packed.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bq6gt543ylrs6"
path="res://.godot/imported/tilemap_packed.png-419ac89aa0aaaf7534778e86f9dcf5b9.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/tilemap_packed.png"
dest_files=["res://.godot/imported/tilemap_packed.png-419ac89aa0aaaf7534778e86f9dcf5b9.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
20 changes: 20 additions & 0 deletions scenes/character.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://bb5vilequmrb2"]

[ext_resource type="Texture2D" uid="uid://dn87bxukebfvu" path="res://icon.svg" id="1_mrgum"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/PlatformerControllerBehavior.gd" id="2_uxt7j"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_6dg28"]
size = Vector2(128, 127)

[node name="Character" type="CharacterBody2D"]

[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_mrgum")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -0.5)
shape = SubResource("RectangleShape2D_6dg28")

[node name="PlatformerControllerBehavior" type="Node2D" parent="."]
position = Vector2(576, 324)
script = ExtResource("2_uxt7j")
Loading

0 comments on commit c6668b2

Please sign in to comment.