Start of level 2
This commit is contained in:
parent
a7be9cd657
commit
855332b44e
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 34 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -212,7 +212,7 @@ const TILE_SET_MAP_ELEMS = {
|
||||||
MapElemType.OOB_LOWER: [23],
|
MapElemType.OOB_LOWER: [23],
|
||||||
},
|
},
|
||||||
"SnowySlopes": {
|
"SnowySlopes": {
|
||||||
MapElemType.SQUARE: [0, 1, 2, 3, 4, 5, 6, 7, 8, 21],
|
MapElemType.SQUARE: [1, 2, 3, 4, 5, 6, 7, 8, 21],
|
||||||
MapElemType.SLOPE_LEFT: [9, 11],
|
MapElemType.SLOPE_LEFT: [9, 11],
|
||||||
MapElemType.SLOPE_RIGHT: [10, 12],
|
MapElemType.SLOPE_RIGHT: [10, 12],
|
||||||
MapElemType.SMALL_SLOPE_LEFT_1: [13, 17],
|
MapElemType.SMALL_SLOPE_LEFT_1: [13, 17],
|
||||||
|
|
|
@ -15,6 +15,7 @@ export var finish_x_pos : int
|
||||||
export var target_time : float
|
export var target_time : float
|
||||||
export var defeat_cutscene : String
|
export var defeat_cutscene : String
|
||||||
export var victory_cutscene : String
|
export var victory_cutscene : String
|
||||||
|
export var level : int
|
||||||
const Constants = preload("res://Scripts/Constants.gd")
|
const Constants = preload("res://Scripts/Constants.gd")
|
||||||
const UNIT_DIRECTORY = {
|
const UNIT_DIRECTORY = {
|
||||||
Constants.UnitType.CIRNO: preload("res://Units/DownhillAutoscrollerNPCCirno.tscn"),
|
Constants.UnitType.CIRNO: preload("res://Units/DownhillAutoscrollerNPCCirno.tscn"),
|
||||||
|
@ -22,7 +23,7 @@ const UNIT_DIRECTORY = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# positions to unit string
|
# positions to unit string
|
||||||
export var spawning : Dictionary
|
var spawning : Dictionary = {}
|
||||||
var spawning_map = {} # keeps track of what's alive
|
var spawning_map = {} # keeps track of what's alive
|
||||||
|
|
||||||
var paused : bool = false
|
var paused : bool = false
|
||||||
|
@ -61,7 +62,10 @@ var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
if level == 1:
|
||||||
MusicController.play_kyouko_snow()
|
MusicController.play_kyouko_snow()
|
||||||
|
else:
|
||||||
|
MusicController.play_letty_snow()
|
||||||
|
|
||||||
units.append($Player)
|
units.append($Player)
|
||||||
player = units[0]
|
player = units[0]
|
||||||
|
@ -189,8 +193,10 @@ func handle_player_input():
|
||||||
if input_table[Constants.PlayerInput.GBA_A][I_T_PRESSED]:
|
if input_table[Constants.PlayerInput.GBA_A][I_T_PRESSED]:
|
||||||
if (player.get_current_action() == Constants.UnitCurrentAction.JUMPING
|
if (player.get_current_action() == Constants.UnitCurrentAction.JUMPING
|
||||||
or (player.get_current_action() == Constants.UnitCurrentAction.IDLE
|
or (player.get_current_action() == Constants.UnitCurrentAction.IDLE
|
||||||
and player.unit_conditions[Constants.UnitCondition.IS_ON_GROUND]
|
|
||||||
and input_table[Constants.PlayerInput.GBA_A][I_T_JUST_PRESSED])):
|
and input_table[Constants.PlayerInput.GBA_A][I_T_JUST_PRESSED])):
|
||||||
|
if player.unit_conditions[Constants.UnitCondition.IS_ON_GROUND] or player.get_current_action() == Constants.UnitCurrentAction.JUMPING:
|
||||||
player.set_action(Constants.ActionType.JUMP)
|
player.set_action(Constants.ActionType.JUMP)
|
||||||
|
else:
|
||||||
|
player.buffer_jump()
|
||||||
|
|
||||||
player.custom_inputs()
|
player.custom_inputs()
|
||||||
|
|
|
@ -50,6 +50,15 @@ func init_stage_grid(tilemap : TileMap):
|
||||||
var stage_y = floor(-1 * tilemap.map_to_world(map_elem).y / Constants.GRID_SIZE) - 1
|
var stage_y = floor(-1 * tilemap.map_to_world(map_elem).y / Constants.GRID_SIZE) - 1
|
||||||
var map_elem_type : int
|
var map_elem_type : int
|
||||||
var cellv = tilemap.get_cellv(map_elem)
|
var cellv = tilemap.get_cellv(map_elem)
|
||||||
|
|
||||||
|
if cellv == 23 or cellv == 24:
|
||||||
|
scene.spawning[Vector2(stage_x, stage_y)] = "CIRNO" if cellv == 23 else "SANAE"
|
||||||
|
tilemap.set_cellv(map_elem, -1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if cellv == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
var found_map_elem_type : bool = false
|
var found_map_elem_type : bool = false
|
||||||
for test_map_elem_type in [
|
for test_map_elem_type in [
|
||||||
Constants.MapElemType.SQUARE,
|
Constants.MapElemType.SQUARE,
|
||||||
|
|
|
@ -37,6 +37,8 @@ var flash_start_timestamp : float
|
||||||
|
|
||||||
var recorder: PlayerRecorder = null
|
var recorder: PlayerRecorder = null
|
||||||
|
|
||||||
|
var jump_buffer: float = 0
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time
|
# Called when the node enters the scene tree for the first time
|
||||||
func _ready():
|
func _ready():
|
||||||
for action_num in Constants.UNIT_TYPE_ACTIONS[unit_type]:
|
for action_num in Constants.UNIT_TYPE_ACTIONS[unit_type]:
|
||||||
|
@ -62,6 +64,9 @@ func _ready():
|
||||||
func init_unit_w_scene(scene):
|
func init_unit_w_scene(scene):
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
|
|
||||||
|
func buffer_jump():
|
||||||
|
jump_buffer = 0.07
|
||||||
|
|
||||||
func set_action(action : int):
|
func set_action(action : int):
|
||||||
assert(action in Constants.UNIT_TYPE_ACTIONS[unit_type])
|
assert(action in Constants.UNIT_TYPE_ACTIONS[unit_type])
|
||||||
actions[action] = true
|
actions[action] = true
|
||||||
|
@ -93,6 +98,13 @@ func reset_actions():
|
||||||
|
|
||||||
func process_unit(delta, time_elapsed : float):
|
func process_unit(delta, time_elapsed : float):
|
||||||
current_action_time_elapsed += delta
|
current_action_time_elapsed += delta
|
||||||
|
|
||||||
|
if jump_buffer > 0:
|
||||||
|
jump_buffer -= delta
|
||||||
|
if unit_conditions[Constants.UnitCondition.IS_ON_GROUND]:
|
||||||
|
set_action(Constants.ActionType.JUMP)
|
||||||
|
jump_buffer = 0
|
||||||
|
|
||||||
execute_actions(delta)
|
execute_actions(delta)
|
||||||
handle_idle()
|
handle_idle()
|
||||||
advance_timers(delta)
|
advance_timers(delta)
|
||||||
|
@ -148,7 +160,10 @@ func jump():
|
||||||
v_speed = max(Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], v_speed)
|
v_speed = max(Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], v_speed)
|
||||||
else:
|
else:
|
||||||
# airborne
|
# airborne
|
||||||
|
print("airjump")
|
||||||
|
print(v_speed)
|
||||||
v_speed = max(Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], move_toward(v_speed, Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], get_process_delta_time() * Constants.GRAVITY))
|
v_speed = max(Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], move_toward(v_speed, Constants.UNIT_TYPE_JUMP_SPEEDS[unit_type], get_process_delta_time() * Constants.GRAVITY))
|
||||||
|
print(v_speed)
|
||||||
set_unit_condition(Constants.UnitCondition.IS_ON_GROUND, false)
|
set_unit_condition(Constants.UnitCondition.IS_ON_GROUND, false)
|
||||||
if get_current_action() == Constants.UnitCurrentAction.JUMPING and v_speed > 0:
|
if get_current_action() == Constants.UnitCurrentAction.JUMPING and v_speed > 0:
|
||||||
set_sprite(Constants.SpriteClass.JUMP, 0)
|
set_sprite(Constants.SpriteClass.JUMP, 0)
|
||||||
|
|
|
@ -101,6 +101,8 @@ func process_unit(delta, time_elapsed : float):
|
||||||
|
|
||||||
# Fine tune the player's speed
|
# Fine tune the player's speed
|
||||||
|
|
||||||
|
print(last_contacted_map_elem_type)
|
||||||
|
|
||||||
if get_current_action() == Constants.UnitCurrentAction.RECOILING:
|
if get_current_action() == Constants.UnitCurrentAction.RECOILING:
|
||||||
target_move_speed = min_speed
|
target_move_speed = min_speed
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -335,3 +335,31 @@ points = PoolVector2Array( 48, 5, 0, 5, 0, 0, 48, 0 )
|
||||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||||
} ]
|
} ]
|
||||||
22/z_index = 0
|
22/z_index = 0
|
||||||
|
23/name = "CIRNO"
|
||||||
|
23/texture = ExtResource( 1 )
|
||||||
|
23/tex_offset = Vector2( 0, 0 )
|
||||||
|
23/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
23/region = Rect2( 192, 96, 24, 24 )
|
||||||
|
23/tile_mode = 0
|
||||||
|
23/occluder_offset = Vector2( 0, 0 )
|
||||||
|
23/navigation_offset = Vector2( 0, 0 )
|
||||||
|
23/shape_offset = Vector2( 0, 0 )
|
||||||
|
23/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||||
|
23/shape_one_way = false
|
||||||
|
23/shape_one_way_margin = 0.0
|
||||||
|
23/shapes = [ ]
|
||||||
|
23/z_index = 0
|
||||||
|
24/name = "SANAE"
|
||||||
|
24/texture = ExtResource( 1 )
|
||||||
|
24/tex_offset = Vector2( 0, 0 )
|
||||||
|
24/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
24/region = Rect2( 216, 96, 24, 24 )
|
||||||
|
24/tile_mode = 0
|
||||||
|
24/occluder_offset = Vector2( 0, 0 )
|
||||||
|
24/navigation_offset = Vector2( 0, 0 )
|
||||||
|
24/shape_offset = Vector2( 0, 0 )
|
||||||
|
24/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||||
|
24/shape_one_way = false
|
||||||
|
24/shape_one_way_margin = 0.0
|
||||||
|
24/shapes = [ ]
|
||||||
|
24/z_index = 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Scripts/Units/NPCUnit.gd" type="Script" id=1]
|
[ext_resource path="res://Scripts/Units/FollowReplay.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Graphics/Units/Letty/Move0.png" type="Texture" id=2]
|
[ext_resource path="res://Graphics/Units/Letty/Move0.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://Graphics/Units/Letty/Move+2.png" type="Texture" id=3]
|
[ext_resource path="res://Graphics/Units/Letty/Move+2.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://Graphics/Units/Letty/Move-2.png" type="Texture" id=4]
|
[ext_resource path="res://Graphics/Units/Letty/Move-2.png" type="Texture" id=4]
|
||||||
|
@ -15,7 +15,6 @@ extents = Vector2( 9, 34 )
|
||||||
z_index = 1
|
z_index = 1
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
unit_type = 1
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2( 0, -36 )
|
position = Vector2( 0, -36 )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Scripts/Units/NPCUnit.gd" type="Script" id=1]
|
[ext_resource path="res://Scripts/Units/FollowReplay.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Graphics/Units/Mystia/Move-1.png" type="Texture" id=3]
|
[ext_resource path="res://Graphics/Units/Mystia/Move-1.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://Graphics/Units/Mystia/Move+2.png" type="Texture" id=4]
|
[ext_resource path="res://Graphics/Units/Mystia/Move+2.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://Graphics/Units/Mystia/Move+1.png" type="Texture" id=5]
|
[ext_resource path="res://Graphics/Units/Mystia/Move+1.png" type="Texture" id=5]
|
||||||
|
@ -14,7 +14,6 @@ extents = Vector2( 9, 34 )
|
||||||
z_index = 1
|
z_index = 1
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
unit_type = 1
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2( 0, -36 )
|
position = Vector2( 0, -36 )
|
||||||
|
|
|
@ -63,7 +63,7 @@ _global_script_class_icons={
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Moriya's Wanton Winter Wager"
|
config/name="Moriya's Wanton Winter Wager"
|
||||||
run/main_scene="res://Scenes/TitleScreen.tscn"
|
run/main_scene="res://Scenes/DownhillAutoscroller2.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
Loading…
Reference in New Issue