mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Convert demos to Godot 4 using regular expressions in a script
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/3.3.0">
|
||||
<Project Sdk="Godot.NET.Sdk/4.0.0-dev5">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<RootNamespace>PongMultiplayer</RootNamespace>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,7 +10,7 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://ball.png"
|
||||
dest_files=[ "res://.import/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex" ]
|
||||
dest_files=["res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://ball.png" type="Texture" id=1]
|
||||
[ext_resource path="res://ball.png" type="Texture2D" id=1]
|
||||
[ext_resource path="res://logic/Ball.cs" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
@@ -9,7 +9,7 @@ radius = 4.65663
|
||||
[node name="Ball" type="Area2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,7 +10,7 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -320.0
|
||||
margin_top = -200.0
|
||||
margin_right = 320.0
|
||||
margin_bottom = 200.0
|
||||
offset_left = -320.0
|
||||
offset_top = -200.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = 200.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
__meta__ = {
|
||||
@@ -18,10 +18,10 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
margin_left = 210.0
|
||||
margin_top = 40.0
|
||||
margin_right = 430.0
|
||||
margin_bottom = 80.0
|
||||
offset_left = 210.0
|
||||
offset_top = 40.0
|
||||
offset_right = 430.0
|
||||
offset_bottom = 80.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Multiplayer Pong"
|
||||
@@ -29,10 +29,10 @@ align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="LobbyPanel" type="Panel" parent="."]
|
||||
margin_left = 210.0
|
||||
margin_top = 160.0
|
||||
margin_right = 430.0
|
||||
margin_bottom = 270.0
|
||||
offset_left = 210.0
|
||||
offset_top = 160.0
|
||||
offset_right = 430.0
|
||||
offset_bottom = 270.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
script = ExtResource( 1 )
|
||||
@@ -41,37 +41,37 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="AddressLabel" type="Label" parent="LobbyPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = 62.0
|
||||
margin_bottom = 24.0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = 62.0
|
||||
offset_bottom = 24.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Address"
|
||||
|
||||
[node name="Address" type="LineEdit" parent="LobbyPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 30.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 54.0
|
||||
offset_left = 10.0
|
||||
offset_top = 30.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = 54.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
text = "127.0.0.1"
|
||||
|
||||
[node name="HostButton" type="Button" parent="LobbyPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 60.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 80.0
|
||||
offset_left = 10.0
|
||||
offset_top = 60.0
|
||||
offset_right = 90.0
|
||||
offset_bottom = 80.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
text = "Host"
|
||||
|
||||
[node name="JoinButton" type="Button" parent="LobbyPanel"]
|
||||
margin_left = 130.0
|
||||
margin_top = 60.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 80.0
|
||||
offset_left = 130.0
|
||||
offset_top = 60.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = 80.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
text = "Join"
|
||||
@@ -80,23 +80,23 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="StatusOk" type="Label" parent="LobbyPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 90.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 104.0
|
||||
offset_left = 10.0
|
||||
offset_top = 90.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = 104.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
custom_colors/font_color = Color( 0, 1, 0.015625, 1 )
|
||||
custom_colors/font_color = Color(0, 1, 0.015625, 1)
|
||||
align = 1
|
||||
|
||||
[node name="StatusFail" type="Label" parent="LobbyPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 90.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 104.0
|
||||
offset_left = 10.0
|
||||
offset_top = 90.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = 104.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
custom_colors/font_color = Color( 1, 0, 0, 1 )
|
||||
custom_colors/font_color = Color(1, 0, 0, 1)
|
||||
align = 1
|
||||
|
||||
[connection signal="pressed" from="LobbyPanel/HostButton" to="LobbyPanel" method="OnHostPressed"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class Ball : Area2D
|
||||
public partial class Ball : Area2D
|
||||
{
|
||||
private const int DefaultSpeed = 100;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using Godot;
|
||||
using System;
|
||||
using Godot.Collections;
|
||||
|
||||
public class Lobby : Control
|
||||
public partial class Lobby : Control
|
||||
{
|
||||
private const int DefaultPort = 8910; // An arbitrary number.
|
||||
private const int MaxNumberOfPeers = 1; // How many people we want to have in a game
|
||||
@@ -38,7 +38,7 @@ public class Lobby : Control
|
||||
private void PlayerConnected(int id)
|
||||
{
|
||||
// Someone connected, start the game!
|
||||
var pong = ResourceLoader.Load<PackedScene>("res://pong.tscn").Instance();
|
||||
var pong = ResourceLoader.Load<PackedScene>("res://pong.tscn").Instantiate();
|
||||
|
||||
// Connect deferred so we can safely erase it from the callback.
|
||||
pong.Connect("GameFinished", this, nameof(EndGame), new Godot.Collections.Array(), (int) ConnectFlags.Deferred);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class Paddle : Area2D
|
||||
public partial class Paddle : Area2D
|
||||
{
|
||||
private const int MotionSpeed = 150;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class Pong : Node2D
|
||||
public partial class Pong : Node2D
|
||||
{
|
||||
[Signal]
|
||||
private delegate void GameFinished(string withError);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/paddle.png-0e798fb0912613386507c9904d5cc01a.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,7 +10,7 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://paddle.png"
|
||||
dest_files=[ "res://.import/paddle.png-0e798fb0912613386507c9904d5cc01a.stex" ]
|
||||
dest_files=["res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://logic/Paddle.cs" type="Script" id=1]
|
||||
[ext_resource path="res://paddle.png" type="Texture" id=2]
|
||||
[ext_resource path="res://paddle.png" type="Texture2D" id=2]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 4.78568
|
||||
@@ -10,17 +10,17 @@ height = 23.6064
|
||||
[node name="Paddle" type="Area2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
[node name="Shape3D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="You" type="Label" parent="."]
|
||||
margin_left = -26.0
|
||||
margin_top = -33.0
|
||||
margin_right = 27.0
|
||||
margin_bottom = -19.0
|
||||
offset_left = -26.0
|
||||
offset_top = -33.0
|
||||
offset_right = 27.0
|
||||
offset_bottom = -19.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "You"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://logic/Pong.cs" type="Script" id=1]
|
||||
[ext_resource path="res://separator.png" type="Texture" id=2]
|
||||
[ext_resource path="res://separator.png" type="Texture2D" id=2]
|
||||
[ext_resource path="res://paddle.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://ball.tscn" type="PackedScene" id=4]
|
||||
|
||||
@@ -9,44 +9,44 @@
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
margin_right = 640.0
|
||||
margin_bottom = 400.0
|
||||
color = Color( 0.141176, 0.152941, 0.164706, 1 )
|
||||
offset_right = 640.0
|
||||
offset_bottom = 400.0
|
||||
color = Color(0.141176, 0.152941, 0.164706, 1)
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Separator" type="Sprite" parent="."]
|
||||
position = Vector2( 320, 200 )
|
||||
[node name="Separator" type="Sprite2D" parent="."]
|
||||
position = Vector2(320, 200)
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Player1" parent="." instance=ExtResource( 3 )]
|
||||
modulate = Color( 0, 1, 1, 1 )
|
||||
position = Vector2( 32.49, 188.622 )
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
position = Vector2(32.49, 188.622)
|
||||
_left = true
|
||||
|
||||
[node name="Player2" parent="." instance=ExtResource( 3 )]
|
||||
modulate = Color( 1, 0, 1, 1 )
|
||||
position = Vector2( 608.88, 188.622 )
|
||||
modulate = Color(1, 0, 1, 1)
|
||||
position = Vector2(608.88, 188.622)
|
||||
|
||||
[node name="Ball" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 320.206, 184 )
|
||||
position = Vector2(320.206, 184)
|
||||
|
||||
[node name="ScoreLeft" type="Label" parent="."]
|
||||
margin_left = 240.0
|
||||
margin_top = 10.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 30.0
|
||||
offset_left = 240.0
|
||||
offset_top = 10.0
|
||||
offset_right = 280.0
|
||||
offset_bottom = 30.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "0"
|
||||
align = 1
|
||||
|
||||
[node name="ScoreRight" type="Label" parent="."]
|
||||
margin_left = 360.0
|
||||
margin_top = 10.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 30.0
|
||||
offset_left = 360.0
|
||||
offset_top = 10.0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 30.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "0"
|
||||
@@ -54,36 +54,36 @@ align = 1
|
||||
|
||||
[node name="WinnerLeft" type="Label" parent="."]
|
||||
visible = false
|
||||
margin_left = 190.0
|
||||
margin_top = 170.0
|
||||
margin_right = 267.0
|
||||
margin_bottom = 184.0
|
||||
offset_left = 190.0
|
||||
offset_top = 170.0
|
||||
offset_right = 267.0
|
||||
offset_bottom = 184.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "The Winner!"
|
||||
|
||||
[node name="WinnerRight" type="Label" parent="."]
|
||||
visible = false
|
||||
margin_left = 380.0
|
||||
margin_top = 170.0
|
||||
margin_right = 457.0
|
||||
margin_bottom = 184.0
|
||||
offset_left = 380.0
|
||||
offset_top = 170.0
|
||||
offset_right = 457.0
|
||||
offset_bottom = 184.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "The Winner!"
|
||||
|
||||
[node name="ExitGame" type="Button" parent="."]
|
||||
visible = false
|
||||
margin_left = 280.0
|
||||
margin_top = 340.0
|
||||
margin_right = 360.0
|
||||
margin_bottom = 360.0
|
||||
offset_left = 280.0
|
||||
offset_top = 340.0
|
||||
offset_right = 360.0
|
||||
offset_bottom = 360.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
text = "Exit Game"
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2( 320, 200 )
|
||||
offset = Vector2(320, 200)
|
||||
current = true
|
||||
|
||||
[connection signal="pressed" from="ExitGame" to="." method="OnExitGamePressed"]
|
||||
|
||||
@@ -28,21 +28,21 @@ window/stretch/aspect="expand"
|
||||
|
||||
move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777234,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777232,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/separator.png-f981c8489b9148e2e1dc63398273da74.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,7 +10,7 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://separator.png"
|
||||
dest_files=[ "res://.import/separator.png-f981c8489b9148e2e1dc63398273da74.stex" ]
|
||||
dest_files=["res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user