diff --git a/Scenes/Level.tscn b/Scenes/Level.tscn index 306ee86..0947b3d 100644 --- a/Scenes/Level.tscn +++ b/Scenes/Level.tscn @@ -331,7 +331,7 @@ shape = SubResource( 1 ) [node name="TileMap" type="TileMap" parent="."] tile_set = SubResource( 29 ) format = 1 -tile_data = PoolIntArray( -196608, 0, 2, -196586, 0, 1, -196584, 0, 2, -196582, 0, 2, -196580, 0, 2, -196578, 0, 3, -196562, 0, 1, -196560, 0, 2, -196558, 0, 3, 196664, 0, 1, 196666, 0, 2, 196668, 0, 3, 589858, 0, 65537, 589860, 0, 2, 589862, 0, 2, 589864, 0, 3, 589870, 0, 1, 589872, 0, 2, 589874, 0, 3, 720928, 0, 65537, 720930, 0, 131073, 720932, 0, 0, 720934, 0, 0, 720936, 0, 0, 917502, 0, 2, 851998, 0, 65537, 852000, 0, 131073, 852002, 0, 0, 852004, 0, 0, 852006, 0, 0, 852008, 0, 0, 1048574, 0, 65536, 983040, 0, 2, 983042, 0, 2, 983044, 0, 2, 983046, 0, 2, 983048, 0, 2, 983050, 0, 2, 983052, 0, 2, 983054, 0, 2, 983056, 0, 2, 983058, 0, 2, 983060, 0, 2, 983062, 0, 2, 983064, 0, 2, 983066, 0, 2, 983068, 0, 2, 983070, 0, 131073, 983072, 0, 0, 983074, 0, 0, 983076, 0, 0, 983078, 0, 0, 983080, 0, 0 ) +tile_data = PoolIntArray( -196608, 0, 2, -196586, 0, 1, -196584, 0, 2, -196582, 0, 2, -196580, 0, 2, -196578, 0, 3, -196562, 0, 1, -196560, 0, 2, -196558, 0, 3, 196664, 0, 1, 196666, 0, 2, 196668, 0, 3, 589858, 0, 65537, 589860, 0, 2, 589862, 0, 2, 589864, 0, 3, 589870, 0, 1, 589872, 0, 2, 589874, 0, 3, 720928, 0, 65537, 720930, 0, 131073, 720932, 0, 0, 720934, 0, 0, 720936, 0, 0, 917502, 0, 0, 851998, 0, 65537, 852000, 0, 131073, 852002, 0, 0, 852004, 0, 0, 852006, 0, 0, 852008, 0, 0, 1048574, 0, 65536, 983040, 0, 2, 983042, 0, 2, 983044, 0, 2, 983046, 0, 2, 983048, 0, 2, 983050, 0, 2, 983052, 0, 2, 983054, 0, 2, 983056, 0, 2, 983058, 0, 2, 983060, 0, 2, 983062, 0, 2, 983064, 0, 2, 983066, 0, 2, 983068, 0, 2, 983070, 0, 131073, 983072, 0, 0, 983074, 0, 0, 983076, 0, 0, 983078, 0, 0, 983080, 0, 0 ) __meta__ = { "_edit_group_": true } diff --git a/Scripts/FadeBlack.gd b/Scripts/FadeBlack.gd index 5a0ce6f..1c21492 100644 --- a/Scripts/FadeBlack.gd +++ b/Scripts/FadeBlack.gd @@ -34,7 +34,7 @@ func _process(delta): get_parent().get_parent().kill() modulate = Color(0,0,0,0) - if velocity == Vector2.ZERO: + if velocity == Vector2.ZERO || $"../../".is_hit_stun: _tween_modulate(Color(0,0,0,1), 3, 2) else: _tween_modulate(Color(0,0,0,0), .1, 0) diff --git a/Scripts/MainMenu.gd b/Scripts/MainMenu.gd index 813dc67..8ab093c 100644 --- a/Scripts/MainMenu.gd +++ b/Scripts/MainMenu.gd @@ -25,12 +25,14 @@ func _on_Otto_pressed(): get_tree().paused = false $"../../Player".fly_force = 2000 $"../../Player".stun_velocity = 20 + #$"../../Player".stun_velocity.y = 18 self.visible = false func _on_Ludwig_pressed(): get_tree().paused = false $"../../Player".fly_force = 4500 $"../../Player".stun_velocity = 150 + #$"../../Player".stun_velocity.y = 120 self.visible = false func return_to_menu(): diff --git a/Scripts/Player.gd b/Scripts/Player.gd index 58df1b0..75e9e27 100644 --- a/Scripts/Player.gd +++ b/Scripts/Player.gd @@ -7,12 +7,15 @@ var max_vertical = 3500 var run_accel = 4000 # how fast you accelerate left and right var gravity = 5000 # overall gravity modifier (both jump and fall) var max_fall = 6000 # fall speed -var jumps = 3 +var jumps = 5 # set current jumps var can_fly = true var starting_position = Vector2(1224, 886) var stun_velocity = 0 var flaps = 0 var fly_force = 0 +var direction_x +var direction_y +var is_hit_stun = false func _ready(): position = starting_position @@ -24,11 +27,11 @@ func _physics_process(delta): # grabs mouse position var mouse_position = get_global_mouse_position() var mouse_angle = get_angle_to(mouse_position) - var direction_x = sign(mouse_position.x - global_position.x) - var direction_y = sign(mouse_position.y - global_position.y) + direction_x = sign(mouse_position.x - global_position.x) + direction_y = sign(mouse_position.y - global_position.y) if is_on_floor(): - jumps = 3 + jumps = 5 gravity = 5000 $"../GUI/HUD".update_jumps(jumps) animated_sprite.play("idle") @@ -37,6 +40,10 @@ func _physics_process(delta): elif velocity.y < 0: gravity = 5000 + if !is_on_floor(): + # hitstuns the player for moving to fast into an object + hit_stun(delta) + # flying feels like giga shit lmao if flying && jumps != 0 && can_fly: flaps += 1 @@ -48,16 +55,13 @@ func _physics_process(delta): velocity.y = direction_y * min(abs(velocity.y), max_vertical) if velocity.y > -1500 && direction_y == -1: velocity.y = sin(mouse_angle) * fly_force - - can_fly = false - create_fly_timer(delta, .2) + #create_fly_timer(.2) animated_sprite.play("flight") if is_on_wall(): for i in get_slide_count(): var collision = get_slide_collision(i) velocity.x += collision.remainder.x * 50 - print(velocity.x) # update velocity velocity.x = move_toward(velocity.x, 0, run_accel * delta) @@ -65,15 +69,6 @@ func _physics_process(delta): velocity = move_and_slide(velocity, Vector2.UP, false, 2) - # kills the player for moving to fast into an object - for i in get_slide_count(): - var collision = get_slide_collision(i) - if ((collision.remainder.x > stun_velocity || - collision.remainder.y < -stun_velocity || - collision.remainder.x < -stun_velocity) && !is_on_floor()): - can_fly = false - create_fly_timer(delta, 1.5) - # TODO: add player animation $Arrow.rotation = mouse_angle + PI/2 if direction_x < 0: @@ -81,13 +76,27 @@ func _physics_process(delta): else: animated_sprite.flip_h = false -func create_fly_timer(delta, delay): +func create_fly_timer(delay): + can_fly = false yield(get_tree().create_timer(delay), "timeout") can_fly = true - + func kill(): velocity = Vector2.ZERO position = starting_position func _on_DeathBarrier_entered(body): kill() + +# TODO: fix hitstun wall climb interaction +func hit_stun(delta): + for i in get_slide_count(): + var collision = get_slide_collision(i) + if (abs(collision.remainder.x) > abs(stun_velocity) || + abs(collision.remainder.y) > abs(stun_velocity) && + !is_on_floor()): + velocity.x = -collision.remainder.x + velocity.y = -collision.remainder.y + is_hit_stun = true + create_fly_timer(1.5) + is_hit_stun = false