Make the Platformer 2D demo work with ultrawide displays

This makes it possible to fill the whole viewport when playing on
a 21:9 monitor or a 19:9 smartphone.
This commit is contained in:
Hugo Locurcio
2019-04-22 21:48:19 +02:00
parent c2d2718cca
commit 974e506371
8 changed files with 36 additions and 42 deletions

View File

@@ -4,18 +4,11 @@
[ext_resource path="res://coin/Coin.tscn" type="PackedScene" id=2]
[ext_resource path="res://platform/MovingPlatform.tscn" type="PackedScene" id=3]
[ext_resource path="res://platform/OneWayPlatform.tscn" type="PackedScene" id=4]
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=5]
[ext_resource path="res://enemy/Enemy.tscn" type="PackedScene" id=6]
[ext_resource path="res://background/ParallaxBg.tscn" type="PackedScene" id=7]
[ext_resource path="res://enemy/Enemy.tscn" type="PackedScene" id=5]
[ext_resource path="res://background/ParallaxBg.tscn" type="PackedScene" id=6]
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=7]
[ext_resource path="res://audio/music.ogg" type="AudioStream" id=8]
[node name="Stage" type="Node"]
[node name="TileMap" type="TileMap" parent="."]
@@ -220,45 +213,45 @@ position = Vector2( 1099.56, 940.804 )
[node name="OneWayPlatform13" parent="Props" instance=ExtResource( 4 )]
position = Vector2( 1339.63, 967.879 )
[node name="Player" parent="." instance=ExtResource( 5 )]
[node name="Player" parent="." instance=ExtResource( 7 )]
position = Vector2( 251.684, 1045.6 )
[node name="Enemies" type="Node" parent="."]
[node name="Enemy1" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy1" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 734.693, 1064.22 )
[node name="Enemy2" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy2" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 707.665, 1225.05 )
[node name="Enemy3" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy3" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 1125.21, 1053.06 )
[node name="Enemy4" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy4" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 1292.11, 1059.24 )
[node name="Enemy5" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy5" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 968.927, 766.466 )
[node name="Enemy6" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy6" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 3080.34, 1807.61 )
[node name="Enemy7" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy7" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 1457.6, 688.741 )
[node name="Enemy8" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy8" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 1264.06, 571.713 )
[node name="Enemy9" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy9" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 3590.85, 1114.86 )
[node name="Enemy10" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy10" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 3546.2, 1356.19 )
[node name="Enemy11" parent="Enemies" instance=ExtResource( 6 )]
[node name="Enemy11" parent="Enemies" instance=ExtResource( 5 )]
position = Vector2( 2215.3, 1429.39 )
[node name="ParallaxBg" parent="." instance=ExtResource( 7 )]
[node name="ParallaxBg" parent="." instance=ExtResource( 6 )]
[node name="Label" type="Label" parent="."]
margin_left = 12.0
@@ -273,4 +266,3 @@ autowrap = true
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 )
autoplay = true

View File

@@ -14,7 +14,7 @@ scroll_base_scale = Vector2( 0.7, 0 )
motion_mirroring = Vector2( 800, 0 )
[node name="Sprite" type="Sprite" parent="Sky"]
scale = Vector2( 32, 0.94 )
scale = Vector2( 128, 0.94 )
texture = ExtResource( 1 )
centered = false
@@ -54,23 +54,18 @@ centered = false
[node name="Mount2" type="ParallaxLayer" parent="."]
motion_scale = Vector2( 0.2, 1 )
motion_mirroring = Vector2( 800, 0 )
[node name="Sprite" type="Sprite" parent="Mount2"]
position = Vector2( 0, 225 )
position = Vector2( 0, 353 )
texture = ExtResource( 5 )
centered = false
region_enabled = true
region_rect = Rect2( 0, 0, 800, 256 )
region_rect = Rect2( 0, 0, 4096, 256 )
[node name="Mount1" type="ParallaxLayer" parent="."]
motion_scale = Vector2( 0.4, 1 )
motion_mirroring = Vector2( 800, 0 )
[node name="Sprite" type="Sprite" parent="Mount1"]
position = Vector2( 0, 225 )
position = Vector2( 0, 353 )
texture = ExtResource( 6 )
centered = false
region_enabled = true
region_rect = Rect2( 0, 0, 800, 256 )
region_rect = Rect2( 0, 0, 4096, 256 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -19,7 +19,7 @@ compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/repeat=1
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -19,7 +19,7 @@ compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/repeat=1
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false

View File

@@ -247,17 +247,24 @@ passby_press = true
action = "move_right"
visibility_mode = 1
[node name="Jump" type="TouchScreenButton" parent="UI"]
position = Vector2( 666.224, 359.02 )
[node name="BottomRightAnchor" type="Control" parent="UI"]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -40.0
margin_top = -40.0
[node name="Jump" type="TouchScreenButton" parent="UI/BottomRightAnchor"]
position = Vector2( -98.151, -83.768 )
scale = Vector2( 1.49157, 1.46265 )
normal = ExtResource( 7 )
action = "jump"
visibility_mode = 1
[node name="Fire" type="TouchScreenButton" parent="UI"]
position = Vector2( 668.073, 262.788 )
[node name="Fire" type="TouchScreenButton" parent="UI/BottomRightAnchor"]
position = Vector2( -96.302, -180 )
scale = Vector2( 1.49157, 1.46265 )
normal = ExtResource( 8 )
action = "shoot"
visibility_mode = 1

View File

@@ -62,7 +62,7 @@ gdscript/warnings/unsafe_call_argument=true
window/size/width=800
window/size/height=480
window/stretch/mode="2d"
window/stretch/aspect="keep"
window/stretch/aspect="keep_height"
stretch/aspect="keep_height"
stretch/mode="2d"