From 27af28d02c8085ebc3be4e57b8eede5a6b4fa0a5 Mon Sep 17 00:00:00 2001 From: Voylin <0voylin0@gmail.com> Date: Sun, 3 Apr 2022 13:56:21 +0900 Subject: [PATCH] Tested and fixed Pong With GDScript for 4.0-dev Made the usual changes to the project settings and tested to see if everything works. Everything works fine! Small fixes Changed to Vulkan Mobile. Changed viewport size. --- 2d/pong/README.md | 2 +- 2d/pong/ball.png.import | 28 +++++++------- 2d/pong/icon.png.import | 28 +++++++------- 2d/pong/paddle.png.import | 28 +++++++------- 2d/pong/pong.tscn | 71 +++++++++++++++++------------------- 2d/pong/project.godot | 21 +++-------- 2d/pong/separator.png.import | 28 +++++++------- 7 files changed, 93 insertions(+), 113 deletions(-) diff --git a/2d/pong/README.md b/2d/pong/README.md index dbcd509ebf..95b67e06ca 100644 --- a/2d/pong/README.md +++ b/2d/pong/README.md @@ -6,7 +6,7 @@ for game development in Godot, including Language: GDScript -Renderer: GLES 2 +Renderer: Vulkan Mobile Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/pong). diff --git a/2d/pong/ball.png.import b/2d/pong/ball.png.import index 12bf8e16bb..56465ac136 100644 --- a/2d/pong/ball.png.import +++ b/2d/pong/ball.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture2D" -path="res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex" +type="CompressedTexture2D" +uid="uid://clowikjgl4yq1" +path="res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.ctex" metadata={ "vram_texture": false } @@ -10,26 +11,23 @@ metadata={ [deps] source_file="res://ball.png" -dest_files=["res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.stex"] +dest_files=["res://.godot/imported/ball.png-9a4ca347acb7532f6ae347744a6b04f7.ctex"] [params] compress/mode=0 compress/lossy_quality=0.7 -compress/hdr_mode=0 +compress/hdr_compression=1 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 -flags/filter=false -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false process/normal_map_invert_y=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 +process/hdr_as_srgb=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/pong/icon.png.import b/2d/pong/icon.png.import index 889af9df58..f24b763645 100644 --- a/2d/pong/icon.png.import +++ b/2d/pong/icon.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture2D" -path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +type="CompressedTexture2D" +uid="uid://b8ahegbmdpvli" +path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" metadata={ "vram_texture": false } @@ -10,26 +11,23 @@ metadata={ [deps] source_file="res://icon.png" -dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"] +dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] [params] compress/mode=0 compress/lossy_quality=0.7 -compress/hdr_mode=0 +compress/hdr_compression=1 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false process/normal_map_invert_y=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 +process/hdr_as_srgb=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/pong/paddle.png.import b/2d/pong/paddle.png.import index c23d78c1a5..be5e113b6f 100644 --- a/2d/pong/paddle.png.import +++ b/2d/pong/paddle.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture2D" -path="res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.stex" +type="CompressedTexture2D" +uid="uid://dvrb8efddt0aa" +path="res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.ctex" metadata={ "vram_texture": false } @@ -10,26 +11,23 @@ metadata={ [deps] source_file="res://paddle.png" -dest_files=["res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.stex"] +dest_files=["res://.godot/imported/paddle.png-0e798fb0912613386507c9904d5cc01a.ctex"] [params] compress/mode=0 compress/lossy_quality=0.7 -compress/hdr_mode=0 +compress/hdr_compression=1 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 -flags/filter=false -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false process/normal_map_invert_y=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 +process/hdr_as_srgb=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/pong/pong.tscn b/2d/pong/pong.tscn index afde76154e..2e88016946 100644 --- a/2d/pong/pong.tscn +++ b/2d/pong/pong.tscn @@ -1,24 +1,24 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=12 format=3 uid="uid://jlfslyfbhid5"] -[ext_resource path="res://logic/paddle.gd" type="Script" id=1] -[ext_resource path="res://paddle.png" type="Texture2D" id=2] -[ext_resource path="res://logic/ball.gd" type="Script" id=4] -[ext_resource path="res://ball.png" type="Texture2D" id=5] -[ext_resource path="res://separator.png" type="Texture2D" id=6] -[ext_resource path="res://logic/wall.gd" type="Script" id=7] -[ext_resource path="res://logic/ceiling_floor.gd" type="Script" id=8] +[ext_resource type="Script" path="res://logic/paddle.gd" id="1"] +[ext_resource type="Texture2D" uid="uid://dvrb8efddt0aa" path="res://paddle.png" id="2"] +[ext_resource type="Script" path="res://logic/ball.gd" id="4"] +[ext_resource type="Texture2D" uid="uid://clowikjgl4yq1" path="res://ball.png" id="5"] +[ext_resource type="Texture2D" uid="uid://drgpdyyomyqpl" path="res://separator.png" id="6"] +[ext_resource type="Script" path="res://logic/wall.gd" id="7"] +[ext_resource type="Script" path="res://logic/ceiling_floor.gd" id="8"] -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2(4, 16) +[sub_resource type="RectangleShape2D" id="1"] +size = Vector2(8, 32) -[sub_resource type="RectangleShape2D" id=2] -extents = Vector2(4, 4) +[sub_resource type="RectangleShape2D" id="2"] +size = Vector2(8, 8) -[sub_resource type="RectangleShape2D" id=3] -extents = Vector2(10, 200) +[sub_resource type="RectangleShape2D" id="3"] +size = Vector2(20, 400) -[sub_resource type="RectangleShape2D" id=4] -extents = Vector2(320, 10) +[sub_resource type="RectangleShape2D" id="4"] +size = Vector2(640, 20) [node name="Pong" type="Node2D"] @@ -26,74 +26,71 @@ extents = Vector2(320, 10) offset_right = 640.0 offset_bottom = 400.0 color = Color(0.141176, 0.152941, 0.164706, 1) -__meta__ = { -"_edit_use_anchors_": false -} [node name="Left" type="Area2D" parent="."] modulate = Color(0, 1, 1, 1) position = Vector2(67.6285, 192.594) -script = ExtResource( 1 ) +script = ExtResource( "1" ) [node name="Sprite2D" type="Sprite2D" parent="Left"] -texture = ExtResource( 2 ) +texture = ExtResource( "2" ) [node name="Collision" type="CollisionShape2D" parent="Left"] -shape = SubResource( 1 ) +shape = SubResource( "1" ) [node name="Right" type="Area2D" parent="."] modulate = Color(1, 0, 1, 1) position = Vector2(563.815, 188.919) -script = ExtResource( 1 ) +script = ExtResource( "1" ) [node name="Sprite2D" type="Sprite2D" parent="Right"] -texture = ExtResource( 2 ) +texture = ExtResource( "2" ) [node name="Collision" type="CollisionShape2D" parent="Right"] -shape = SubResource( 1 ) +shape = SubResource( "1" ) [node name="Ball" type="Area2D" parent="."] position = Vector2(320.5, 191.124) -script = ExtResource( 4 ) +script = ExtResource( "4" ) [node name="Sprite2D" type="Sprite2D" parent="Ball"] -texture = ExtResource( 5 ) +texture = ExtResource( "5" ) [node name="Collision" type="CollisionShape2D" parent="Ball"] -shape = SubResource( 2 ) +shape = SubResource( "2" ) [node name="Separator" type="Sprite2D" parent="."] position = Vector2(320, 200) -texture = ExtResource( 6 ) +texture = ExtResource( "6" ) [node name="LeftWall" type="Area2D" parent="."] position = Vector2(-10, 200) -script = ExtResource( 7 ) +script = ExtResource( "7" ) [node name="Collision" type="CollisionShape2D" parent="LeftWall"] -shape = SubResource( 3 ) +shape = SubResource( "3" ) [node name="RightWall" type="Area2D" parent="."] position = Vector2(650, 200) -script = ExtResource( 7 ) +script = ExtResource( "7" ) [node name="Collision" type="CollisionShape2D" parent="RightWall"] -shape = SubResource( 3 ) +shape = SubResource( "3" ) [node name="Ceiling" type="Area2D" parent="."] position = Vector2(320, -10) -script = ExtResource( 8 ) +script = ExtResource( "8" ) [node name="Collision" type="CollisionShape2D" parent="Ceiling"] -shape = SubResource( 4 ) +shape = SubResource( "4" ) [node name="Floor" type="Area2D" parent="."] position = Vector2(320, 410) -script = ExtResource( 8 ) +script = ExtResource( "8" ) _bounce_direction = -1 [node name="Collision" type="CollisionShape2D" parent="Floor"] -shape = SubResource( 4 ) +shape = SubResource( "4" ) [node name="Camera2D" type="Camera2D" parent="."] offset = Vector2(320, 200) diff --git a/2d/pong/project.godot b/2d/pong/project.godot index 150fc8f32b..fd2d721339 100644 --- a/2d/pong/project.godot +++ b/2d/pong/project.godot @@ -6,7 +6,7 @@ ; [section] ; section goes between [] ; param=value ; assign values to parameters -config_version=4 +config_version=5 [application] @@ -15,19 +15,14 @@ config/description="A simple Pong game. This demo shows best practices for game development in Godot, including signals." run/main_scene="pong.tscn" config/icon="res://icon.png" +config/features=PackedStringArray("4.0") [display] -window/size/width=640 -window/size/height=400 -window/dpi/allow_hidpi=true -window/stretch/mode="2d" +window/size/viewport_width=640 +window/size/viewport_height=400 +window/stretch/mode="canvas_items" window/stretch/aspect="expand" -stretch_2d=true - -[gdnative] - -singletons=[] [input] @@ -64,9 +59,5 @@ right_move_up={ [rendering] -quality/driver/driver_name="GLES2" +vulkan/rendering/back_end=1 2d/snapping/use_gpu_pixel_snap=true -vram_compression/import_etc=true -vram_compression/import_etc2=false -quality/2d/use_pixel_snap=true -viewport/default_clear_color=Color(0, 0, 0, 1) diff --git a/2d/pong/separator.png.import b/2d/pong/separator.png.import index 20d788d5af..6900685b67 100644 --- a/2d/pong/separator.png.import +++ b/2d/pong/separator.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture2D" -path="res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.stex" +type="CompressedTexture2D" +uid="uid://drgpdyyomyqpl" +path="res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.ctex" metadata={ "vram_texture": false } @@ -10,26 +11,23 @@ metadata={ [deps] source_file="res://separator.png" -dest_files=["res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.stex"] +dest_files=["res://.godot/imported/separator.png-f981c8489b9148e2e1dc63398273da74.ctex"] [params] compress/mode=0 compress/lossy_quality=0.7 -compress/hdr_mode=0 +compress/hdr_compression=1 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 -flags/filter=false -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false process/normal_map_invert_y=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 +process/hdr_as_srgb=false +process/size_limit=0 +detect_3d/compress_to=1