feat: Flying Tutorial Prompts, Tutorial State, Cam fix
A small frog fix, for jump height. Better screen size detection for the camera
This commit is contained in:
parent
495e6ed2ed
commit
93578d4896
45
assets/effects/pixelDissolve.gdshader
Normal file
45
assets/effects/pixelDissolve.gdshader
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform sampler2D noise_tex_normal;
|
||||||
|
uniform sampler2D noise_tex;
|
||||||
|
uniform float progress : hint_range(0.0, 1.0);
|
||||||
|
uniform float scale : hint_range(0.0, 100.0);
|
||||||
|
uniform float strength = 1.0;
|
||||||
|
|
||||||
|
// If your sprite doesn't have enough space and the explosion gets clipped,
|
||||||
|
// you can uncomment this and adjust the scale
|
||||||
|
void vertex() {
|
||||||
|
VERTEX *= scale;
|
||||||
|
|
||||||
|
UV *= scale;
|
||||||
|
UV -= (scale - 1.0) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 direction = texture(noise_tex_normal, UV).xy; // We're using normal map as direction
|
||||||
|
direction -= 0.5; // Since our normal map is a texture, it ranges from 0.0 to 1.0...
|
||||||
|
direction *= 2.0; // ...so we're going to make it range from -1.0 to 1.0.
|
||||||
|
direction = direction * strength * progress;
|
||||||
|
|
||||||
|
// UV for exploded texture
|
||||||
|
vec2 tex_size = 1.0 / TEXTURE_PIXEL_SIZE; // Real texture size in pixels
|
||||||
|
vec2 uv = floor(UV * tex_size) / (tex_size - 1.0); // Pixelate UV to snap pixels
|
||||||
|
uv = uv - direction; // Distort UV
|
||||||
|
|
||||||
|
// Texture with exploded UV
|
||||||
|
vec4 tex = texture(TEXTURE, uv);
|
||||||
|
|
||||||
|
// Dissolve alpha
|
||||||
|
float dissolve = texture(noise_tex, UV).x;
|
||||||
|
dissolve = step(progress, dissolve);
|
||||||
|
tex.a *= dissolve;
|
||||||
|
|
||||||
|
// Border (in case the edge of your sprite stretches, otherwise you can remove this block)
|
||||||
|
vec2 border_uv = uv * 2.0 - 1.0;
|
||||||
|
border_uv = clamp(abs(border_uv), 0.0, 1.0);
|
||||||
|
float border = max(border_uv.x, border_uv.y);
|
||||||
|
border = ceil(1.0 - border);
|
||||||
|
tex.a *= border;
|
||||||
|
|
||||||
|
COLOR = tex;
|
||||||
|
}
|
||||||
13
assets/effects/pixelDissolve.tres
Normal file
13
assets/effects/pixelDissolve.tres
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/effects/pixelDissolve.gdshader" type="Shader" id=1]
|
||||||
|
[ext_resource path="res://assets/effects/noise.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource( 1 )
|
||||||
|
shader_param/progress = 0.0
|
||||||
|
shader_param/scale = 1.0
|
||||||
|
shader_param/strength = 1.0
|
||||||
|
shader_param/noise_tex_normal = ExtResource( 2 )
|
||||||
|
shader_param/noise_tex = ExtResource( 2 )
|
||||||
@ -261,6 +261,7 @@ ui_click={
|
|||||||
2d_physics/layer_7="finnemajig"
|
2d_physics/layer_7="finnemajig"
|
||||||
2d_physics/layer_8="dropThrough"
|
2d_physics/layer_8="dropThrough"
|
||||||
2d_physics/layer_9="food"
|
2d_physics/layer_9="food"
|
||||||
|
2d_physics/layer_10="dynamicUI"
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
@ -275,6 +276,7 @@ quality/intended_usage/framebuffer_allocation=0
|
|||||||
quality/intended_usage/framebuffer_allocation.mobile=0
|
quality/intended_usage/framebuffer_allocation.mobile=0
|
||||||
2d/snapping/use_gpu_pixel_snap=true
|
2d/snapping/use_gpu_pixel_snap=true
|
||||||
threads/thread_model=2
|
threads/thread_model=2
|
||||||
|
quality/depth/hdr=false
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
quality/2d/use_pixel_snap=true
|
quality/2d/use_pixel_snap=true
|
||||||
environment/2d/use_nvidia_rect_flicker_workaround=true
|
environment/2d/use_nvidia_rect_flicker_workaround=true
|
||||||
|
|||||||
@ -3201,6 +3201,7 @@ tracks/10/keys = {
|
|||||||
[sub_resource type="Animation" id=9]
|
[sub_resource type="Animation" id=9]
|
||||||
length = 0.5
|
length = 0.5
|
||||||
loop = true
|
loop = true
|
||||||
|
step = 0.05
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/path = NodePath(".:frame")
|
tracks/0/path = NodePath(".:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
@ -3328,10 +3329,10 @@ tracks/10/loop_wrap = true
|
|||||||
tracks/10/imported = false
|
tracks/10/imported = false
|
||||||
tracks/10/enabled = true
|
tracks/10/enabled = true
|
||||||
tracks/10/keys = {
|
tracks/10/keys = {
|
||||||
"times": PoolRealArray( 0 ),
|
"times": PoolRealArray( 0, 0.25, 0.5 ),
|
||||||
"transitions": PoolRealArray( 1 ),
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [ Vector2( 1, 1 ) ]
|
"values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=99]
|
[sub_resource type="Animation" id=99]
|
||||||
@ -3474,6 +3475,7 @@ tracks/10/keys = {
|
|||||||
[sub_resource type="Animation" id=73]
|
[sub_resource type="Animation" id=73]
|
||||||
length = 0.15
|
length = 0.15
|
||||||
loop = true
|
loop = true
|
||||||
|
step = 0.01
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/path = NodePath(".:frame")
|
tracks/0/path = NodePath(".:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
@ -3601,16 +3603,17 @@ tracks/10/loop_wrap = true
|
|||||||
tracks/10/imported = false
|
tracks/10/imported = false
|
||||||
tracks/10/enabled = true
|
tracks/10/enabled = true
|
||||||
tracks/10/keys = {
|
tracks/10/keys = {
|
||||||
"times": PoolRealArray( 0 ),
|
"times": PoolRealArray( 0, 0.07 ),
|
||||||
"transitions": PoolRealArray( 1 ),
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [ Vector2( 1, 1 ) ]
|
"values": [ Vector2( 1, 1 ), Vector2( 1.3, 1 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=101]
|
[sub_resource type="Animation" id=101]
|
||||||
resource_name = "wallslideToJumpRight"
|
resource_name = "wallslideToJumpRight"
|
||||||
length = 0.15
|
length = 0.15
|
||||||
loop = true
|
loop = true
|
||||||
|
step = 0.01
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/path = NodePath(".:frame")
|
tracks/0/path = NodePath(".:frame")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
@ -3738,10 +3741,10 @@ tracks/10/loop_wrap = true
|
|||||||
tracks/10/imported = false
|
tracks/10/imported = false
|
||||||
tracks/10/enabled = true
|
tracks/10/enabled = true
|
||||||
tracks/10/keys = {
|
tracks/10/keys = {
|
||||||
"times": PoolRealArray( 0 ),
|
"times": PoolRealArray( 0, 0.08 ),
|
||||||
"transitions": PoolRealArray( 1 ),
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [ Vector2( -1, 1 ) ]
|
"values": [ Vector2( -1, 1 ), Vector2( -1.3, 1 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=74]
|
[sub_resource type="Animation" id=74]
|
||||||
|
|||||||
@ -17,7 +17,7 @@ var target_offset: Vector2 = Vector2(0,0)
|
|||||||
export var camera_horizontal_shift = 60
|
export var camera_horizontal_shift = 60
|
||||||
export var offset_reset_seconds := 1
|
export var offset_reset_seconds := 1
|
||||||
export var offset_adapt_seconds := 1
|
export var offset_adapt_seconds := 1
|
||||||
export var offset_input_seconds := 0.618
|
export var offset_input_seconds := 0.618 * 2
|
||||||
|
|
||||||
onready var levelState := $"%LevelState"
|
onready var levelState := $"%LevelState"
|
||||||
onready var signalManager := $"%SignalManager"
|
onready var signalManager := $"%SignalManager"
|
||||||
@ -35,7 +35,8 @@ var texture = ImageTexture.new()
|
|||||||
var prev_pos: Vector2
|
var prev_pos: Vector2
|
||||||
var camera_state := "centered"
|
var camera_state := "centered"
|
||||||
|
|
||||||
var screen_rect = Vector2(ProjectSettings.get_setting("display/window/size/width") * zoom.x, ProjectSettings.get_setting("display/window/size/height") * zoom.y )
|
var screen_rect = Vector2()
|
||||||
|
var old_screen_rect = Vector2(ProjectSettings.get_setting("display/window/size/width") * zoom.x, ProjectSettings.get_setting("display/window/size/height") * zoom.y )
|
||||||
var screen_center = Vector2()
|
var screen_center = Vector2()
|
||||||
var screen_bottom = Vector2()
|
var screen_bottom = Vector2()
|
||||||
var screen_top = Vector2()
|
var screen_top = Vector2()
|
||||||
@ -46,6 +47,7 @@ var screen_right = Vector2()
|
|||||||
# Requires "TileMap" to be a sibling of blobby
|
# Requires "TileMap" to be a sibling of blobby
|
||||||
func _ready():
|
func _ready():
|
||||||
_set_boundaries()
|
_set_boundaries()
|
||||||
|
get_tree().get_root().connect("size_changed", self, "_set_boundaries")
|
||||||
self.position = blobby.global_position
|
self.position = blobby.global_position
|
||||||
image.create(128, 2, false, Image.FORMAT_RGBAH)
|
image.create(128, 2, false, Image.FORMAT_RGBAH)
|
||||||
# TODO Test Performance
|
# TODO Test Performance
|
||||||
@ -60,7 +62,7 @@ func _on_SignalManager_terminal_activated(animation_number: int = 0):
|
|||||||
#func _draw():
|
#func _draw():
|
||||||
# draw_line(Vector2((limit_left - position.x), screen_center.y), screen_left, Color(255, 0, 0), 1)
|
# draw_line(Vector2((limit_left - position.x), screen_center.y), screen_left, Color(255, 0, 0), 1)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# update()
|
# update()
|
||||||
screen_center = (get_camera_screen_center() - position)
|
screen_center = (get_camera_screen_center() - position)
|
||||||
screen_bottom = screen_center + Vector2(0, screen_rect.y/2)
|
screen_bottom = screen_center + Vector2(0, screen_rect.y/2)
|
||||||
@ -101,7 +103,14 @@ func _process(delta: float) -> void:
|
|||||||
prev_pos = position
|
prev_pos = position
|
||||||
_update_lighting_shader()
|
_update_lighting_shader()
|
||||||
|
|
||||||
|
# TODO This has to be redone when the screen is resized in any way
|
||||||
|
# Otherwise the boundaries will not be correct anymore
|
||||||
func _set_boundaries():
|
func _set_boundaries():
|
||||||
|
screen_rect = get_viewport_rect().size
|
||||||
|
screen_rect.x *= zoom.x
|
||||||
|
screen_rect.y *= zoom.y
|
||||||
|
original_x_zoom = zoom.x
|
||||||
|
original_y_zoom = zoom.y
|
||||||
# This is ok, because it only happens on initialization
|
# This is ok, because it only happens on initialization
|
||||||
# But it is also quite fickle
|
# But it is also quite fickle
|
||||||
var tilemap = get_node("./%TileMap")
|
var tilemap = get_node("./%TileMap")
|
||||||
@ -109,11 +118,11 @@ func _set_boundaries():
|
|||||||
# New pngs -> completely new tiles and rebuild map
|
# New pngs -> completely new tiles and rebuild map
|
||||||
var rect = tilemap.get_used_rect()
|
var rect = tilemap.get_used_rect()
|
||||||
var cell_size = tilemap.cell_size
|
var cell_size = tilemap.cell_size
|
||||||
# TODO +2 is fixed for camera issue in adjust horizontal
|
# TODO is fixed for camera issue in adjust horizontal
|
||||||
limit_right = rect.end.x * cell_size.x - 8
|
limit_right = rect.end.x * cell_size.x - 6
|
||||||
limit_left = rect.position.x * cell_size.x + 8
|
limit_left = rect.position.x * cell_size.x + 6
|
||||||
limit_top = rect.position.y * cell_size.y + 8
|
limit_top = rect.position.y * cell_size.y + 6
|
||||||
limit_bottom = rect.end.y * cell_size.y - 8
|
limit_bottom = rect.end.y * cell_size.y - 6
|
||||||
original_limit_left = limit_left
|
original_limit_left = limit_left
|
||||||
original_limit_right = limit_right
|
original_limit_right = limit_right
|
||||||
original_limit_top = limit_top
|
original_limit_top = limit_top
|
||||||
@ -180,10 +189,10 @@ func _adapt_to_input(velocity: Vector2, delta: float) -> void:
|
|||||||
return
|
return
|
||||||
if Input.is_action_pressed("duck"):
|
if Input.is_action_pressed("duck"):
|
||||||
if(original_limit_bottom - position.y - 2 > screen_bottom.y && offset.y < 48):
|
if(original_limit_bottom - position.y - 2 > screen_bottom.y && offset.y < 48):
|
||||||
offset.y += 1
|
offset.y += 0.5
|
||||||
elif Input.is_action_pressed("up"):
|
elif Input.is_action_pressed("up"):
|
||||||
if(original_limit_top - position.y + 2 < screen_top.y && offset.y > -48):
|
if(original_limit_top - position.y + 2 < screen_top.y && offset.y > -48):
|
||||||
offset.y -= 1
|
offset.y -= 0.5
|
||||||
|
|
||||||
# TODO This is a regulatory problem, it doesn't adapt fast enough
|
# TODO This is a regulatory problem, it doesn't adapt fast enough
|
||||||
# TODO Maybe just make background black and dont bother
|
# TODO Maybe just make background black and dont bother
|
||||||
@ -192,16 +201,17 @@ func _adjust_offset(delta: float) -> bool:
|
|||||||
if (limit_left - position.x - screen_left.x > 0.1):
|
if (limit_left - position.x - screen_left.x > 0.1):
|
||||||
if (anim_player.is_playing()):
|
if (anim_player.is_playing()):
|
||||||
anim_player.stop(true)
|
anim_player.stop(true)
|
||||||
new_offset.x += (limit_left - position.x - screen_left.x)/2
|
new_offset.x += (limit_left - position.x - screen_left.x)/1.5
|
||||||
if (limit_right - position.x - screen_right.x < 0.1):
|
if (limit_right - position.x - screen_right.x < 0.1):
|
||||||
if (anim_player.is_playing()):
|
if (anim_player.is_playing()):
|
||||||
anim_player.stop(true)
|
anim_player.stop(true)
|
||||||
new_offset.x += (limit_right - position.x - screen_right.x)/2
|
new_offset.x += (limit_right - position.x - screen_right.x)/1.5
|
||||||
if (limit_top - position.y - screen_top.y > 0.001):
|
if (limit_top - position.y - screen_top.y > 0.001):
|
||||||
new_offset.y += (limit_top - position.y - screen_top.y)/2
|
new_offset.y += (limit_top - position.y - screen_top.y)/1.5
|
||||||
if (limit_bottom - position.y - screen_bottom.y < 0.001):
|
if (limit_bottom - position.y - screen_bottom.y < 0.001):
|
||||||
new_offset.y += (limit_bottom - position.y - screen_bottom.y)/2
|
new_offset.y += (limit_bottom - position.y - screen_bottom.y)/1.5
|
||||||
if(abs(offset.x) >= abs(new_offset.x) + 1):
|
#print(abs(offset.x) - abs(new_offset.x))
|
||||||
|
if(abs(offset.x) > abs(new_offset.x) || abs(offset.y) > abs(new_offset.y)):
|
||||||
offset = new_offset
|
offset = new_offset
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -868,6 +868,7 @@ z_index = 3
|
|||||||
rotating = true
|
rotating = true
|
||||||
current = true
|
current = true
|
||||||
zoom = Vector2( 0.75, 0.75 )
|
zoom = Vector2( 0.75, 0.75 )
|
||||||
|
process_mode = 0
|
||||||
drag_margin_h_enabled = true
|
drag_margin_h_enabled = true
|
||||||
drag_margin_v_enabled = true
|
drag_margin_v_enabled = true
|
||||||
drag_margin_left = 0.08
|
drag_margin_left = 0.08
|
||||||
@ -971,10 +972,10 @@ texture = ExtResource( 8 )
|
|||||||
|
|
||||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||||
frames = SubResource( 7 )
|
frames = SubResource( 7 )
|
||||||
frame = 3
|
frame = 4
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||||
frames = SubResource( 8 )
|
frames = SubResource( 8 )
|
||||||
frame = 8
|
frame = 9
|
||||||
playing = true
|
playing = true
|
||||||
|
|||||||
@ -322,7 +322,7 @@ func consider_jump_headspace(v: Vector2) -> Vector2:
|
|||||||
var target_height = collision_point.y - (feeler_raycast.global_position.y - 23)
|
var target_height = collision_point.y - (feeler_raycast.global_position.y - 23)
|
||||||
# print(feeler_raycast.global_position)
|
# print(feeler_raycast.global_position)
|
||||||
var new_angle = angle * (0.75 if target_height > -26 else 0.95)
|
var new_angle = angle * (0.75 if target_height > -26 else 0.95)
|
||||||
var new_distance = default_jump_distance * (0.66 if target_height > -26 else 0.75)
|
var new_distance = default_jump_distance * (0.66 if target_height < -26 else 0.75)
|
||||||
v = velocity_for_jump_distance(new_distance, abs(new_angle))
|
v = velocity_for_jump_distance(new_distance, abs(new_angle))
|
||||||
v = correct_jump_direction(v)
|
v = correct_jump_direction(v)
|
||||||
height = calculate_jump_height(v) * -1
|
height = calculate_jump_height(v) * -1
|
||||||
|
|||||||
@ -13,6 +13,9 @@ func set_progress(value) -> void:
|
|||||||
func get_progress() -> Dictionary:
|
func get_progress() -> Dictionary:
|
||||||
return gsr.progress_dict
|
return gsr.progress_dict
|
||||||
|
|
||||||
|
func save() -> void:
|
||||||
|
SaveManager.save_default()
|
||||||
|
|
||||||
func set_savepoint(levelName: String, position: Vector2) -> void:
|
func set_savepoint(levelName: String, position: Vector2) -> void:
|
||||||
if(!gsr.progress_dict.has(levelName)):
|
if(!gsr.progress_dict.has(levelName)):
|
||||||
gsr.progress_dict[levelName] = {}
|
gsr.progress_dict[levelName] = {}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=17 format=2]
|
[gd_scene load_steps=15 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/Utilities/LevelState.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/Utilities/LevelState.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/UserInterface/UserInterface.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/UserInterface/UserInterface.tscn" type="PackedScene" id=2]
|
||||||
@ -10,10 +10,8 @@
|
|||||||
[ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=8]
|
||||||
[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=9]
|
||||||
[ext_resource path="res://src/Levels/Level 1.gd" type="Script" id=10]
|
[ext_resource path="res://src/Levels/Level 1.gd" type="Script" id=10]
|
||||||
[ext_resource path="res://addons/controller_icons/objects/Button.gd" type="Script" id=11]
|
|
||||||
[ext_resource path="res://src/Levels/TutorialThingy.gd" type="Script" id=12]
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachinePlayback" id=4]
|
[sub_resource type="AnimationNodeStateMachinePlayback" id=14]
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=12]
|
[sub_resource type="ConvexPolygonShape2D" id=12]
|
||||||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
|
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
|
||||||
@ -101,18 +99,6 @@ unique_name_in_owner = true
|
|||||||
[node name="Timer" parent="UserInterface/HUD/HUDOverlay/GetBackTimer" index="0"]
|
[node name="Timer" parent="UserInterface/HUD/HUDOverlay/GetBackTimer" index="0"]
|
||||||
wait_time = 20.0
|
wait_time = 20.0
|
||||||
|
|
||||||
[node name="TutorialThingy" type="Sprite" parent="."]
|
|
||||||
z_index = 3
|
|
||||||
script = ExtResource( 12 )
|
|
||||||
|
|
||||||
[node name="ControllerButton" type="Button" parent="TutorialThingy"]
|
|
||||||
visible = false
|
|
||||||
margin_left = -10.0
|
|
||||||
margin_top = -10.0
|
|
||||||
margin_right = 10.0
|
|
||||||
margin_bottom = 10.0
|
|
||||||
script = ExtResource( 11 )
|
|
||||||
|
|
||||||
[node name="BlobbyCam" parent="." instance=ExtResource( 3 )]
|
[node name="BlobbyCam" parent="." instance=ExtResource( 3 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
@ -121,16 +107,16 @@ drag_margin_bottom = 0.3
|
|||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 11
|
frame = 3
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 4
|
frame = 6
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="AnimationTree" parent="Blobby/BlobbySprite" index="0"]
|
[node name="AnimationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||||
parameters/playback = SubResource( 4 )
|
parameters/playback = SubResource( 14 )
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -44,10 +44,10 @@ unique_name_in_owner = true
|
|||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 7
|
frame = 5
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 12
|
frame = 10
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -228,19 +228,19 @@ position = Vector2( 756, -15 )
|
|||||||
z_index = -1
|
z_index = -1
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="Coin" index="2"]
|
[node name="AnimatedSprite" parent="Coin" index="2"]
|
||||||
frame = 301
|
frame = 5
|
||||||
|
|
||||||
[node name="Coin2" parent="." instance=ExtResource( 11 )]
|
[node name="Coin2" parent="." instance=ExtResource( 11 )]
|
||||||
position = Vector2( 744, -120 )
|
position = Vector2( 744, -120 )
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="Coin2" index="2"]
|
[node name="AnimatedSprite" parent="Coin2" index="2"]
|
||||||
frame = 232
|
frame = 250
|
||||||
|
|
||||||
[node name="Coin3" parent="." instance=ExtResource( 11 )]
|
[node name="Coin3" parent="." instance=ExtResource( 11 )]
|
||||||
position = Vector2( 1320, -282 )
|
position = Vector2( 1320, -282 )
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="Coin3" index="2"]
|
[node name="AnimatedSprite" parent="Coin3" index="2"]
|
||||||
frame = 232
|
frame = 250
|
||||||
|
|
||||||
[node name="Coin4" parent="." instance=ExtResource( 11 )]
|
[node name="Coin4" parent="." instance=ExtResource( 11 )]
|
||||||
position = Vector2( 2340, -156 )
|
position = Vector2( 2340, -156 )
|
||||||
|
|||||||
@ -47,10 +47,10 @@ unique_name_in_owner = true
|
|||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 4
|
frame = 5
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 3
|
frame = 7
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 5 )]
|
[node name="Blobby" parent="." instance=ExtResource( 5 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -67,6 +67,9 @@ position = Vector2( 264, -36 )
|
|||||||
position = Vector2( 837, 72 )
|
position = Vector2( 837, 72 )
|
||||||
aggressive = false
|
aggressive = false
|
||||||
|
|
||||||
|
[node name="FlyerSprite" parent="Flyer" index="2"]
|
||||||
|
frame = 0
|
||||||
|
|
||||||
[node name="AnimationTree" parent="Flyer/FlyerSprite" index="1"]
|
[node name="AnimationTree" parent="Flyer/FlyerSprite" index="1"]
|
||||||
parameters/playback = SubResource( 5 )
|
parameters/playback = SubResource( 5 )
|
||||||
|
|
||||||
|
|||||||
@ -1 +1,34 @@
|
|||||||
extends LevelTemplate
|
extends LevelTemplate
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var t = Timer.new()
|
||||||
|
t.set_wait_time(3)
|
||||||
|
t.set_one_shot(true)
|
||||||
|
self.add_child(t)
|
||||||
|
t.start()
|
||||||
|
yield(t, "timeout")
|
||||||
|
levelState.register_tutorial("move_right")
|
||||||
|
spawn_tutorial_thingy("move_right")
|
||||||
|
t.start()
|
||||||
|
yield(t, "timeout")
|
||||||
|
levelState.register_tutorial("move_left")
|
||||||
|
spawn_tutorial_thingy("move_left")
|
||||||
|
t.start()
|
||||||
|
yield(t, "timeout")
|
||||||
|
levelState.register_tutorial("jump")
|
||||||
|
spawn_tutorial_thingy("jump")
|
||||||
|
t.queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func spawn_tutorial_thingy(action: String) -> void:
|
||||||
|
var show_prompt: bool = GlobalState.gsr["tutorial_prompts"][action]
|
||||||
|
var thingy = ResourceLoader.load("res://src/UserInterface/TutorialThingy.tscn")
|
||||||
|
var instance = thingy.instance()
|
||||||
|
instance.action = action
|
||||||
|
var center = get_tree().root.get_child(3).get_node("%BlobbyCam").get_camera_screen_center()
|
||||||
|
var viewport = get_viewport_rect().size - Vector2(40,40)
|
||||||
|
instance.position = Vector2(rand_range(center.x - viewport.x/2, center.x + viewport.x/2), rand_range(center.y - viewport.y/2, center.y + viewport.y/2))
|
||||||
|
instance.velocity *= Vector2(sign(rand_range(-1,1)),sign(rand_range(-1,1)))
|
||||||
|
add_child(instance)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,6 @@ wait_time = 20.0
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
|
||||||
frame = 4
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 3
|
frame = 3
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ onready var signalManager := $"%SignalManager"
|
|||||||
onready var levelState := $"%LevelState"
|
onready var levelState := $"%LevelState"
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
# should spawn the tutorial thingies which are still remembered in the progress dictionary
|
||||||
signalManager.emit_signal("level_loaded")
|
signalManager.emit_signal("level_loaded")
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
extends Sprite
|
|
||||||
var screen_size: Vector2
|
|
||||||
var velocity = Vector2(1,1)
|
|
||||||
onready var blobby = $"%Blobby"
|
|
||||||
onready var cam = $"%BlobbyCam"
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
$ControllerButton.path = "move_right"
|
|
||||||
screen_size = cam.screen_rect
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
# TODO process less in each frame
|
|
||||||
self.texture = $ControllerButton.icon
|
|
||||||
self.scale.x = 0.5
|
|
||||||
self.scale.y = 0.5
|
|
||||||
var tex_size = Vector2(self.texture.get_width(), self.texture.get_height()/4)
|
|
||||||
var up_left_pos = cam.get_global_transform().affine_inverse() * (position - tex_size/2)
|
|
||||||
var down_right_pos = cam.get_global_transform().affine_inverse() * (position + tex_size/2)
|
|
||||||
|
|
||||||
var screen_stretch_factor = get_tree().root.size / screen_size
|
|
||||||
var blobby_screen_pos = (blobby.get_viewport_transform() * (blobby.position))/screen_stretch_factor
|
|
||||||
var corrected_screen = screen_size - blobby_screen_pos
|
|
||||||
print(get_tree().root.get_visible_rect().position)
|
|
||||||
|
|
||||||
if up_left_pos.x + blobby_screen_pos.x <= 0:
|
|
||||||
velocity.x = 1
|
|
||||||
elif down_right_pos.x >= corrected_screen.x:
|
|
||||||
velocity.x = -1
|
|
||||||
|
|
||||||
if up_left_pos.y + blobby_screen_pos.y <= 0:
|
|
||||||
velocity.y = 1
|
|
||||||
elif down_right_pos.y >= corrected_screen.y:
|
|
||||||
velocity.y = -1
|
|
||||||
|
|
||||||
self.position += velocity
|
|
||||||
|
|
||||||
|
|
||||||
@ -183,8 +183,6 @@ follow_focus = true
|
|||||||
|
|
||||||
[node name="ActionKeyList" type="VBoxContainer" parent="KeymapViewer/ScrollContainer"]
|
[node name="ActionKeyList" type="VBoxContainer" parent="KeymapViewer/ScrollContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_right = 552.0
|
|
||||||
margin_bottom = 177.0
|
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
script = ExtResource( 14 )
|
script = ExtResource( 14 )
|
||||||
|
|||||||
63
src/UserInterface/TutorialThingy.gd
Normal file
63
src/UserInterface/TutorialThingy.gd
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
extends Node2D
|
||||||
|
export var action = "move_right"
|
||||||
|
export var velocity = Vector2(0.309,0.309)
|
||||||
|
export var press_limit = 3
|
||||||
|
|
||||||
|
onready var levelState := get_tree().root.get_child(3).get_node("%LevelState")
|
||||||
|
onready var cam = null
|
||||||
|
onready var button = $Button
|
||||||
|
|
||||||
|
var screen_size: Vector2
|
||||||
|
var tex_size: Vector2
|
||||||
|
var screen_stretch_factor: Vector2
|
||||||
|
|
||||||
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
|
if(ControllerIcons.parse_event(event) == button.texture):
|
||||||
|
press_limit -= 1
|
||||||
|
if press_limit < -1:
|
||||||
|
# Should delete itself from the progress dictionary when destroyed
|
||||||
|
$AnimationPlayer.play("cease_4_exist")
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
# Should save itself into the progress dictionary upon creation
|
||||||
|
$Button/ControllerButton.path = action
|
||||||
|
button.texture = $Button/ControllerButton.icon
|
||||||
|
button.scale.x = 0.4
|
||||||
|
button.scale.y = 0.4
|
||||||
|
tex_size = Vector2(button.texture.get_width()/2, button.texture.get_height()/2) * button.scale * 0.75
|
||||||
|
$Area/CollisionShape2D.shape.extents = tex_size
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if(cam == null):
|
||||||
|
cam = get_tree().root.get_child(3).get_node("%BlobbyCam")
|
||||||
|
return
|
||||||
|
button.texture = $Button/ControllerButton.icon
|
||||||
|
# TODO process less in each frame
|
||||||
|
var up_left_pos = cam.get_global_transform().affine_inverse() * (position - tex_size * self.scale)
|
||||||
|
var down_right_pos = cam.get_global_transform().affine_inverse() * (position + tex_size * self.scale)
|
||||||
|
|
||||||
|
if up_left_pos.x <= cam.screen_left.x:
|
||||||
|
velocity.x = abs(velocity.x)
|
||||||
|
elif down_right_pos.x >= cam.screen_right.x:
|
||||||
|
velocity.x = -abs(velocity.x)
|
||||||
|
|
||||||
|
if up_left_pos.y <= cam.screen_top.y:
|
||||||
|
velocity.y = abs(velocity.y)
|
||||||
|
elif down_right_pos.y >= cam.screen_bottom.y:
|
||||||
|
velocity.y = -abs(velocity.y)
|
||||||
|
|
||||||
|
self.position += velocity
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Area_area_entered(area: Area2D) -> void:
|
||||||
|
var d = area.global_position - position
|
||||||
|
print(d)
|
||||||
|
if(abs(d.y) > tex_size.y * 2 - 1):
|
||||||
|
velocity.y *= -1
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
velocity.x *=-1
|
||||||
|
|
||||||
|
func _lesson_learned() -> void:
|
||||||
|
levelState.absolved_tutorial(action)
|
||||||
|
queue_free()
|
||||||
97
src/UserInterface/TutorialThingy.tscn
Normal file
97
src/UserInterface/TutorialThingy.tscn
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/effects/pixelDissolve.tres" type="Material" id=1]
|
||||||
|
[ext_resource path="res://src/UserInterface/TutorialThingy.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://addons/controller_icons/objects/Button.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://assets/environment/decor/screen/Screen3.png" type="Texture" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=4]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Button:material:shader_param/progress")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=5]
|
||||||
|
resource_name = "cease_4_exist"
|
||||||
|
length = 0.618
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Button:material:shader_param/progress")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.3 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ 0.0, 1.0 ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/path = NodePath(".")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0.4 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "_lesson_learned"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TutorialThingy" type="Node2D"]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Button" type="Sprite" parent="."]
|
||||||
|
material = ExtResource( 1 )
|
||||||
|
z_index = 3
|
||||||
|
|
||||||
|
[node name="ControllerButton" type="Button" parent="Button"]
|
||||||
|
visible = false
|
||||||
|
margin_right = 12.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
visible = false
|
||||||
|
margin_left = -34.0
|
||||||
|
margin_top = -49.0
|
||||||
|
margin_right = 99.0
|
||||||
|
margin_bottom = 50.0
|
||||||
|
text = "Move Right:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
uppercase = true
|
||||||
|
|
||||||
|
[node name="Area" type="Area2D" parent="."]
|
||||||
|
collision_layer = 512
|
||||||
|
collision_mask = 512
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area"]
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
anims/RESET = SubResource( 4 )
|
||||||
|
anims/cease_4_exist = SubResource( 5 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
visible = false
|
||||||
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="Area" to="." method="_on_Area_area_entered"]
|
||||||
@ -3,5 +3,5 @@ class_name GlobalStateResource
|
|||||||
|
|
||||||
export(Dictionary) var progress_dict := {}
|
export(Dictionary) var progress_dict := {}
|
||||||
export(int) var wallet := 0
|
export(int) var wallet := 0
|
||||||
|
export(Dictionary) var tutorial_prompts := {}
|
||||||
export(Dictionary) var input_map
|
export(Dictionary) var input_map
|
||||||
export(bool) var show_tutorial
|
|
||||||
|
|||||||
@ -42,6 +42,18 @@ func set_frees(value: int) -> void:
|
|||||||
func set_dead(value: bool) -> void:
|
func set_dead(value: bool) -> void:
|
||||||
is_dead = value
|
is_dead = value
|
||||||
|
|
||||||
|
func register_tutorial(action_path: String) -> void:
|
||||||
|
if(GlobalState.gsr.tutorial_prompts.has(action_path)):
|
||||||
|
return
|
||||||
|
GlobalState.gsr.tutorial_prompts[action_path] = true
|
||||||
|
GlobalState.save()
|
||||||
|
|
||||||
|
func absolved_tutorial(action_path: String) -> void:
|
||||||
|
if(!GlobalState.gsr.tutorial_prompts.has(action_path)):
|
||||||
|
return
|
||||||
|
GlobalState.gsr.tutorial_prompts[action_path] = false
|
||||||
|
GlobalState.save()
|
||||||
|
|
||||||
# Spends the currency when enough is available
|
# Spends the currency when enough is available
|
||||||
# and returns true if so. Else it does not spend and return false.
|
# and returns true if so. Else it does not spend and return false.
|
||||||
func spend_currency(cost: int) -> bool:
|
func spend_currency(cost: int) -> bool:
|
||||||
@ -55,7 +67,6 @@ func spend_currency(cost: int) -> bool:
|
|||||||
GlobalState.set_wallet(GlobalState.gsr.wallet + remainder)
|
GlobalState.set_wallet(GlobalState.gsr.wallet + remainder)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func _on_level_completed():
|
func _on_level_completed():
|
||||||
update_global_state()
|
update_global_state()
|
||||||
reset()
|
reset()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user