Cleanup CameraGuide and SceneTransition
This commit is contained in:
parent
5ba9c972e6
commit
08b49022ff
|
|
@ -56,6 +56,7 @@ position = Vector2( 160, 90 )
|
|||
collision_layer = 0
|
||||
collision_mask = 256
|
||||
script = ExtResource( 1 )
|
||||
debug_camera_guide = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/CameraGuide"]
|
||||
visible = false
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func change_level(_level_name :String, _position_name :String):
|
|||
# No more errors but I'd like to know how to do this.
|
||||
#SceneTransition.transition_dissolve("foo")
|
||||
#yield(SceneTransition,"done")
|
||||
yield(SceneTransition.transition_dissolve("foo"), "completed")
|
||||
yield(SceneTransition.transition_dissolve(), "completed")
|
||||
print(l)
|
||||
viewport.remove_child(l)
|
||||
viewport.add_child(new_level)
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://lib/classes/sound_effect_state_frame.gd"
|
||||
}, {
|
||||
"base": "CanvasLayer",
|
||||
"class": "SceneTransitions",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/classes/scene_transition.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "StaminaComponent",
|
||||
"language": "GDScript",
|
||||
|
|
@ -170,6 +175,7 @@ _global_script_class_icons={
|
|||
"PlayerData": "",
|
||||
"Projectile": "",
|
||||
"SE_StateFrame": "",
|
||||
"SceneTransitions": "",
|
||||
"StaminaComponent": "",
|
||||
"State": "",
|
||||
"StateAnimatedActor": "",
|
||||
|
|
|
|||
|
|
@ -1,20 +1,27 @@
|
|||
class_name CameraGuide
|
||||
extends KinematicBody2D
|
||||
|
||||
export var debug_camera_guide :bool = false
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
var game_size := Vector2(320,180)
|
||||
onready var window_scale :float = (OS.window_size / game_size).x
|
||||
var game_size :Vector2
|
||||
onready var window_scale :float
|
||||
onready var viewport = $"%Viewport"
|
||||
|
||||
var _is_tracking :bool = true
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
game_size = viewport.size
|
||||
window_scale = (OS.window_size / game_size).x
|
||||
assert(game_size != Vector2(0,0), str(get_path()) + " : No game_size set.")
|
||||
if debug_camera_guide:
|
||||
print(get_path(), "\n",
|
||||
"\tSize:", game_size,
|
||||
"\tScale:", window_scale)
|
||||
## Do not track until told to
|
||||
disable_tracking()
|
||||
|
||||
|
||||
func enable_tracking() -> void:
|
||||
##TODO: add extra collission checks here to make sure we aren't stuck maybe?
|
||||
_is_tracking = true
|
||||
|
|
@ -30,7 +37,7 @@ func reset_position() -> void:
|
|||
|
||||
var flip_tracker = 0.0
|
||||
var stuck_check: bool
|
||||
func _physics_process(delta):
|
||||
func _physics_process(_delta):
|
||||
var pos = global_position
|
||||
#pos = pos.move_toward(PlayerInfo.player_position, delta)
|
||||
#pos = lerp(pos, PlayerInfo.player_position, delta )
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
extends CanvasLayer
|
||||
|
||||
signal done
|
||||
|
||||
#func change_scene(target: String, type: String = 'dissolve') -> void:
|
||||
# if type == 'dissolve':
|
||||
# transition_dissolve(target)
|
||||
# else:
|
||||
# transition_clouds(target)
|
||||
|
||||
var animation_name = ''
|
||||
|
||||
func reset():
|
||||
$AnimationPlayer.play_backwards(animation_name)
|
||||
emit_signal("done")
|
||||
|
||||
func transition_dissolve(target: String) -> void:
|
||||
animation_name = 'dissolve'
|
||||
$AnimationPlayer.play('dissolve')
|
||||
yield($AnimationPlayer,'animation_finished')
|
||||
emit_signal("done")
|
||||
#get_tree().change_scene(target)
|
||||
#$AnimationPlayer.play_backwards('dissolve')
|
||||
|
||||
func transition_clouds(target: String) -> void:
|
||||
animation_name = 'clouds_out'
|
||||
$AnimationPlayer.play('clouds_in')
|
||||
yield($AnimationPlayer,'animation_finished')
|
||||
emit_signal("done")
|
||||
#get_tree().change_scene(target)
|
||||
#$AnimationPlayer.play('clouds_out')
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://src/ui/scene_transition.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/classes/scene_transition.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/UI/transition_screen.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user