Gonna call it on the camera stuff for now.
This commit is contained in:
parent
ae43827c28
commit
60ee655001
|
|
@ -1,11 +1,12 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/camera_guide.gd" type="Script" id=5]
|
||||
[ext_resource path="res://src/game_camera.gd" type="Script" id=6]
|
||||
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=5]
|
||||
[ext_resource path="res://src/Camera2D.gd" type="Script" id=6]
|
||||
[ext_resource path="res://src/Main.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="Shader" id=2]
|
||||
code = "shader_type canvas_item;
|
||||
|
|
@ -24,6 +25,7 @@ shader_param/cam_offset = Vector2( 0, 0 )
|
|||
extents = Vector2( 160, 90 )
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ onready var current_music_track :AudioStream
|
|||
|
||||
onready var viewport_container = get_node("/root/Main/ViewportContainer") #$ViewportContainer
|
||||
onready var viewport = get_node("/root/Main/ViewportContainer/Viewport") # $ViewportContainer/Viewport
|
||||
onready var camera_guide :CameraGuide = get_node("/root/Main/ViewportContainer/Viewport/CameraGuide")
|
||||
|
||||
func change_music_track(_music_track :AudioStream ):
|
||||
if current_music_track != _music_track:
|
||||
|
|
@ -36,9 +37,11 @@ func change_level(_level_name :String, _position_name :String):
|
|||
#var simultaneous_scene = preload("res://levels/level2.tscn").instance()
|
||||
var new_level = load("res://src/levels/" + _level_name + ".tscn" ).instance()
|
||||
#print (get_tree().get_root().get_children())
|
||||
|
||||
for l in get_node("/root/Main/ViewportContainer/Viewport").get_children():
|
||||
#print (get_node("/root/Main").get_children())
|
||||
if l is Level:
|
||||
camera_guide.disable_tracking()
|
||||
SceneTransition.transition_dissolve("foo")
|
||||
yield(SceneTransition,"done")
|
||||
print(l)
|
||||
|
|
@ -49,7 +52,10 @@ func change_level(_level_name :String, _position_name :String):
|
|||
if new_level.entrances.has(_position_name):
|
||||
player_start_position = new_level.entrances[_position_name].transform.origin
|
||||
print (get_node("/root/Main/ViewportContainer/Viewport").get_children())
|
||||
#get_node("/root/Main/ViewportContainer/Viewport/CameraGuide").global_position = Vector2(160,90)
|
||||
SceneTransition.reset()
|
||||
camera_guide.transform.origin = Vector2(160,90)
|
||||
camera_guide.enable_tracking()
|
||||
#get_node("/root/Main").add_child_below_node(SceneTransition,new_level)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://lib/classes/audiostreamplayer_state_receiver.gd"
|
||||
}, {
|
||||
"base": "KinematicBody2D",
|
||||
"class": "CameraGuide",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/classes/camera_guide.gd"
|
||||
}, {
|
||||
"base": "",
|
||||
"class": "GitAPI",
|
||||
"language": "NativeScript",
|
||||
|
|
@ -118,6 +123,7 @@ _global_script_class_icons={
|
|||
"Actor": "",
|
||||
"AnimatedSprite_StateReceiver": "",
|
||||
"AudioStreamPlayer_StateReceiver": "",
|
||||
"CameraGuide": "",
|
||||
"GitAPI": "",
|
||||
"HealthComponent": "",
|
||||
"HealthPickup": "",
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/quick_health.png" type="Texture" id=1]
|
||||
[gd_resource type="SpriteFrames" load_steps=5 format=2]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 15, 13 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 15, 0, 15, 13 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 30, 0, 15, 13 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 45, 0, 15, 13 )
|
||||
|
||||
[resource]
|
||||
|
|
|
|||
17
src/Main.gd
Normal file
17
src/Main.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
export var starting_level: PackedScene
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
class_name CameraGuide
|
||||
extends KinematicBody2D
|
||||
|
||||
|
||||
|
|
@ -7,11 +8,19 @@ extends KinematicBody2D
|
|||
var game_size := Vector2(320,180)
|
||||
onready var window_scale :float = (OS.window_size / game_size).x
|
||||
|
||||
var _is_tracking :bool = true
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func enable_tracking() -> void:
|
||||
##TODO: add extra collission checks here to make sure we aren't stuck maybe?
|
||||
_is_tracking = true
|
||||
|
||||
func disable_tracking() -> void:
|
||||
_is_tracking = false
|
||||
|
||||
var flip_tracker = 0.0
|
||||
var stuck_check: bool
|
||||
func _physics_process(delta):
|
||||
|
|
@ -20,7 +20,6 @@ extents = Vector2( 8, 40 )
|
|||
points = PoolVector2Array( 20, 20, 0.326027, 20, 0.326027, 0.605103, 20, 0.605103 )
|
||||
|
||||
[sub_resource type="TileSet" id=4]
|
||||
resource_name = "NoCam"
|
||||
0/name = "no_cam_tile.png 0"
|
||||
0/texture = ExtResource( 6 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
|
|
@ -63,15 +62,15 @@ position = Vector2( 80, 131 )
|
|||
damage_amount = 10
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Hitbox_Component" index="0"]
|
||||
margin_left = 263.0
|
||||
margin_top = 115.0
|
||||
margin_right = 273.0
|
||||
margin_bottom = 124.0
|
||||
margin_left = 266.0
|
||||
margin_top = 90.0
|
||||
margin_right = 276.0
|
||||
margin_bottom = 99.0
|
||||
color = Color( 1, 0, 0, 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="1"]
|
||||
modulate = Color( 1, 0, 0, 1 )
|
||||
position = Vector2( 268, 119 )
|
||||
position = Vector2( 271, 94 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user