Door init
This commit is contained in:
parent
6c32e51c28
commit
4c668c6c56
5 changed files with 54 additions and 18 deletions
8
core/Door.gd
Normal file
8
core/Door.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var NextScene = PackedScene
|
||||
|
||||
func _on_area_2d_area_entered(area):
|
||||
if(area):
|
||||
if(MapManager and MapManager.player == area.get_parent()):
|
||||
MapManager.transition_to_scene(NextScene) # Replace with function body.
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=23 format=3 uid="uid://0m1hk2nu4bps"]
|
||||
[gd_scene load_steps=24 format=3 uid="uid://0m1hk2nu4bps"]
|
||||
|
||||
[ext_resource type="Script" path="res://core/player.gd" id="1_whhfc"]
|
||||
[ext_resource type="Texture2D" uid="uid://5pmqr3y62guu" path="res://textures/player/currentCloth.tres" id="2_w1l4c"]
|
||||
|
@ -499,6 +499,10 @@ node_connections = [&"output", 0, &"WalkRun"]
|
|||
[sub_resource type="CanvasTexture" id="CanvasTexture_2b3h6"]
|
||||
diffuse_texture = ExtResource("6_3ryww")
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_8drh2"]
|
||||
radius = 130.0
|
||||
height = 550.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_whhfc")
|
||||
|
@ -546,23 +550,23 @@ parameters/WalkRun/3/TimeScale/scale = 0.3
|
|||
position = Vector2(17, 0)
|
||||
|
||||
[node name="BootL" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-51.293, -36.973)
|
||||
rotation = 0.119813
|
||||
position = Vector2(26.1847, -40.3173)
|
||||
rotation = -0.416324
|
||||
texture = ExtResource("2_w1l4c")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
metadata/Type = "Skin"
|
||||
|
||||
[node name="BootR" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(5.51367, -43.3018)
|
||||
rotation = -0.307954
|
||||
position = Vector2(-58.0291, -47.2035)
|
||||
rotation = 0.356209
|
||||
texture = ExtResource("2_w1l4c")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(896, 768, 128, 128)
|
||||
metadata/Type = "Skin"
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(51, -231.006)
|
||||
position = Vector2(51, -239.87)
|
||||
texture = ExtResource("2_w1l4c")
|
||||
offset = Vector2(-15, 0)
|
||||
region_enabled = true
|
||||
|
@ -586,7 +590,7 @@ metadata/Type = "Skin"
|
|||
|
||||
[node name="Tail" type="Sprite2D" parent="Skeleton2D/Body"]
|
||||
show_behind_parent = true
|
||||
position = Vector2(44, 101.006)
|
||||
position = Vector2(44, 109.87)
|
||||
rotation = 0.153589
|
||||
texture = ExtResource("2_w1l4c")
|
||||
offset = Vector2(70, 0)
|
||||
|
@ -595,8 +599,8 @@ region_rect = Rect2(768, 640, 256, 128)
|
|||
metadata/Type = "Skin"
|
||||
|
||||
[node name="Head" type="Sprite2D" parent="Skeleton2D"]
|
||||
position = Vector2(-40, -404.006)
|
||||
rotation = 0.0641361
|
||||
position = Vector2(-40, -412.87)
|
||||
rotation = 0.0100771
|
||||
texture = ExtResource("2_w1l4c")
|
||||
offset = Vector2(0, -168)
|
||||
region_enabled = true
|
||||
|
@ -684,3 +688,9 @@ z_index = -1
|
|||
position = Vector2(42, -381)
|
||||
scale = Vector2(1.89731, 1.89731)
|
||||
texture = SubResource("CanvasTexture_2b3h6")
|
||||
|
||||
[node name="DetectionArea" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DetectionArea"]
|
||||
position = Vector2(0, -266.265)
|
||||
shape = SubResource("CapsuleShape2D_8drh2")
|
||||
|
|
|
@ -7,13 +7,16 @@ extends Node2D
|
|||
|
||||
@onready var current_scene = $CurrentScene
|
||||
#@onready var scene_transition = $ScreenTransition/AnimationPlayer
|
||||
var player
|
||||
var player:Object
|
||||
|
||||
func transition_to_scene(new_scene: PackedScene, spawn_location = Vector2(0,0), spawn_direction = 1):
|
||||
func transition_to_scene(new_scene: PackedScene, spawn_location = Transform2D.IDENTITY, spawn_direction = 1):
|
||||
#screen_transition.play('FadeToBlack')
|
||||
if(current_scene.get_child_count() > 0 and current_scene.get_child(0)):
|
||||
current_scene.get_child(0).queue_free()
|
||||
if (new_scene):
|
||||
#if(current_scene.get_child_count() > 0 and current_scene.get_child(0)):
|
||||
#current_scene.get_child(0).queue_free()
|
||||
current_scene.add_child(new_scene.instantiate())
|
||||
else:
|
||||
printerr("No New Scene")
|
||||
|
||||
#region Spawn Player
|
||||
if (player):
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
[gd_scene load_steps=33 format=3 uid="uid://wlqsvbqpcbh"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://wlqsvbqpcbh"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cacwy4tka88k1" path="res://maps/map1.tres" id="1_pt5vq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxharyv0ajr37" path="res://textures/atlas/DioramaEntrance_All_01_SPRT.png" id="2_n7y5f"]
|
||||
[ext_resource type="Script" path="res://core/Door.gd" id="3_f6bw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5bd2ta3esnib" path="res://extracted/4010-A Tiny Sticker Tale review pic 1.jpg" id="3_yh2wy"]
|
||||
[ext_resource type="PackedScene" uid="uid://5tfe84u3gyty" path="res://maps/map2.tscn" id="4_2vdcy"]
|
||||
[ext_resource type="PackedScene" uid="uid://bddcriwo55x8k" path="res://prefab/prefab_woddenbridge.tscn" id="4_okpsn"]
|
||||
[ext_resource type="Texture2D" uid="uid://cun14l52f477p" path="res://textures/atlas/Bushes_All_01_SPRT.png" id="5_xmosd"]
|
||||
[ext_resource type="PackedScene" uid="uid://domcpxdf6lqpb" path="res://prefab/free_sticker.tscn" id="6_3fkbm"]
|
||||
|
@ -22,6 +24,9 @@ region = Rect2(252, 16, 108, 256)
|
|||
atlas = ExtResource("2_n7y5f")
|
||||
region = Rect2(12, 96, 216, 112)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ajnvj"]
|
||||
size = Vector2(202.667, 60.3336)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ex6vq"]
|
||||
atlas = ExtResource("2_n7y5f")
|
||||
region = Rect2(0, 16, 228, 80)
|
||||
|
@ -130,6 +135,15 @@ flip_h = true
|
|||
position = Vector2(-0.333333, 457.667)
|
||||
texture = SubResource("AtlasTexture_wi524")
|
||||
flip_h = true
|
||||
script = ExtResource("3_f6bw5")
|
||||
NextScene = ExtResource("4_2vdcy")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="Floors05Sprt/Door3"]
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floors05Sprt/Door3/Area2D"]
|
||||
position = Vector2(-3.57628e-07, -15.667)
|
||||
shape = SubResource("RectangleShape2D_ajnvj")
|
||||
|
||||
[node name="Door4" type="Sprite2D" parent="Floors05Sprt"]
|
||||
position = Vector2(14.3333, -456.333)
|
||||
|
@ -329,3 +343,5 @@ energy = 1.2
|
|||
shadow_enabled = true
|
||||
texture = ExtResource("13_sm1ou")
|
||||
texture_scale = 1.9
|
||||
|
||||
[connection signal="area_entered" from="Floors05Sprt/Door3/Area2D" to="Floors05Sprt/Door3" method="_on_area_2d_area_entered"]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://d382cexpr4075"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d382cexpr4075"]
|
||||
|
||||
[ext_resource type="Script" path="res://core/sceneInstance.gd" id="1_p0vo1"]
|
||||
[ext_resource type="PackedScene" uid="uid://0m1hk2nu4bps" path="res://core/player.tscn" id="2_fyjh8"]
|
||||
[ext_resource type="PackedScene" uid="uid://wlqsvbqpcbh" path="res://maps/map1.tscn" id="2_qgqfi"]
|
||||
[ext_resource type="PackedScene" uid="uid://524sv8spw6go" path="res://core/Cursor.tscn" id="4_uwedi"]
|
||||
|
||||
[node name="MapManager" type="Node2D"]
|
||||
script = ExtResource("1_p0vo1")
|
||||
|
@ -12,6 +11,6 @@ InitialMap = ExtResource("2_qgqfi")
|
|||
|
||||
[node name="CurrentScene" type="Node2D" parent="."]
|
||||
|
||||
[node name="Cursor" parent="." instance=ExtResource("4_uwedi")]
|
||||
[node name="NextScene" type="Node2D" parent="."]
|
||||
|
||||
[connection signal="ready" from="." to="." method="_on_ready"]
|
||||
|
|
Loading…
Reference in a new issue