split in different scenes

This commit is contained in:
Mylloon 2021-04-08 02:55:42 +02:00
parent 9ac952b453
commit 8071cba7ce
4 changed files with 180 additions and 163 deletions

43
scenes/Joueur.tscn Normal file
View file

@ -0,0 +1,43 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://scripts/Joueur.gd" type="Script" id=1]
[ext_resource path="res://assets/sounds/background.wav" type="AudioStream" id=2]
[ext_resource path="res://assets/images/lumiere.png" type="Texture" id=3]
[ext_resource path="res://assets/images/joueur.png" type="Texture" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 8 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 9, 9 )
[node name="Joueur" type="KinematicBody2D"]
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 4 )
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 2 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true
zoom = Vector2( 0.6, 0.6 )
smoothing_enabled = true
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Camera2D"]
stream = ExtResource( 2 )
volume_db = -20.0
autoplay = true
[node name="Light2D" type="Light2D" parent="."]
texture = ExtResource( 3 )
energy = 1.5
mode = 2
shadow_enabled = true
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]

View file

@ -1,164 +1,16 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://scenes/Ennemi.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/PortailDeFin.gd" type="Script" id=2]
[ext_resource path="res://scripts/Joueur.gd" type="Script" id=3]
[ext_resource path="res://scenes/PortailDeFin.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/Joueur.tscn" type="PackedScene" id=3]
[ext_resource path="res://scenes/mur.tres" type="TileSet" id=4]
[ext_resource path="res://assets/images/joueur.png" type="Texture" id=5]
[ext_resource path="res://assets/images/fond.png" type="Texture" id=6]
[ext_resource path="res://assets/images/lumiere.png" type="Texture" id=7]
[ext_resource path="res://assets/sounds/background.wav" type="AudioStream" id=8]
[ext_resource path="res://assets/images/sortie.png" type="Texture" id=9]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 8 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 9, 9 )
[sub_resource type="CanvasItemMaterial" id=3]
[sub_resource type="CanvasItemMaterial" id=1]
light_mode = 2
[sub_resource type="CircleShape2D" id=4]
radius = 35.9876
[node name="Monde" type="Node2D"]
[node name="Joueur" type="KinematicBody2D" parent="."]
position = Vector2( -150, -150 )
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Joueur"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Joueur"]
texture = ExtResource( 5 )
[node name="Area2D" type="Area2D" parent="Joueur"]
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Joueur/Area2D"]
shape = SubResource( 2 )
[node name="Camera2D" type="Camera2D" parent="Joueur"]
current = true
zoom = Vector2( 0.6, 0.6 )
smoothing_enabled = true
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Joueur/Camera2D"]
stream = ExtResource( 8 )
volume_db = -20.0
autoplay = true
[node name="Light2D" type="Light2D" parent="Joueur"]
texture = ExtResource( 7 )
energy = 1.5
mode = 2
shadow_enabled = true
[node name="Ennemi" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 136.022, 44.8325 )
[node name="Ennemi22" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 464.455, 879.689 )
[node name="Ennemi23" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1045.04, -220.033 )
[node name="Ennemi24" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 888.24, 180.444 )
[node name="Ennemi25" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 638.207, -236.985 )
[node name="Ennemi26" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 625.494, -92.8977 )
[node name="Ennemi18" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 462.336, -232.747 )
[node name="Ennemi19" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 80.9297, 470.737 )
[node name="Ennemi20" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 462.336, 591.515 )
[node name="Ennemi21" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 322.487, 142.303 )
[node name="Ennemi11" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( -344.974, 233.417 )
[node name="Ennemi12" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( -323.785, 453.785 )
[node name="Ennemi13" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 900.954, -71.7085 )
[node name="Ennemi14" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1203.96, -84.422 )
[node name="Ennemi15" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1432.8, 216.465 )
[node name="Ennemi16" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1331.1, 466.499 )
[node name="Ennemi17" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1013.26, 237.655 )
[node name="Ennemi2" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 896.716, 629.656 )
[node name="Ennemi3" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 1377.71, 739.84 )
[node name="Ennemi4" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 915.786, 879.689 )
[node name="Ennemi5" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 248.325, 767.386 )
[node name="Ennemi6" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( -163.044, 437.294 )
[node name="Ennemi7" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 781.651, 417.495 )
[node name="Ennemi8" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 665.685, 80.9117 )
[node name="Ennemi9" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( 323.446, -78.8944 )
[node name="Ennemi10" parent="." instance=ExtResource( 1 )]
material = SubResource( 3 )
position = Vector2( -253.553, -220.316 )
[node name="Fond" type="Sprite" parent="."]
position = Vector2( 524.754, 245.313 )
scale = Vector2( 1.70024, 1.50506 )
@ -174,16 +26,114 @@ tile_data = PoolIntArray( -1376258, 0, 0, -1376257, 0, 0, -1441792, 0, 0, -14417
[node name="CanvasModulate" type="CanvasModulate" parent="."]
color = Color( 0.27451, 0.27451, 0.27451, 1 )
[node name="Portail de fin" type="Area2D" parent="."]
script = ExtResource( 2 )
[node name="Joueur" parent="." instance=ExtResource( 3 )]
position = Vector2( -150, -150 )
[node name="Sprite" type="Sprite" parent="Portail de fin"]
position = Vector2( 1150, 860 )
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 9 )
[node name="Ennemis" type="Node2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Portail de fin"]
[node name="Ennemi" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 136.022, 44.8325 )
[node name="Ennemi2" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 896.716, 629.656 )
[node name="Ennemi3" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1377.71, 739.84 )
[node name="Ennemi4" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 915.786, 879.689 )
[node name="Ennemi5" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 248.325, 767.386 )
[node name="Ennemi6" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( -163.044, 437.294 )
[node name="Ennemi7" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 781.651, 417.495 )
[node name="Ennemi8" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 665.685, 80.9117 )
[node name="Ennemi9" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 323.446, -78.8944 )
[node name="Ennemi10" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( -253.553, -220.316 )
[node name="Ennemi11" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( -344.974, 233.417 )
[node name="Ennemi12" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( -323.785, 453.785 )
[node name="Ennemi13" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 900.954, -71.7085 )
[node name="Ennemi14" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1203.96, -84.422 )
[node name="Ennemi15" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1432.8, 216.465 )
[node name="Ennemi16" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1331.1, 466.499 )
[node name="Ennemi17" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1013.26, 237.655 )
[node name="Ennemi18" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 462.336, -232.747 )
[node name="Ennemi19" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 80.9297, 470.737 )
[node name="Ennemi20" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 462.336, 591.515 )
[node name="Ennemi21" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 322.487, 142.303 )
[node name="Ennemi22" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 464.455, 879.689 )
[node name="Ennemi23" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 1045.04, -220.033 )
[node name="Ennemi24" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 888.24, 180.444 )
[node name="Ennemi25" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 638.207, -236.985 )
[node name="Ennemi26" parent="Ennemis" instance=ExtResource( 1 )]
material = SubResource( 1 )
position = Vector2( 625.494, -92.8977 )
[node name="Portail de fin" parent="." instance=ExtResource( 2 )]
position = Vector2( 1150, 860 )
shape = SubResource( 4 )
[connection signal="body_entered" from="Joueur/Area2D" to="Joueur" method="_on_Area2D_body_entered"]
[connection signal="body_entered" from="Portail de fin" to="Portail de fin" method="_on_Portail_de_fin_body_entered"]

24
scenes/PortailDeFin.tscn Normal file
View file

@ -0,0 +1,24 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/images/sortie.png" type="Texture" id=1]
[ext_resource path="res://scripts/PortailDeFin.gd" type="Script" id=2]
[ext_resource path="res://assets/images/lumiere.png" type="Texture" id=3]
[sub_resource type="CircleShape2D" id=2]
radius = 35.9876
[node name="Portail de fin" type="Area2D"]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 1.5, 1.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
[node name="Light2D" type="Light2D" parent="."]
texture = ExtResource( 3 )
energy = 0.5
mode = 2
[connection signal="body_entered" from="." to="." method="_on_Portail_de_fin_body_entered"]

View file

@ -8,7 +8,7 @@ func _ready():
pass
func _physics_process(_delta):
var Joueur = get_parent().get_node("Joueur") # récupère le joueur
var Joueur = get_parent().get_parent().get_node("Joueur") # récupère le joueur
if (Joueur.position.x + ecart) > position.x and (Joueur.position.y + (ecart + 10)) > position.y:
vitesse = 50 # se déplace vers le joueur
else: