mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
Cam & CamBounds working (-= level select working too
This commit is contained in:
parent
54ea3cff32
commit
f22ee3b33a
15 changed files with 118 additions and 226 deletions
|
|
@ -54,11 +54,6 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://src/class/savedict.gd"
|
||||
}, {
|
||||
"base": "Resource",
|
||||
"class": "StagePreview",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/stage/preview.gd"
|
||||
}, {
|
||||
"base": "Actor",
|
||||
"class": "Switch",
|
||||
"language": "GDScript",
|
||||
|
|
@ -79,7 +74,6 @@ _global_script_class_icons={
|
|||
"Passthrough": "",
|
||||
"Player": "",
|
||||
"SaveDict": "",
|
||||
"StagePreview": "",
|
||||
"Switch": "",
|
||||
"SwitchBlock": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ func _ready():
|
|||
btnx_array.append(0)
|
||||
|
||||
# assign camera target
|
||||
if !is_attract_mode and Shared.cam:
|
||||
if !is_attract_mode:
|
||||
Shared.cam.node_target = self
|
||||
Shared.cam.pos_target_offset = Vector2(4, 4)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@ extends Node
|
|||
|
||||
onready var node_ghost := $Ghost
|
||||
onready var node_ghosts := $Ghosts
|
||||
onready var cam := $Cam
|
||||
|
||||
var ghosts := []
|
||||
var ghost_count := 10
|
||||
|
||||
var cam : Camera2D
|
||||
var map_solid : TileMap
|
||||
var map_obscure : TileMap
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ func _ready():
|
|||
var dir = Directory.new()
|
||||
if !dir.open(save_path) == OK:
|
||||
dir.make_dir(save_path)
|
||||
for i in range(save_limit) + ["map"]:
|
||||
for i in save_limit:
|
||||
var s = save_path + str(i)
|
||||
if !dir.open(s) == OK:
|
||||
dir.make_dir(s)
|
||||
|
|
@ -112,10 +113,6 @@ func _ready():
|
|||
for i in dir_list(map_dir):
|
||||
scene_dict[map_dir + i] = load(map_dir + i)
|
||||
maps.append(i.split(".")[0])
|
||||
|
||||
#print("maps: ", maps, " ", maps.size(), " ", scene_dict)
|
||||
|
||||
|
||||
|
||||
|
||||
load_options()
|
||||
|
|
@ -125,59 +122,6 @@ func _ready():
|
|||
|
||||
Wipe.connect("finish", self, "wipe_finish")
|
||||
|
||||
func make_preview(inst : Node, map_short):
|
||||
# make preview
|
||||
var sp = StagePreview.new()
|
||||
sp.palette = inst.palette
|
||||
|
||||
for c in inst.get_children():
|
||||
var cname = c.name.to_lower()
|
||||
|
||||
var cells = []
|
||||
if "map" in cname:
|
||||
cells = c.get_used_cells()
|
||||
|
||||
if "spike" in cname:
|
||||
for p in cells:
|
||||
sp.spike += vec_string(p) + " "
|
||||
|
||||
elif "solid" in cname:
|
||||
for p in cells:
|
||||
make_key(p, c, sp.solid, 1)
|
||||
|
||||
elif "detail" in cname:
|
||||
for p in cells:
|
||||
make_key(p, c, sp.detail)
|
||||
|
||||
elif "obscure" in cname:
|
||||
for p in cells:
|
||||
make_key(p, c, sp.obscure, 0)
|
||||
|
||||
elif "camera" in cname:
|
||||
var p = c.position
|
||||
sp.camera = vec_string(p)
|
||||
|
||||
elif "actors" in cname:
|
||||
for a in c.get_children():
|
||||
var aname = a.name.to_lower()
|
||||
|
||||
var p = Vector2.ZERO
|
||||
if a is Node2D:
|
||||
p = a.position
|
||||
|
||||
if "player" in aname:
|
||||
sp.player = vec_string(p)
|
||||
|
||||
elif "exit" in aname:
|
||||
sp.exit = vec_string(p)
|
||||
|
||||
elif "box" in aname:
|
||||
sp.box += vec_string(p) + " "
|
||||
|
||||
|
||||
|
||||
ResourceSaver.save(save_path + "map/" + map_short + ".tres", sp)
|
||||
|
||||
func vec_string(p : Vector2):
|
||||
return str(int(p.x)) + "," + str(int(p.y))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://src/autoload/Shared.gd" type="Script" id=1]
|
||||
[ext_resource path="res://media/image/player_swap.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/shader/player_palette_swap.gdshader" type="Shader" id=3]
|
||||
[ext_resource path="res://src/stage/Cam.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
shader = ExtResource( 3 )
|
||||
|
|
@ -32,3 +33,7 @@ vframes = 2
|
|||
region_rect = Rect2( 0, 0, 8, 24 )
|
||||
|
||||
[node name="Ghosts" type="Node2D" parent="."]
|
||||
|
||||
[node name="Cam" type="Camera2D" parent="." groups=["game_camera"]]
|
||||
current = true
|
||||
script = ExtResource( 4 )
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource path="res://src/stage/SolidTileMap.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://media/image/player_swap.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/stage/GameCamera.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/stage/CamBounds.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/stage/DetailTileMap.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://media/image/tinyArrow.png" type="Texture" id=5]
|
||||
[ext_resource path="res://media/image/creator.png" type="Texture" id=6]
|
||||
|
|
@ -252,9 +252,10 @@ z_index = -11
|
|||
tile_set = SubResource( 22 )
|
||||
tile_data = PoolIntArray( 65516, 5, 0, 65517, 5, 0, 65518, 5, 0, 65519, 5, 0, 65520, 5, 0, 131052, 5, 0, 131053, 5, 0, 131054, 5, 0, 131055, 5, 0, 131056, 5, 0, 196588, 1073741829, 2, 196589, 5, 0, 196590, 5, 0, 196591, 5, 0, 196592, 1610612741, 2, 262125, 1073741829, 2, 262126, 5, 0, 262127, 1610612741, 2, 327662, 6, 0, 393198, 6, 0, 524273, 1073741829, 2, 524275, -1610612731, 2, 589811, -1610612731, 0, 655347, -1610612731, 0 )
|
||||
|
||||
[node name="GameCamera" parent="." instance=ExtResource( 3 )]
|
||||
[node name="CamBounds" type="Node2D" parent="."]
|
||||
position = Vector2( -92, 48 )
|
||||
zoom = Vector2( 0.5, 0.5 )
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Player" type="Node2D" parent="."]
|
||||
position = Vector2( -120, 40 )
|
||||
|
|
@ -1353,5 +1354,3 @@ margin_bottom = 7.0
|
|||
custom_fonts/font = SubResource( 14 )
|
||||
text = "random"
|
||||
align = 1
|
||||
|
||||
[editable path="GameCamera"]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ onready var user_label := $Username/Label
|
|||
onready var menu_stuff := main_menu.get_children()
|
||||
onready var credits_node := $Credits
|
||||
onready var stage := $Stage
|
||||
onready var cam := Shared.cam
|
||||
|
||||
export var open_player_path : NodePath = ""
|
||||
onready var open_player_mat : ShaderMaterial = get_node(open_player_path).material
|
||||
|
|
@ -125,13 +126,13 @@ func menu_select(tag : String = menu_items[clamp(cursor, 0, menu_items.size() -
|
|||
"options":
|
||||
open_sub(OptionsMenu)
|
||||
Audio.play("menu_options", 0.9, 1.1)
|
||||
Shared.cam.pos_target += Vector2(24, -4)
|
||||
cam.pos_target += Vector2(24, -4)
|
||||
"credits":
|
||||
is_credits = true
|
||||
credits_node.visible = true
|
||||
if parent_node:
|
||||
parent_node.visible = false
|
||||
Shared.cam.pos_target += Vector2(104, 0)
|
||||
cam.pos_target += Vector2(104, 0)
|
||||
Audio.play("menu_options", 0.9, 1.1)
|
||||
UI.keys(false, false, false, false)
|
||||
TouchScreen.show_keys()
|
||||
|
|
@ -167,7 +168,7 @@ func menu_select(tag : String = menu_items[clamp(cursor, 0, menu_items.size() -
|
|||
|
||||
|
||||
func on_close_sub():
|
||||
Shared.cam.pos_target = Vector2(90, 76)
|
||||
cam.pos_target = Vector2(90, 76)
|
||||
UI.keys(false)
|
||||
|
||||
func switch_menu(arg, silent := false, _cursor := 0):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
[ext_resource path="res://media/image/creator.png" type="Texture" id=1]
|
||||
[ext_resource path="res://media/image/crate_tiles.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/menu/StartMenu.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/stage/CamBounds.gd" type="Script" id=4]
|
||||
[ext_resource path="res://media/font/ThaleahFat.ttf" type="DynamicFontData" id=5]
|
||||
[ext_resource path="res://media/font/ExpressionPro.ttf" type="DynamicFontData" id=6]
|
||||
[ext_resource path="res://media/image/8pixel.png" type="Texture" id=7]
|
||||
|
|
@ -11,7 +12,6 @@
|
|||
[ext_resource path="res://src/menu/AttractMode.gd" type="Script" id=10]
|
||||
[ext_resource path="res://src/stage/SolidTileMap.tscn" type="PackedScene" id=11]
|
||||
[ext_resource path="res://src/actor/Player.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://src/stage/GameCamera.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/actor/SwitchBlockBlue.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://src/actor/SwitchBlue.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://media/image/menu.png" type="Texture" id=16]
|
||||
|
|
@ -1084,8 +1084,9 @@ z_index = -11
|
|||
tile_set = SubResource( 29 )
|
||||
tile_data = PoolIntArray( 131093, 536870916, 3, 131094, 4, 1, 131095, 4, 0, 131096, 4, 3, 196624, 5, 2, 196625, 5, 0, 196626, -1610612731, 2, 196630, 536870916, 0, 196631, 4, 1, 196632, 4, 0, 262154, 536870916, 3, 262155, 536870916, 0, 262156, 4, 3, 262159, 5, 2, 262160, 5, 0, 262161, 5, 0, 262162, 5, 0, 262163, -1610612731, 2, 262166, 4, 1, 262167, 4, 0, 262168, 4, 1, 327685, 5, 2, 327686, 5, 0, 327687, 5, 0, 327688, 5, 0, 327689, 536870917, 2, 327690, 536870916, 0, 327691, 4, 1, 327692, 4, 0, 327695, -1610612731, 0, 327696, 5, 0, 327697, 5, 0, 327698, 5, 0, 327699, -1073741819, 0, 327701, 536870916, 3, 327702, 4, 0, 327703, 4, 1, 327704, 536870916, 2, 393221, -1073741819, 0, 393227, 4, 1, 393228, 4, 0, 393229, 4, 3, 393231, -1073741819, 2, 393232, 5, 0, 393233, 5, 0, 393234, 5, 0, 393235, -536870907, 2, 393237, 536870916, 0, 393238, 4, 1, 393239, 536870916, 0, 458757, -1073741819, 2, 458759, -1610612731, 2, 458762, 4, 1, 458763, 536870916, 0, 458764, 4, 1, 458765, 4, 0, 458768, -1073741819, 2, 458769, 5, 0, 458770, 1610612741, 2, 458773, 4, 2, 458774, 4, 0, 458775, 4, 1, 458776, 4, 3, 524295, -1610612731, 0, 524298, 4, 2, 524299, 4, 1, 524300, 536870916, 0, 524301, 4, 1, 524302, 4, 3, 524305, 6, 0, 524310, 4, 2, 524311, 536870916, 0, 524312, 536870916, 2, 589831, -1610612730, 0, 589832, -1610612731, 0, 589836, 4, 2, 589837, 4, 1, 589838, 4, 0, 589839, 4, 3, 589841, 6, 0, 589842, -536870907, 2, 655367, -1610612731, 0, 655373, 536870916, 3, 655374, 4, 1, 655375, 536870916, 0, 655377, 6, 0, 720901, -2147483643, 2, 720903, -536870907, 2, 720905, 5, 2, 720906, 5, 0, 720907, 5, 0, 720908, 536870917, 2, 720909, 536870916, 3, 720910, 536870916, 0, 720911, 536870916, 2, 720912, 5, 2, 720913, 6, 0, 720914, 5, 0, 720915, 536870917, 2, 720917, 5, 2, 720918, 5, 0, 720919, 536870917, 2, 786437, -2147483643, 0, 786441, -1073741819, 0, 786455, -1610612731, 0, 851973, -1073741819, 2, 851974, 1610612741, 2, 851977, 1073741829, 2, 851978, 5, 0, 851979, 1610612741, 2, 851982, 4, 1, 851983, 4, 0, 851987, 1073741829, 2, 851988, 5, 0, 851989, 6, 0, 851990, 5, 0, 851991, -536870907, 2, 917517, 536870916, 0, 917518, 4, 1, 917519, 536870916, 2, 917525, 1610612741, 2, 983053, 4, 2, 983054, 4, 0, 983055, 536870916, 2 )
|
||||
|
||||
[node name="GameCamera" parent="Stage" instance=ExtResource( 13 )]
|
||||
[node name="CamBounds" type="Node2D" parent="Stage"]
|
||||
position = Vector2( 90, 76 )
|
||||
script = ExtResource( 4 )
|
||||
bounds = Rect2( 300, 200, 300, 200 )
|
||||
|
||||
[node name="Actors" type="Node2D" parent="Stage"]
|
||||
|
|
@ -1181,5 +1182,3 @@ margin_right = 126.0
|
|||
margin_bottom = 54.0
|
||||
custom_fonts/font = SubResource( 28 )
|
||||
text = "long_name1234567"
|
||||
|
||||
[editable path="Stage/GameCamera"]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
extends Node2D
|
||||
|
||||
onready var cam : Camera2D = $Camera2D
|
||||
onready var cam : Camera2D = Shared.cam
|
||||
onready var cursor_node := $Cursor
|
||||
|
||||
var cursor = 0
|
||||
|
|
@ -110,7 +110,7 @@ func _ready():
|
|||
overlays.resize(screen_pos.size())
|
||||
|
||||
scroll(Shared.map_select)
|
||||
cam.reset_smoothing()
|
||||
cam.set_pos(cam.pos_target)
|
||||
|
||||
screen_list.sort_custom(self, "sort_list")
|
||||
is_screening = true
|
||||
|
|
@ -193,11 +193,11 @@ func _physics_process(delta):
|
|||
var pop = load_list.pop_front()
|
||||
if Shared.scene_dict.has(pop[1]):
|
||||
var inst = Shared.scene_dict[pop[1]].instance()
|
||||
var cam = inst.get_node("CamBounds")
|
||||
var cb = inst.get_node("CamBounds")
|
||||
|
||||
pop[2].add_child(inst)
|
||||
if is_instance_valid(cam):
|
||||
inst.position -= cam.position
|
||||
if is_instance_valid(cb):
|
||||
inst.position -= cb.position
|
||||
|
||||
screen_static[pop[0]].visible = false
|
||||
else:
|
||||
|
|
@ -211,20 +211,20 @@ func make_screen(i := 0):
|
|||
var is_locked = Shared.count_gems < map_lock[map_name]
|
||||
|
||||
new.rect_position = screen_pos[i]
|
||||
new.get_node("Overlay/HBox/Label").text = (str(map_lock[map_name]) + " to unlock") if is_locked else map_name
|
||||
new.get_node("Overlay/HBox/Gem").visible = is_locked
|
||||
new.get_node("Vis/Overlay/HBox/Label").text = (str(map_lock[map_name]) + " to unlock") if is_locked else map_name
|
||||
new.get_node("Vis/Overlay/HBox/Gem").visible = is_locked
|
||||
|
||||
var s = {}
|
||||
if Shared.save_maps.has(map_name):
|
||||
s = Shared.save_maps[map_name]
|
||||
|
||||
var has_note = s.has("note")
|
||||
new.get_node("Overlay/Notes").visible = has_note
|
||||
var note_label = new.get_node("Overlay/Notes/Label")
|
||||
new.get_node("Vis/Overlay/Notes").visible = has_note
|
||||
var note_label = new.get_node("Vis/Overlay/Notes/Label")
|
||||
if has_note:
|
||||
note_label.text = Shared.time_to_string(s["note"])
|
||||
|
||||
var gem = new.get_node("Overlay/Gem")
|
||||
var gem = new.get_node("Vis/Overlay/Gem")
|
||||
gem.visible = !is_locked
|
||||
var has_time = s.has("time")
|
||||
|
||||
|
|
@ -235,9 +235,9 @@ func make_screen(i := 0):
|
|||
gem_label.text = Shared.time_to_string(s["time"])
|
||||
|
||||
var has_die = s.has("die")
|
||||
new.get_node("Overlay/Death").visible = has_die
|
||||
new.get_node("Vis/Overlay/Death").visible = has_die
|
||||
if has_die:
|
||||
new.get_node("Overlay/Death/Label").text = str(s["die"])
|
||||
new.get_node("Vis/Overlay/Death/Label").text = str(s["die"])
|
||||
|
||||
if is_faster and i == Shared.map_select:
|
||||
blink_label = note_label if is_faster_note else gem_label
|
||||
|
|
@ -245,7 +245,7 @@ func make_screen(i := 0):
|
|||
Audio.play("menu_bell", 0.5, 1.0)
|
||||
|
||||
screens_node.add_child(new)
|
||||
overlays[i] = new.get_node("Overlay")
|
||||
overlays[i] = new.get_node("Vis/Overlay")
|
||||
screen_static.append(new.get_node("Vis/Static"))
|
||||
view_scene(new.get_node("Vis/Node2D"), Shared.map_dir + map_list[i] + ".tscn", i)
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ func scroll(arg := cursor):
|
|||
var sp = screen_pos[cursor]
|
||||
cursor_node.rect_position = sp
|
||||
score_node.rect_position = sp + Vector2(1, 1)
|
||||
cam.position = sp + (screen_size * 0.5)
|
||||
cam.pos_target = sp + (screen_size * 0.5)
|
||||
refresh_score()
|
||||
|
||||
func show_scoreboard(arg := show_score):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=21 format=2]
|
||||
[gd_scene load_steps=22 format=2]
|
||||
|
||||
[ext_resource path="res://media/image/corner.png" type="Texture" id=1]
|
||||
[ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=2]
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
[ext_resource path="res://media/image/diamond12.png" type="Texture" id=9]
|
||||
[ext_resource path="res://media/image/menu.png" type="Texture" id=10]
|
||||
[ext_resource path="res://media/image/skull.png" type="Texture" id=11]
|
||||
[ext_resource path="res://src/stage/CamBounds.gd" type="Script" id=12]
|
||||
[ext_resource path="res://src/menu/cursor_anim.gd" type="Script" id=13]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=8]
|
||||
|
|
@ -70,6 +71,11 @@ __meta__ = {
|
|||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="CamBounds" type="Node2D" parent="."]
|
||||
position = Vector2( 178, 88 )
|
||||
script = ExtResource( 12 )
|
||||
bounds = Rect2( 9000, 9000, 9000, 9000 )
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
margin_right = 320.0
|
||||
margin_bottom = 180.0
|
||||
|
|
@ -89,19 +95,19 @@ margin_bottom = 136.0
|
|||
rect_min_size = Vector2( 136, 96 )
|
||||
rect_clip_content = true
|
||||
|
||||
[node name="BG" type="Node2D" parent="Control/Screen"]
|
||||
[node name="Vis" type="VisibilityNotifier2D" parent="Control/Screen"]
|
||||
rect = Rect2( 0, 0, 136, 96 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="BG" type="Node2D" parent="Control/Screen/Vis"]
|
||||
z_index = -500
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Control/Screen/BG"]
|
||||
[node name="ColorRect" type="ColorRect" parent="Control/Screen/Vis/BG"]
|
||||
margin_right = 136.0
|
||||
margin_bottom = 96.0
|
||||
rect_min_size = Vector2( 136, 96 )
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Vis" type="VisibilityNotifier2D" parent="Control/Screen"]
|
||||
rect = Rect2( 0, 0, 136, 96 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="Control/Screen/Vis"]
|
||||
position = Vector2( 68, 48 )
|
||||
z_index = -400
|
||||
|
|
@ -112,16 +118,16 @@ material = SubResource( 8 )
|
|||
margin_right = 136.0
|
||||
margin_bottom = 96.0
|
||||
|
||||
[node name="Overlay" type="Control" parent="Control/Screen"]
|
||||
[node name="Overlay" type="Control" parent="Control/Screen/Vis"]
|
||||
margin_right = 136.0
|
||||
margin_bottom = 104.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="Control/Screen/Overlay"]
|
||||
[node name="HBox" type="HBoxContainer" parent="Control/Screen/Vis/Overlay"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
alignment = 1
|
||||
|
||||
[node name="Gem" type="Control" parent="Control/Screen/Overlay/HBox"]
|
||||
[node name="Gem" type="Control" parent="Control/Screen/Vis/Overlay/HBox"]
|
||||
margin_left = 48.0
|
||||
margin_top = 44.0
|
||||
margin_right = 64.0
|
||||
|
|
@ -129,13 +135,13 @@ margin_bottom = 60.0
|
|||
rect_min_size = Vector2( 16, 16 )
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Overlay/HBox/Gem"]
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Vis/Overlay/HBox/Gem"]
|
||||
modulate = Color( 1, 0.92549, 0.152941, 1 )
|
||||
material = SubResource( 10 )
|
||||
position = Vector2( 8, 8 )
|
||||
texture = ExtResource( 9 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Screen/Overlay/HBox"]
|
||||
[node name="Label" type="Label" parent="Control/Screen/Vis/Overlay/HBox"]
|
||||
margin_left = 68.0
|
||||
margin_top = 49.0
|
||||
margin_right = 88.0
|
||||
|
|
@ -146,17 +152,17 @@ text = "1-1"
|
|||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Death" type="Control" parent="Control/Screen/Overlay"]
|
||||
[node name="Death" type="Control" parent="Control/Screen/Vis/Overlay"]
|
||||
margin_top = 96.0
|
||||
margin_bottom = 96.0
|
||||
|
||||
[node name="Clock" type="Sprite" parent="Control/Screen/Overlay/Death"]
|
||||
[node name="Clock" type="Sprite" parent="Control/Screen/Vis/Overlay/Death"]
|
||||
material = SubResource( 3 )
|
||||
position = Vector2( 8, -7 )
|
||||
texture = ExtResource( 11 )
|
||||
region_rect = Rect2( 15, 7, 10, 10 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Screen/Overlay/Death"]
|
||||
[node name="Label" type="Label" parent="Control/Screen/Vis/Overlay/Death"]
|
||||
margin_left = 15.0
|
||||
margin_top = -9.0
|
||||
margin_right = 83.0
|
||||
|
|
@ -165,14 +171,14 @@ grow_horizontal = 2
|
|||
custom_fonts/font = SubResource( 4 )
|
||||
text = "79"
|
||||
|
||||
[node name="Notes" type="Control" parent="Control/Screen/Overlay"]
|
||||
[node name="Notes" type="Control" parent="Control/Screen/Vis/Overlay"]
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Overlay/Notes"]
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Vis/Overlay/Notes"]
|
||||
material = SubResource( 3 )
|
||||
position = Vector2( 10, 10 )
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Screen/Overlay/Notes"]
|
||||
[node name="Label" type="Label" parent="Control/Screen/Vis/Overlay/Notes"]
|
||||
margin_left = 19.0
|
||||
margin_top = 4.0
|
||||
margin_right = 101.0
|
||||
|
|
@ -181,19 +187,19 @@ grow_horizontal = 2
|
|||
custom_fonts/font = SubResource( 4 )
|
||||
text = "12:34"
|
||||
|
||||
[node name="Gem" type="Control" parent="Control/Screen/Overlay"]
|
||||
[node name="Gem" type="Control" parent="Control/Screen/Vis/Overlay"]
|
||||
margin_left = 136.0
|
||||
margin_top = 96.0
|
||||
margin_right = 136.0
|
||||
margin_bottom = 96.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Overlay/Gem"]
|
||||
[node name="Sprite" type="Sprite" parent="Control/Screen/Vis/Overlay/Gem"]
|
||||
modulate = Color( 0.513726, 0.462745, 0.611765, 1 )
|
||||
material = SubResource( 9 )
|
||||
position = Vector2( -12, -12 )
|
||||
texture = ExtResource( 8 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Screen/Overlay/Gem"]
|
||||
[node name="Label" type="Label" parent="Control/Screen/Vis/Overlay/Gem"]
|
||||
margin_left = -103.0
|
||||
margin_top = -9.0
|
||||
margin_right = -21.0
|
||||
|
|
@ -286,12 +292,6 @@ text = "12:67 long_name1234567
|
|||
9. waahuu
|
||||
10. thats it"
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2( 160, 90 )
|
||||
current = true
|
||||
smoothing_enabled = true
|
||||
editor_draw_screen = false
|
||||
|
||||
[node name="Cursor" type="Control" parent="."]
|
||||
modulate = Color( 1, 0.92549, 0.152941, 1 )
|
||||
margin_left = 110.0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://media/image/title_splash-pixel.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/stage/CamBounds.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/menu/splash.gd" type="Script" id=3]
|
||||
|
||||
[node name="Splash" type="Node2D"]
|
||||
|
|
@ -27,6 +28,6 @@ modulate = Color( 0, 0, 0, 1 )
|
|||
position = Vector2( 114, 64 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="CanvasLayer/Center/Control"]
|
||||
[node name="CamBounds" type="Node2D" parent="CanvasLayer/Center/Control"]
|
||||
position = Vector2( 114, 64 )
|
||||
current = true
|
||||
script = ExtResource( 2 )
|
||||
|
|
|
|||
41
src/stage/Cam.gd
Normal file
41
src/stage/Cam.gd
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
extends Camera2D
|
||||
|
||||
var node_target : Node2D
|
||||
var pos_target := Vector2.ZERO
|
||||
var pos_target_offset := Vector2.ZERO
|
||||
export var lerp_step := 0.1
|
||||
var lerp_pos := Vector2.ZERO
|
||||
|
||||
var bounds_upper := Vector2.ZERO
|
||||
var bounds_lower := Vector2.ZERO
|
||||
|
||||
|
||||
func set_pos(arg : Vector2 = position):
|
||||
position = arg
|
||||
lerp_pos = position
|
||||
pos_target = position
|
||||
|
||||
func _ready():
|
||||
set_pos()
|
||||
|
||||
Wipe.connect("finish", self, "wipe_finish")
|
||||
|
||||
func wipe_finish():
|
||||
node_target = null
|
||||
pos_target_offset = Vector2.ZERO
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_instance_valid(node_target):
|
||||
pos_target = node_target.position + pos_target_offset
|
||||
pos_target.x = clamp(pos_target.x, bounds_upper.x, bounds_lower.x)
|
||||
pos_target.y = clamp(pos_target.y, bounds_upper.y, bounds_lower.y)
|
||||
|
||||
# smoothing
|
||||
lerp_pos = lerp_pos.linear_interpolate(pos_target, clamp(lerp_step, 0, 1))
|
||||
position = lerp_pos.round()
|
||||
|
||||
# super simple screen shake
|
||||
func shake(dist : int):
|
||||
position.x += dist if randf() < 0.5 else -dist
|
||||
position.y += dist if randf() < 0.5 else -dist
|
||||
lerp_pos = position
|
||||
|
|
@ -3,20 +3,22 @@ extends Node2D
|
|||
|
||||
export var bounds := Rect2(0, 0, 0, 0) setget _set_bounds
|
||||
|
||||
var bounds_upper := Vector2.ZERO
|
||||
var bounds_lower := Vector2.ZERO
|
||||
|
||||
var cam
|
||||
var rect : Rect2
|
||||
var screen = Vector2(228, 128)
|
||||
|
||||
func _ready():
|
||||
rect = Rect2(-screen/2, screen)
|
||||
# set limits
|
||||
bounds_upper.x = -bounds.position.x + position.x
|
||||
bounds_upper.y = -bounds.position.y + position.y
|
||||
bounds_lower.x = bounds.size.x + position.x
|
||||
bounds_lower.y = bounds.size.y + position.y
|
||||
print("CamBounds upper: ", bounds_upper, " lower: ", bounds_lower)
|
||||
|
||||
if (!Shared.is_level_select or get_parent().name == "Select") and is_instance_valid(Shared.cam):
|
||||
cam = Shared.cam
|
||||
cam.bounds_upper = position - bounds.position
|
||||
cam.bounds_lower = bounds.size + position
|
||||
|
||||
cam.set_pos(global_position)
|
||||
cam.zoom = scale
|
||||
|
||||
print("CamBounds upper: ", cam.bounds_upper, " lower: ", cam.bounds_lower)
|
||||
|
||||
func _set_bounds(arg):
|
||||
bounds.position.x = abs(arg.position.x)
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
tool
|
||||
extends Camera2D
|
||||
|
||||
export var is_moving := true
|
||||
|
||||
var node_target : Node2D
|
||||
var pos_target := Vector2.ZERO
|
||||
var pos_target_offset := Vector2.ZERO
|
||||
export var lerp_step := 0.1
|
||||
var lerp_pos := Vector2.ZERO
|
||||
|
||||
export var is_focal_point := false
|
||||
# between 0.0 and 1.0, distance of lerp between focal point and target
|
||||
export var target_influence := 0.5
|
||||
|
||||
var node_bounds : ColorRect
|
||||
var bounds_upper := Vector2.ZERO
|
||||
var bounds_lower := Vector2.ZERO
|
||||
|
||||
export var bounds := Rect2(0, 0, 0, 0) setget _set_bounds
|
||||
|
||||
func _ready():
|
||||
if Engine.editor_hint or Shared.is_level_select:
|
||||
set_physics_process(false)
|
||||
return
|
||||
|
||||
Shared.cam = self
|
||||
|
||||
# set limits
|
||||
bounds_upper.x = -bounds.position.x + position.x
|
||||
bounds_upper.y = -bounds.position.y + position.y
|
||||
bounds_lower.x = bounds.size.x + position.x
|
||||
bounds_lower.y = bounds.size.y + position.y
|
||||
print("GameCamera - bounds upper: ", bounds_upper, " lower: ", bounds_lower)
|
||||
|
||||
# set vars
|
||||
lerp_pos = position
|
||||
pos_target = position
|
||||
|
||||
func _physics_process(delta):
|
||||
if !is_moving or Engine.editor_hint:
|
||||
return
|
||||
|
||||
if is_instance_valid(node_target):
|
||||
pos_target = node_target.position + pos_target_offset
|
||||
pos_target.x = clamp(pos_target.x, bounds_upper.x, bounds_lower.x)
|
||||
pos_target.y = clamp(pos_target.y, bounds_upper.y, bounds_lower.y)
|
||||
|
||||
# smoothing
|
||||
lerp_pos = lerp_pos.linear_interpolate(pos_target, lerp_step)
|
||||
position = lerp_pos.round()
|
||||
|
||||
func _set_bounds(arg):
|
||||
bounds.position.x = abs(arg.position.x)
|
||||
bounds.position.y = abs(arg.position.y)
|
||||
bounds.size.x = abs(arg.size.x)
|
||||
bounds.size.y = abs(arg.size.y)
|
||||
update()
|
||||
|
||||
func _draw():
|
||||
if Engine.editor_hint:
|
||||
draw_rect(Rect2(-bounds.position.x - 228/2, -bounds.position.y - 128/2, 228 + bounds.size.x + bounds.position.x, 128 + bounds.size.y + bounds.position.y), Color.red, false)
|
||||
|
||||
# super simple screen shake
|
||||
func shake(dist : int):
|
||||
position.x += dist if randf() < 0.5 else -dist
|
||||
position.y += dist if randf() < 0.5 else -dist
|
||||
lerp_pos = position
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/stage/GameCamera.gd" type="Script" id=1]
|
||||
|
||||
[node name="GameCamera" type="Camera2D" groups=["game_camera"]]
|
||||
current = true
|
||||
script = ExtResource( 1 )
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
extends Resource
|
||||
class_name StagePreview
|
||||
|
||||
export var file_md5 := ""
|
||||
|
||||
export var palette := 0
|
||||
|
||||
export var camera := ""
|
||||
export var player := ""
|
||||
export var exit := ""
|
||||
export var box := ""
|
||||
|
||||
export var spike := ""
|
||||
|
||||
export var solid := {}
|
||||
export var detail := {}
|
||||
export var obscure := {}
|
||||
|
||||
# ID CO-ORDS.x is_transpose + is_x + is_y
|
||||
Loading…
Add table
Add a link
Reference in a new issue