R prototype lvl made. Coins and coinHUD added

This commit is contained in:
Martin Araneda 2022-08-28 20:15:40 -04:00
parent 7e57e78205
commit 0e4bad4823
6 changed files with 119 additions and 4 deletions

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://Main.gdns" type="Script" id=1] [ext_resource path="res://Main.gdns" type="Script" id=1]
[ext_resource path="res://levels/Prototype.tscn" type="PackedScene" id=2] [ext_resource path="res://levels/PrototypeR.tscn" type="PackedScene" id=2]
[ext_resource path="res://GUI/GameOver.tscn" type="PackedScene" id=3] [ext_resource path="res://GUI/GameOver.tscn" type="PackedScene" id=3]
[node name="Main" type="Node"] [node name="Main" type="Node"]

View File

@ -14,7 +14,6 @@
collision_layer = 5 collision_layer = 5
[node name="Camera2D" type="Camera2D" parent="Player"] [node name="Camera2D" type="Camera2D" parent="Player"]
current = true
limit_left = 0 limit_left = 0
limit_top = 0 limit_top = 0
limit_right = 512 limit_right = 512

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="120" height="32" tilewidth="18" tileheight="18" infinite="0" nextlayerid="4" nextobjectid="1">
<tileset firstgid="1" source="../tilesets/tiles.tsx"/>
<layer id="3" name="Background" width="120" height="32">
<data encoding="base64" compression="zstd">
KLUv/WAAO9UGAOQDABIAAAATFAAnEiYoEjo8YgAAADs6dQA6iwAAAIwAOnUAihIoADd/YwAAAGQAAAB4AAAAdiY3ADqLYwAAgAA8oBCVNdsBwAKTQCJcY8XxUYoarT8gQjyeu5O6nkqpOlT1gMJhyWO43xyk5jp+D3SGOxcoT52U4vScQx63fcb98i+k3jK5QUu8pNUR8O+i4l7VPW51R5d4k1T3FuabG4vErcrOI+U6fRflI6vfRsa41pUIv1HPe0OudqI1qDNHH2bcTSH3r27pd6Tac6lM+3bwXaj+q2cxvogB
</data>
</layer>
<layer id="1" name="Middleground" width="120" height="32">
<data encoding="base64" compression="zstd">
KLUv/WAAOz0FAIQCADEAAAAyMwACAAAAAwQAAhYAAAAXGAB6AAAAe3wAF4ZfAHuIAIZeiCygMLF1UIIUiARiZAelj/9XjXZV/ipp0q1TfoI4FDJcav6xkgcm3cqld/XLYVzNgPGrRkX6pwiG831dQsKVhvGrM0E5nOTUdZpyl96SqGcYDzh1mVBuKT0+fmorpXmjgBlElduJp59uitTebrC/onYW//xER7myT2JL+hkD
</data>
</layer>
<layer id="2" name="Foreground" width="120" height="32">
<data encoding="base64" compression="zstd">
KLUv/WAAO70CAKgAdAB0AIiINzeIN0YjWjcjNyNuNwAaoJD2AWBDhVoO4YKf+iiKEtrHJVQSqc4GzhDlVlFe0Tb1bDJ629TRhBsftwpQtCpKtEu19HH9uSSqrEzywUAhHQ==
</data>
</layer>
</map>

View File

@ -0,0 +1,24 @@
[remap]
importer="vnen.tiled_importer"
type="PackedScene"
path="res://.import/PrototypeR.tmx-dfb7d18f520c5c44182a13443fe1b69c.scn"
[deps]
source_file="res://levels/PrototypeR.tmx"
dest_files=[ "res://.import/PrototypeR.tmx-dfb7d18f520c5c44182a13443fe1b69c.scn" ]
[params]
custom_properties=true
tile_metadata=false
uv_clip=true
y_sort=false
image_flags=0
collision_layer=2
collision_mask=0
embed_internal_images=false
save_tiled_properties=false
add_background=true
post_import_script=""

View File

@ -0,0 +1,72 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://levels/PrototypeR.tmx" type="PackedScene" id=3]
[ext_resource path="res://assets/backgrounds/hills.png" type="Texture" id=4]
[ext_resource path="res://hud/CoinHUD.tscn" type="PackedScene" id=5]
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=6]
[node name="Prototype" type="Node2D"]
[node name="Player" parent="." instance=ExtResource( 2 )]
collision_layer = 5
[node name="Camera2D" type="Camera2D" parent="Player"]
current = true
limit_left = 0
limit_top = 0
limit_right = 512
limit_bottom = 288
drag_margin_h_enabled = true
drag_margin_v_enabled = true
__meta__ = {
"_edit_bone_": true
}
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="Player/Camera2D"]
rect = Rect2( 0, 0, 24, 24 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_scale = Vector2( 0.2, 0.1 )
motion_offset = Vector2( 0, -288 )
motion_mirroring = Vector2( 528, 0 )
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 4 )
centered = false
[node name="Map" type="Node2D" parent="."]
[node name="PrototypeR" parent="Map" instance=ExtResource( 3 )]
script = ExtResource( 1 )
[node name="CoinHUD" parent="." instance=ExtResource( 5 )]
[node name="Coins" type="Node" parent="."]
[node name="Coin" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 270, 432 )
[node name="Coin2" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 846, 252 )
[node name="Coin3" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 1278, 342 )
[node name="Coin4" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 1278, 180 )
[node name="Coin5" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 522, 270 )
[node name="Coin6" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 990, 324 )
[node name="Coin7" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 468, 306 )
[node name="Coin8" parent="Coins" instance=ExtResource( 6 )]
position = Vector2( 576, 306 )

View File

@ -36,9 +36,10 @@ void alai::GameOverScreen::_ready()
void alai::GameOverScreen::_on_restart_button_pressed() void alai::GameOverScreen::_on_restart_button_pressed()
{ {
if (_resource_loader->exists("res://levels/Prototype.tscn")) /*_r*/
if (_resource_loader->exists("res://levels/PrototypeR.tscn"))
{ {
godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/Prototype.tscn"); godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/PrototypeR.tscn");
auto level = level_scene->instance(); auto level = level_scene->instance();
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level"); auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");