feat: new platform&deco tiles, fix bounce super jump, frog anim fix, blobby anim fix

This commit is contained in:
Jakob Feldmann 2023-07-04 12:56:42 +02:00
parent 93578d4896
commit f46808740c
34 changed files with 1526 additions and 1331 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/drop-through-platform.png-43ec027b4021bf7add492948799b7c3c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/contraption/drop-through-platform.png"
dest_files=[ "res://.import/drop-through-platform.png-43ec027b4021bf7add492948799b7c3c.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/BasicTileSet.png-04d4931c2faae497a949588d0e9937bb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/environment/blocks/BasicTileSet.png"
dest_files=[ "res://.import/BasicTileSet.png-04d4931c2faae497a949588d0e9937bb.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/platform-plants.png-96350e262143adfad190cbcaf19c9adf.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/environment/decor/platform-plants.png"
dest_files=[ "res://.import/platform-plants.png-96350e262143adfad190cbcaf19c9adf.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -5,3 +5,4 @@
[resource]
background_mode = 2
background_sky = SubResource( 1 )
tonemap_mode = 2

View File

@ -96,6 +96,10 @@ config/name="Blobby"
run/main_scene="res://src/UserInterface/Screens/MainMenu/MainScreen.tscn"
config/icon="res://icon.png"
[audio]
default_bus_layout="res://src/Sounds/default_bus_layout.tres"
[autoload]
GlobalState="*res://src/Autoload/GlobalState.tscn"

View File

@ -10,33 +10,34 @@ const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
const FLOOR_NORMAL := Vector2.UP
var stomp_feedback := 1400
var reset_stomp_time := 0.108
var stomp_time := 0.108
var stomp_feedback := 1400 * 60
var stomp_time := 0.2
var init_stomp_time := 0.2
var inair_velocity := 21
var wallslide_threshold := 1000
var base_floor_friction := 0.5
var initial_velocity_dependence := 0.7
var floor_friction := base_floor_friction
# TODO Mixing Vectors and ints is questionable
var max_velocity := {
"walk": 120, "run": 160, "jump": Vector2(120, 420), "fall": Vector2(120, 420), "walljump": 200, "idle": 12000, "duck": 160
"walk": 120, "run": 160, "jump": Vector2(120, 420), "fall": Vector2(120, 420), "walljump": 200, "idle": 12000, "duck": 160
}
var velocity_jump_boost_ratio := 10
# This is added to the acceleration force initially
var init_acceleration_force := {
"": 0, "idle_walk": 4181, "idle_run": 5765, "walk_run": 1000
"": 0, "idle_walk": 4181, "idle_run": 5765, "walk_run": 1000
}
# Oriented around deltas of 0.0166666...s
# newtonmeters is the unit
var acceleration_force := {
"walk": Vector2(1800, 1350),
"fall": Vector2(1800, 0),
"jump": Vector2(1800, 0),
"idle": Vector2(1800, 1233),
"duck": Vector2(500, 1300),
"run": Vector2(2500, 1400),
"walljump": Vector2(600, 1050),
"air_strafe": Vector2(333, 2000)
"walk": Vector2(1800, 1350),
"fall": Vector2(1800, 1050),
"jump": Vector2(1800, 0),
"idle": Vector2(1800, 1233),
"duck": Vector2(500, 1300),
"run": Vector2(2500, 1400),
"walljump": Vector2(600, 1050),
"air_strafe": Vector2(333, 2000)
}
# Gravity as m/s^2
var _gravity: float = PhysicsConst.gravity

View File

@ -24,487 +24,493 @@ var snap_possible = true
var shielded = false
func execute_movement() -> void:
if(levelState.is_dead):
return
var snap = Vector2.DOWN * 128
var center_floor_rot = 0
var floor_rot = 0
var onfloor = is_on_floor()
if(levelState.is_dead):
return
var snap = Vector2.DOWN * 128
var center_floor_rot = 0
var floor_rot = 0
var onfloor = is_on_floor()
# get rotation of floor, compare collided floor with floor under center
if onfloor:
# TODO: Problem when correctly rotating?
center_floor_rot = $SlopeRaycast.get_collision_normal().rotated(PI/2).angle()
floor_rot = get_floor_normal().rotated(PI/2).angle()
if(abs(center_floor_rot) > PI/4+0.1):
center_floor_rot = floor_rot
# snap when on slopes
if((abs(floor_rot) > 0.1 || abs(center_floor_rot) > 0.1) && snap_possible):
velocity = move_and_slide_with_snap(velocity.rotated(floor_rot),
snap, FLOOR_NORMAL, true)
# normal slide on flat floor
else:
velocity = move_and_slide(velocity.rotated(floor_rot),FLOOR_NORMAL)
rotation = 0
if($SlopeRaycastLeft.is_colliding() && $SlopeRaycastRight.is_colliding() && $SlopeRaycast.is_colliding()):
rotation = calculate_slope_rotation(onfloor)
# rotate related to floor slope
# Convert velocity back to local space.
# TODO: Downward velocity should be increased by gravity
velocity = velocity.rotated(-floor_rot) if snap_possible else velocity
# get rotation of floor, compare collided floor with floor under center
if onfloor:
# TODO: Problem when correctly rotating?
center_floor_rot = $SlopeRaycast.get_collision_normal().rotated(PI/2).angle()
floor_rot = get_floor_normal().rotated(PI/2).angle()
if(abs(center_floor_rot) > PI/4+0.1):
center_floor_rot = floor_rot
# snap when on slopes
if((abs(floor_rot) > 0.1 || abs(center_floor_rot) > 0.1) && snap_possible):
velocity = move_and_slide_with_snap(velocity.rotated(floor_rot),
snap, FLOOR_NORMAL, true)
# normal slide on flat floor
else:
velocity = move_and_slide(velocity.rotated(floor_rot),FLOOR_NORMAL)
rotation = 0
if($SlopeRaycastLeft.is_colliding() && $SlopeRaycastRight.is_colliding() && $SlopeRaycast.is_colliding()):
rotation = calculate_slope_rotation(onfloor)
# rotate related to floor slope
# Convert velocity back to local space.
# TODO: Downward velocity should be increased by gravity
velocity = velocity.rotated(-floor_rot) if snap_possible else velocity
func calculate_duck_velocity(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
var state = player_state_machine.state
var out_vel := linear_velocity
var velocity_direction = 1.0
if velocity.x < 0:
velocity_direction = -1.0
var state = player_state_machine.state
var out_vel := linear_velocity
var velocity_direction = 1.0
if velocity.x < 0:
velocity_direction = -1.0
# TODO Improve this to separate crawling(slow) and sliding
var deceleration_force = calculate_deceleration_force(_gravity, mass)*0.333
# TODO Improve this to separate crawling(slow) and sliding
var deceleration_force = calculate_deceleration_force(_gravity, mass)*0.333
# Slowing down movement when not controlling direction
if is_equal_approx(direction.x, 0):
# TODO Handle Deadzones
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x, deceleration_force * -1 * velocity_direction, mass, delta
)
if abs(out_vel.x) > abs(velocity.x):
out_vel.x = 0
else:
# Reversing movement
# When turning the opposite direction, friction is added to the opposite acceleration movement
var reverse_move = is_reversing_horizontal_movement(direction)
if reverse_move:
# TODO dont put constants in here
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
deceleration_force * -3.42 * velocity_direction,
mass,
delta
)
# Normal movement
if abs(velocity.x) < max_velocity[state]:
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
(
(
acceleration_force[state].x
)
* direction.x
),
mass,
delta
)
elif !reverse_move:
out_vel.x = max_velocity[state] * direction.x
# TODO is_on_dropThrough does the action, is that ok? yEs, MaAsTeR-ChAn
# TODO Drop Through coyote time?
if (Input.is_action_just_pressed("jump") && is_on_dropThrough()):
return Vector2(out_vel.x, _gravity*delta)
# Jumping when grounded or jump is buffered
if (
Input.is_action_just_pressed("jump")
|| (jump_buffer_filled && is_on_floor())
):
snap_possible = false
return calculate_jump_velocity(velocity, delta, direction)
# Slowing down movement when not controlling direction
if is_equal_approx(direction.x, 0):
# TODO Handle Deadzones
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x, deceleration_force * -1 * velocity_direction, mass, delta
)
if abs(out_vel.x) > abs(velocity.x):
out_vel.x = 0
else:
# Reversing movement
# When turning the opposite direction, friction is added to the opposite acceleration movement
var reverse_move = is_reversing_horizontal_movement(direction)
if reverse_move:
# TODO dont put constants in here
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
deceleration_force * -3.42 * velocity_direction,
mass,
delta
)
# Normal movement
if abs(velocity.x) < max_velocity[state]:
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
(
(
acceleration_force[state].x
)
* direction.x
),
mass,
delta
)
elif !reverse_move:
out_vel.x = max_velocity[state] * direction.x
# TODO is_on_dropThrough does the action, is that ok? yEs, MaAsTeR-ChAn
# TODO Drop Through coyote time?
if (Input.is_action_just_pressed("jump") && is_on_dropThrough()):
return Vector2(out_vel.x, _gravity*delta)
# Jumping when grounded or jump is buffered
if (
Input.is_action_just_pressed("jump")
|| (jump_buffer_filled && is_on_floor())
):
snap_possible = false
return calculate_jump_velocity(velocity, delta, direction)
elif player_state_machine.coyote_hanging:
out_vel.y = 0
elif player_state_machine.coyote_hanging:
out_vel.y = 0
else:
out_vel.y = _gravity * delta
else:
out_vel.y = _gravity * delta
return out_vel
return out_vel
func is_on_dropThrough():
var bodies: Array = $BlobbySkin.get_overlapping_bodies()
for i in range(0, bodies.size()):
if bodies[i].get_collision_mask_bit(7):
set_collision_mask_bit(7, false)
return true
return false
var bodies: Array = $BlobbySkin.get_overlapping_bodies()
for i in range(0, bodies.size()):
if bodies[i].get_collision_mask_bit(7):
set_collision_mask_bit(7, false)
return true
return false
func calculate_grounded_velocity(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
var state = player_state_machine.state
var out_vel := linear_velocity
var velocity_direction = 1.0
if velocity.x < 0:
velocity_direction = -1.0
var state = player_state_machine.state
var out_vel := linear_velocity
var velocity_direction = 1.0
if velocity.x < 0:
velocity_direction = -1.0
var deceleration_force = calculate_deceleration_force(_gravity, mass)
var deceleration_force = calculate_deceleration_force(_gravity, mass)
# Slowing down movement when not controlling direction
if is_equal_approx(direction.x, 0):
# TODO Handle Deadzones
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x, deceleration_force * -1 * velocity_direction, mass, delta
)
if abs(out_vel.x) > abs(velocity.x):
out_vel.x = 0
else:
# Reversing movement
# When turning the opposite direction, friction is added to the opposite acceleration movement
var reverse_move = is_reversing_horizontal_movement(direction)
if reverse_move:
# TODO dont put constants in here
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
deceleration_force * -3.42 * velocity_direction,
mass,
delta
)
# Normal movement
if abs(velocity.x) < max_velocity[state]:
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
(
(
acceleration_force[state].x
+ (
init_acceleration_force[init_boost_type]
* int(init_boost)
)
)
* direction.x
),
mass,
delta
)
elif !reverse_move:
out_vel.x = max_velocity[state] * direction.x
# Jumping when grounded or jump is buffered
if (
Input.is_action_just_pressed("jump")
|| (jump_buffer_filled && is_on_floor())
):
snap_possible = false
return calculate_jump_velocity(velocity, delta, direction)
# Slowing down movement when not controlling direction
if is_equal_approx(direction.x, 0):
# TODO Handle Deadzones
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x, deceleration_force * -1 * velocity_direction, mass, delta
)
if abs(out_vel.x) > abs(velocity.x):
out_vel.x = 0
else:
# Reversing movement
# When turning the opposite direction, friction is added to the opposite acceleration movement
var reverse_move = is_reversing_horizontal_movement(direction)
if reverse_move:
# TODO dont put constants in here
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
deceleration_force * -3.42 * velocity_direction,
mass,
delta
)
# Normal movement
if abs(velocity.x) < max_velocity[state]:
out_vel.x = PhysicsFunc.two_step_euler(
out_vel.x,
(
(
acceleration_force[state].x
+ (
init_acceleration_force[init_boost_type]
* int(init_boost)
)
)
* direction.x
),
mass,
delta
)
elif !reverse_move:
out_vel.x = max_velocity[state] * direction.x
# Jumping when grounded or jump is buffered
if (
Input.is_action_just_pressed("jump")
|| (jump_buffer_filled && is_on_floor())
):
snap_possible = false
return calculate_jump_velocity(velocity, delta, direction)
elif player_state_machine.coyote_hanging:
out_vel.y = 0
elif player_state_machine.coyote_hanging:
out_vel.y = 0
else:
out_vel.y = _gravity * delta
else:
out_vel.y = _gravity * delta
return out_vel
return out_vel
# Determines if the player has reversed the steering direction
# in reference to the current movement direction
func is_reversing_horizontal_movement(direction: Vector2) -> bool:
return (
(direction.x > 0 && velocity.x < 0)
|| (direction.x < 0 && velocity.x > 0)
)
return (
(direction.x > 0 && velocity.x < 0)
|| (direction.x < 0 && velocity.x > 0)
)
# Returns if the character is touching a wall with its whole body
# Being able to touch a vertical surface over this length also makes it a qualified "wall"
# Also sets wall_touch_direction
func is_touching_wall_completely() -> bool:
var value = true
for left_raycast in left_wall_raycasts.get_children():
wall_touch_direction = -1
if !left_raycast.is_colliding():
value = false
continue
if value == true: return value
var value = true
for left_raycast in left_wall_raycasts.get_children():
wall_touch_direction = -1
if !left_raycast.is_colliding():
value = false
continue
if value == true: return value
value = true
for right_raycast in right_wall_raycasts.get_children():
wall_touch_direction = 1
if !right_raycast.is_colliding():
value = false
continue
return value
value = true
for right_raycast in right_wall_raycasts.get_children():
wall_touch_direction = 1
if !right_raycast.is_colliding():
value = false
continue
return value
# Attached to wall state is in the PlayerStateMachine
func is_correct_walljump_input(direction: Vector2) -> bool:
return (
Input.is_action_pressed("jump")
&& abs(direction.x + wall_touch_direction) < 1
&& abs(direction.x + wall_touch_direction) >= 0
)
return (
Input.is_action_pressed("jump")
&& abs(direction.x + wall_touch_direction) < 1
&& abs(direction.x + wall_touch_direction) >= 0
)
func is_correct_airstrafe_input() -> bool:
return (
air_strafe_charges > 0
&& (
Input.is_action_just_pressed("move_right")
|| Input.is_action_just_pressed("move_left")
)
)
return (
air_strafe_charges > 0
&& (
Input.is_action_just_pressed("move_right")
|| Input.is_action_just_pressed("move_left")
)
)
# Calculates the force of the ground friction
func calculate_deceleration_force(_gravity: float, mass: float) -> float:
return floor_friction * _gravity * mass
return floor_friction * _gravity * mass
func calculate_jump_velocity(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
var state = player_state_machine.state
var additive_jump_force = velocity_jump_boost_ratio * abs(velocity.x) * mass
#TODO Single out stomping and make betta
#TODO too much force intially and too high with frog jump
if stomping:
additive_jump_force += stomp_feedback / delta
stomp_time -= delta
if stomp_time <= 0:
stomp_time = reset_stomp_time
stomping = false
var state = player_state_machine.state
var additive_jump_force = velocity_jump_boost_ratio * abs(velocity.x) * mass
#TODO Single out stomping and make betta
#TODO too much force intially and too high with frog jump
if stomping:
# additive_jump_force += stomp_feedback
stomp_time -= delta
# print(stomp_time)
if stomp_time <= 0:
# print("stomping over")
stomping = false
stomp_time = init_stomp_time
if state != "jump":
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y,
(acceleration_force[state].y / delta + additive_jump_force) * -1,
mass,
delta
)
if state != "jump":
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y,
(acceleration_force[state].y / delta + additive_jump_force) * -1,
mass,
delta
)
# print(acceleration_force[state].y)
# print(linear_velocity.y)
if !Input.is_action_pressed("jump") && !stomping:
# Smooth transition from jumping to falling
if velocity.y > _gravity * delta * 10:
linear_velocity.y += _gravity * delta * 10
else:
linear_velocity.y += (
max(abs(linear_velocity.y), _gravity * delta)
/ 2
)
if !Input.is_action_pressed("jump") && !stomping:
# Smooth transition from jumping to falling
if velocity.y > _gravity * delta * 10:
linear_velocity.y += _gravity * delta * 10
else:
linear_velocity.y += (
max(abs(linear_velocity.y), _gravity * delta)
/ 2
)
else:
linear_velocity.y += _gravity * delta
else:
linear_velocity.y += _gravity * delta
# TODO This is poop too
if -max_velocity["jump"].x < velocity.x and direction.x < 0 || \
max_velocity["jump"].x > velocity.x and direction.x > 0:
var absolut = 1 - initial_velocity_dependence
var divisor = 1/max(0.1, initial_velocity_dependence)
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
mass,
delta
)
# TODO This is poop too
if -max_velocity["jump"].x < velocity.x and direction.x < 0 || \
max_velocity["jump"].x > velocity.x and direction.x > 0:
var absolut = 1 - initial_velocity_dependence
var divisor = 1/max(0.1, initial_velocity_dependence)
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
mass,
delta
)
if is_correct_airstrafe_input():
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
return linear_velocity
if is_correct_airstrafe_input():
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
# print(linear_velocity.y)
return linear_velocity
# Only applicable to downwards gravity
# Can set the jump buffer
func calculate_fall_velocity(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
var state = player_state_machine.state
if velocity.y < max_velocity["fall"].y:
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y, _gravity * mass, mass, delta
)
else:
linear_velocity.y = max_velocity["fall"].y
if -max_velocity["fall"].x < velocity.x and direction.x < 0 || \
max_velocity["fall"].x > velocity.x and direction.x > 0:
# TODO This is poop
var absolut = 1 - initial_velocity_dependence
var divisor = 1/max(0.1, initial_velocity_dependence)
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
mass,
delta
)
if Input.is_action_just_pressed("jump"):
jump_buffer_filled = true
if is_correct_airstrafe_input():
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
if stomping:
linear_velocity = calculate_jump_velocity(Vector2(linear_velocity.x,0), delta, direction)
return linear_velocity
var state = player_state_machine.state
if velocity.y < max_velocity["fall"].y:
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y, _gravity * mass, mass, delta
)
else:
linear_velocity.y = max_velocity["fall"].y
if -max_velocity["fall"].x < velocity.x and direction.x < 0 || \
max_velocity["fall"].x > velocity.x and direction.x > 0:
# TODO This is poop
var absolut = 1 - initial_velocity_dependence
var divisor = 1/max(0.1, initial_velocity_dependence)
var movementFactor = (absolut + abs(velocity.x)/(max_velocity["fall"].x * divisor))
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x, acceleration_force[state].x * movementFactor * direction.x,
mass,
delta
)
if Input.is_action_just_pressed("jump"):
jump_buffer_filled = true
if is_correct_airstrafe_input():
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
if stomping:
linear_velocity = calculate_jump_velocity(Vector2(linear_velocity.x,0), delta, direction)
return linear_velocity
func calculate_wallslide_velocity(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
# Walljump mechanics
if is_correct_walljump_input(direction):
linear_velocity.x = PhysicsFunc.two_step_euler(
0,
acceleration_force["walljump"].x / delta * direction.x,
mass,
delta
)
linear_velocity.y = PhysicsFunc.two_step_euler(
0, acceleration_force["walljump"].y / delta * -1, mass, delta
)
elif is_correct_airstrafe_input():
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
else:
# TODO dont put constants in here
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y*0.94, _gravity * mass, mass, delta
)
air_strafe_charges = air_strafe_charges + 1 if max_air_strafe_charges > air_strafe_charges else 0
return linear_velocity.rotated(rotation)
# Walljump mechanics
if is_correct_walljump_input(direction):
linear_velocity.x = PhysicsFunc.two_step_euler(
0,
acceleration_force["walljump"].x / delta * direction.x,
mass,
delta
)
linear_velocity.y = PhysicsFunc.two_step_euler(
0, acceleration_force["walljump"].y / delta * -1, mass, delta
)
elif is_correct_airstrafe_input():
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
linear_velocity = execute_airstrafe(linear_velocity, delta, direction)
else:
# TODO dont put constants in here
linear_velocity.y = PhysicsFunc.two_step_euler(
linear_velocity.y*0.94, _gravity * mass, mass, delta
)
air_strafe_charges = air_strafe_charges + 1 if max_air_strafe_charges > air_strafe_charges else 0
return linear_velocity.rotated(rotation)
func execute_airstrafe(
linear_velocity: Vector2, delta: float, direction: Vector2
linear_velocity: Vector2, delta: float, direction: Vector2
) -> Vector2:
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
# TODO Consider adding a extra state for airstrafing
# TODO Make airstrafing less instantaneous and moderate the impulse
if direction.x > 0:
effect_player.play("airstrafing")
else:
effect_player.play("airstrafingLeft")
if is_reversing_horizontal_movement(direction):
linear_velocity.x = 0
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x,
acceleration_force["air_strafe"].x / delta * direction.x,
mass,
delta
)
if linear_velocity.y > 0:
# TODO Put constant elsewhere
linear_velocity.y = linear_velocity.y * 0.33
air_strafe_charges -= 1
return linear_velocity
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
# TODO Consider adding a extra state for airstrafing
# TODO Make airstrafing less instantaneous and moderate the impulse
if direction.x > 0:
effect_player.play("airstrafing")
else:
effect_player.play("airstrafingLeft")
if is_reversing_horizontal_movement(direction):
linear_velocity.x = 0
linear_velocity.x = PhysicsFunc.two_step_euler(
linear_velocity.x,
acceleration_force["air_strafe"].x / delta * direction.x,
mass,
delta
)
if linear_velocity.y > 0:
# TODO Put constant elsewhere
linear_velocity.y = linear_velocity.y * 0.33
air_strafe_charges -= 1
return linear_velocity
func calculate_slope_rotation(onfloor: bool) -> float:
var angle = 0
var slope_angle_left = $SlopeRaycastLeft.get_collision_normal().rotated(PI/2).angle()
var slope_angle_right = $SlopeRaycastRight.get_collision_normal().rotated(PI/2).angle()
# avoid invalid angles and stay in rotation when touching ground completely
if(!(-PI/2 <= slope_angle_left && slope_angle_left <= PI/2)
|| !(-PI/2 <= slope_angle_right && slope_angle_right <= PI/2)
|| (is_equal_approx(abs(slope_angle_left), abs(slope_angle_right)))):
return previous_rotation if abs(rad2deg(previous_rotation)) > 1 && !is_equal_approx(slope_angle_left , 0) else 0.0
# downturn
if(abs(slope_angle_left) > abs(slope_angle_right) && velocity.x < -10||
abs(slope_angle_right) > abs(slope_angle_left) && velocity.x > 10):
var length_vector: Vector2 = $SlopeRaycastRight.get_collision_point() - $SlopeRaycastLeft.get_collision_point()
angle = length_vector.angle()
# upturn
else:
var length_vector: Vector2 = $SlopeRaycastLeft.get_collision_point() - $SlopeRaycastRight.get_collision_point()
angle = length_vector.angle() - PI
previous_rotation = angle
if is_equal_approx(deg2rad(angle), 0):
pass
return angle
var angle = 0
var slope_angle_left = $SlopeRaycastLeft.get_collision_normal().rotated(PI/2).angle()
var slope_angle_right = $SlopeRaycastRight.get_collision_normal().rotated(PI/2).angle()
# avoid invalid angles and stay in rotation when touching ground completely
if(!(-PI/2 <= slope_angle_left && slope_angle_left <= PI/2)
|| !(-PI/2 <= slope_angle_right && slope_angle_right <= PI/2)
|| (is_equal_approx(abs(slope_angle_left), abs(slope_angle_right)))):
return previous_rotation if abs(rad2deg(previous_rotation)) > 1 && !is_equal_approx(slope_angle_left , 0) else 0.0
# downturn
if(abs(slope_angle_left) > abs(slope_angle_right) && velocity.x < -10||
abs(slope_angle_right) > abs(slope_angle_left) && velocity.x > 10):
var length_vector: Vector2 = $SlopeRaycastRight.get_collision_point() - $SlopeRaycastLeft.get_collision_point()
angle = length_vector.angle()
# upturn
else:
var length_vector: Vector2 = $SlopeRaycastLeft.get_collision_point() - $SlopeRaycastRight.get_collision_point()
angle = length_vector.angle() - PI
previous_rotation = angle
if is_equal_approx(deg2rad(angle), 0):
pass
return angle
# TODO could be expanded with a parameter about what got stomped
func stomp() -> void:
stomping = true
# print("stomping")
stomping = true
# TOD lose_power_up function
func receive_power_up(kind: String) -> void:
if kind == "shield":
$BubbleShieldViewport/IridescenceBall.visible = true
shielded = true
if kind == "shield":
$BubbleShieldViewport/IridescenceBall.visible = true
shielded = true
# TODO Maybe this should be a state in itself?
func die(animation_number: int = 0) -> void:
if shielded:
shielded = false
$BubbleShieldViewport/IridescenceBall.visible = false
$InvincibilityTimer.start()
$BlobbySprite.material = invincible_shader
return
elif !$InvincibilityTimer.is_stopped():
return
z_index = 1
$BlobbySprite.material = death_shader
signalManager.emit_signal("player_died", animation_number)
$BlobbySprite/AnimationTree.active = false
$BlobbySprite/BlobbymationPlayer.play("dying3")
if animation_number < 1:
$BlobbySprite/BlobbymationPlayer.play("expandingDisolve")
if shielded:
shielded = false
$BubbleShieldViewport/IridescenceBall.visible = false
$InvincibilityTimer.start()
$BlobbySprite.material = invincible_shader
return
elif !$InvincibilityTimer.is_stopped():
return
z_index = 1
$BlobbySprite.material = death_shader
signalManager.emit_signal("player_died", animation_number)
$BlobbySprite/AnimationTree.active = false
$BlobbySprite/BlobbymationPlayer.play("dying3")
if animation_number < 1:
$BlobbySprite/BlobbymationPlayer.play("expandingDisolve")
func die_for_real(animation_number: int = 0) -> void:
shielded = false
$BubbleShieldViewport/IridescenceBall.visible = false
die(animation_number)
shielded = false
$BubbleShieldViewport/IridescenceBall.visible = false
die(animation_number)
# TODO Checkpoint system
func respawn() -> void:
# Is tied to the death animation
get_tree().reload_current_scene()
# Is tied to the death animation
get_tree().reload_current_scene()
# When the Enemy stomp AREA enters the enemy collision area -> stomp
func _on_BlobbySkin_area_entered(area: Area2D) -> void:
if area.is_in_group("harmful") && !levelState.is_dead:
die()
if area.is_in_group("pit"):
$PitfallTimer.start()
if area.is_in_group("harmful") && !levelState.is_dead:
die()
if area.is_in_group("pit"):
$PitfallTimer.start()
# When the Enemy collision BODY enters the enemy collision area -> die
func _on_BlobbySkin_body_entered(body: Node) -> void:
if body.is_in_group("harmful") && !levelState.is_dead:
die()
if body.is_in_group("harmful") && !levelState.is_dead:
die()
# This problem stems from trying to decelerate a walk
# that was caused by the moving environment and not by input
# It is particularly usefull for moving floor physics
# TODO Setting y velocity this way stopped is_on_floor() from working correctly
func _on_Blobby_got_grounded() -> void:
velocity.x -= get_floor_velocity().x
snap_possible = true
var floor_object = get_last_slide_collision().collider.get_parent()
#TODO There is already a friction property in engine
if "slide_friction" in floor_object:
floor_friction = floor_object.slide_friction
else:
floor_friction = base_floor_friction
air_strafe_charges = air_strafe_charges + 1 if max_air_strafe_charges > air_strafe_charges else 0
velocity.x -= get_floor_velocity().x
snap_possible = true
var floor_object = get_last_slide_collision().collider.get_parent()
#TODO There is already a friction property in engine
if "slide_friction" in floor_object:
floor_friction = floor_object.slide_friction
else:
floor_friction = base_floor_friction
air_strafe_charges = air_strafe_charges + 1 if max_air_strafe_charges > air_strafe_charges else 0
func _on_BlobbySkin_body_exited(body:Node) -> void:
# This is for drop through platforms
if body.get_collision_mask_bit(7):
set_collision_mask_bit(7, true)
# This is for drop through platforms
if body.get_collision_mask_bit(7):
set_collision_mask_bit(7, true)
func _on_InvincibilityTimer_timeout() -> void:
$BlobbySprite.material = null
for area in $BlobbySkin.get_overlapping_areas():
if area.is_in_group("harmful"):
die()
$BlobbySprite.material = null
for area in $BlobbySkin.get_overlapping_areas():
if area.is_in_group("harmful"):
die()
func _on_PitfallTimer_timeout() -> void:
# TODO Debuff function to remove wanted buffs
shielded = false
levelState.player_dying()
respawn()
# TODO Debuff function to remove wanted buffs
shielded = false
levelState.player_dying()
respawn()
func handle_grounded_movement(delta: float, direction: Vector2) -> Vector2:
return calculate_grounded_velocity(velocity, delta, direction)
return calculate_grounded_velocity(velocity, delta, direction)
func handle_jump_movement(delta: float, direction: Vector2) -> Vector2:
return calculate_jump_velocity(velocity, delta, direction)
return calculate_jump_velocity(velocity, delta, direction)
func handle_duck_movement(delta: float, direction: Vector2) -> Vector2:
return calculate_duck_velocity(velocity, delta, direction)
return calculate_duck_velocity(velocity, delta, direction)
func handle_fall_movement(delta: float, direction: Vector2) -> Vector2:
return calculate_fall_velocity(velocity, delta, direction)
return calculate_fall_velocity(velocity, delta, direction)
func handle_wallslide_movement(delta: float, direction: Vector2) -> Vector2:
return calculate_wallslide_velocity(velocity, delta, direction)
return calculate_wallslide_velocity(velocity, delta, direction)

View File

@ -1173,7 +1173,7 @@ tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.5424, 10.5016 ) ]
"values": [ Vector2( 12, 10.502 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("../BlobbySkin/CollisionPolygon2D:position")
@ -1197,7 +1197,7 @@ tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11, 10.525 ) ]
"values": [ Vector2( 12, 10.525 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("../BlobbyBody:position")
@ -1209,7 +1209,7 @@ tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0.5, -10.481 ) ]
"values": [ Vector2( 0, -10.481 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast1:position")
@ -1221,7 +1221,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.5, -13 ) ]
"values": [ Vector2( -12, -13 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -1233,7 +1233,7 @@ tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.5, -5 ) ]
"values": [ Vector2( -12, -5 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast1:position")
@ -1245,7 +1245,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11.5, -13 ) ]
"values": [ Vector2( 12, -13 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -1257,7 +1257,7 @@ tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11.5, -5 ) ]
"values": [ Vector2( 12, -5 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath(".:offset")
@ -1310,7 +1310,7 @@ tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.5424, 10.5016 ) ]
"values": [ Vector2( 12, 10.502 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("../BlobbySkin/CollisionPolygon2D:position")
@ -1334,7 +1334,7 @@ tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11, 10.525 ) ]
"values": [ Vector2( 12, 10.525 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("../BlobbyBody:position")
@ -1346,7 +1346,7 @@ tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -0.5, -10.481 ) ]
"values": [ Vector2( 0, -10.481 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast1:position")
@ -1358,7 +1358,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -11, -13 ) ]
"values": [ Vector2( -12, -13 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -1370,7 +1370,7 @@ tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -11.5, -5 ) ]
"values": [ Vector2( -12, -5 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast1:position")
@ -1382,7 +1382,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.5, -13 ) ]
"values": [ Vector2( 12, -13 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -1394,7 +1394,7 @@ tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.5, -5 ) ]
"values": [ Vector2( 12, -5 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath(".:offset")
@ -1494,7 +1494,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -13.0423, -10.6856 ) ]
"values": [ Vector2( -13, -10.686 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -1506,7 +1506,7 @@ tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -13.0423, -1.94163 ) ]
"values": [ Vector2( -13, -1.942 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -1518,7 +1518,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -1.94163 ) ]
"values": [ Vector2( 13, -1.942 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast1:position")
@ -1530,7 +1530,7 @@ tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -10.6856 ) ]
"values": [ Vector2( 13, -10.686 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath(".:offset")
@ -1855,7 +1855,7 @@ tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -10.6856 ) ]
"values": [ Vector2( 12, -10.686 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -1867,7 +1867,7 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -1.94163 ) ]
"values": [ Vector2( 12, -1.942 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -1891,7 +1891,7 @@ tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -13.0423, -10.6856 ) ]
"values": [ Vector2( -12, -10.686 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("../BlobbySkin/CollisionPolygon2D:shape:extents")
@ -1903,7 +1903,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.9698, 8.9748 ) ]
"values": [ Vector2( 12, 8.975 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../BlobbySkin/CollisionPolygon2D:position")
@ -1927,7 +1927,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.971, 8.99662 ) ]
"values": [ Vector2( 12, 8.997 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../BlobbyBody:position")
@ -1992,7 +1992,7 @@ tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -10.6856 ) ]
"values": [ Vector2( 12, -10.686 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -2004,7 +2004,7 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 13.0235, -1.94163 ) ]
"values": [ Vector2( 12, -1.942 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -2016,7 +2016,7 @@ tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -13.0423, -1.94163 ) ]
"values": [ Vector2( -12, -1.942 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast1:position")
@ -2028,7 +2028,7 @@ tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -13.0423, -10.6856 ) ]
"values": [ Vector2( -12, -10.686 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("../BlobbySkin/CollisionPolygon2D:shape:extents")
@ -2040,7 +2040,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.9698, 8.9748 ) ]
"values": [ Vector2( 12, 8.975 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../BlobbySkin/CollisionPolygon2D:position")
@ -2064,7 +2064,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 12.971, 8.99662 ) ]
"values": [ Vector2( 12, 8.997 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../BlobbyBody:position")
@ -2140,7 +2140,7 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11.9889, 9.98094 ) ]
"values": [ Vector2( 12, 9.981 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("../BlobbyBody:position")
@ -2277,7 +2277,7 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 11.9889, 9.98094 ) ]
"values": [ Vector2( 12, 9.981 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("../BlobbyBody:position")
@ -2425,7 +2425,7 @@ tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.0201, 10.5337 ) ]
"values": [ Vector2( 11, 10.534 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("../BlobbyBody:position")
@ -2449,7 +2449,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.012, -12.8494 ) ]
"values": [ Vector2( -11, -12.849 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -2461,7 +2461,7 @@ tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.012, -5.91313 ) ]
"values": [ Vector2( -11, -5.913 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast1:position")
@ -2562,7 +2562,7 @@ tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.0201, 10.5337 ) ]
"values": [ Vector2( 11, 10.534 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("../BlobbyBody:position")
@ -2586,7 +2586,7 @@ tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.012, -12.8494 ) ]
"values": [ Vector2( -11, -12.849 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("../WallRaycasts/LeftWallRaycast/Left_Wallcast2:position")
@ -2598,7 +2598,7 @@ tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -10.012, -5.91313 ) ]
"values": [ Vector2( -11, -5.913 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast1:position")
@ -2610,7 +2610,7 @@ tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.0805, -12.8494 ) ]
"values": [ Vector2( 11, -12.849 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("../WallRaycasts/RightWallRaycast/Right_Wallcast2:position")
@ -2622,7 +2622,7 @@ tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 10.0805, -5.91313 ) ]
"values": [ Vector2( 11, -5.913 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath(".:offset")
@ -4362,21 +4362,18 @@ collision_mask = 40
[node name="SlopeRaycastLeft" type="RayCast2D" parent="."]
visible = false
position = Vector2( -9, 0 )
enabled = true
cast_to = Vector2( 0, 24 )
collision_mask = 8
[node name="SlopeRaycast" type="RayCast2D" parent="."]
unique_name_in_owner = true
visible = false
enabled = true
cast_to = Vector2( 0, 16 )
collision_mask = 8
[node name="SlopeRaycastRight" type="RayCast2D" parent="."]
visible = false
position = Vector2( 10, 0 )
enabled = true
cast_to = Vector2( 0, 24 )
collision_mask = 8

View File

@ -21,249 +21,249 @@ var was_coyote_hanging = false
# Adds the intial states
func _ready():
signalManager.connect("getback_timer_up", parent, "die_for_real", [1])
signalManager.connect("power_up_collected", parent, "receive_power_up")
signalManager.connect("got_stomped", parent, "stomp")
anim_player.play("RESET")
add_state("idle")
add_state("duck")
add_state("run")
add_state("walk")
add_state("jump")
add_state("fall")
add_state("wallslide")
state = states.idle
levelState.is_dead = false
set_state(states.idle)
signalManager.connect("getback_timer_up", parent, "die_for_real", [1])
signalManager.connect("power_up_collected", parent, "receive_power_up")
signalManager.connect("got_stomped", parent, "stomp")
anim_player.play("RESET")
add_state("idle")
add_state("duck")
add_state("run")
add_state("walk")
add_state("jump")
add_state("fall")
add_state("wallslide")
state = states.idle
levelState.is_dead = false
set_state(states.idle)
# Zero Vector is false
if(GlobalState.get_savepoint(levelState.levelName)):
parent.global_position = GlobalState.get_savepoint(levelState.levelName)
# Zero Vector is false
if(GlobalState.get_savepoint(levelState.levelName)):
parent.global_position = GlobalState.get_savepoint(levelState.levelName)
# Calls the parent behaviours according to state
func _state_logic(delta):
# RayCasts for visual debugging
# TODO Global context switch for debug/build mode
# \ is for new line in multiline statements
# parent.get_node("CollisionShape2D/RayCaster")._raycast(
# Vector2.DOWN,
# parent.get_node("CollisionShape2D").get_shape(),
# parent.collision_mask
# )
# RayCasts for visual debugging
# TODO Global context switch for debug/build mode
# \ is for new line in multiline statements
# parent.get_node("CollisionShape2D/RayCaster")._raycast(
# Vector2.DOWN,
# parent.get_node("CollisionShape2D").get_shape(),
# parent.collision_mask
# )
var handle_input_ref
var handle_input_ref
match self.state:
"idle":
handle_input_ref = funcref(self, "handle_idle_input")
"duck":
handle_input_ref = funcref(self, "handle_duck_input")
"walk":
handle_input_ref = funcref(self, "handle_walk_input")
"run":
handle_input_ref = funcref(self, "handle_run_input")
"jump":
handle_input_ref = funcref(self, "handle_jump_input")
"fall":
handle_input_ref = funcref(self, "handle_fall_input")
"wallslide":
handle_input_ref = funcref(self, "handle_wallslide_input")
_:
print("don't panik")
var texture = $"%BubbleShieldViewport".get_texture()
$"%Blobby3DEffects".texture = texture
var direction = get_horizontal_direction()
didTurn = false
match self.state:
"idle":
handle_input_ref = funcref(self, "handle_idle_input")
"duck":
handle_input_ref = funcref(self, "handle_duck_input")
"walk":
handle_input_ref = funcref(self, "handle_walk_input")
"run":
handle_input_ref = funcref(self, "handle_run_input")
"jump":
handle_input_ref = funcref(self, "handle_jump_input")
"fall":
handle_input_ref = funcref(self, "handle_fall_input")
"wallslide":
handle_input_ref = funcref(self, "handle_wallslide_input")
_:
print("don't panik")
var texture = $"%BubbleShieldViewport".get_texture()
$"%Blobby3DEffects".texture = texture
var direction = get_horizontal_direction()
didTurn = false
#TODO use blendspace value 0 for turn animations instead of this?
# Can you make the blendspace animation play out till end?
if direction.x < 0 && facing == 1:
didTurn = true
facing = -1
elif direction.x > 0 && facing == -1:
didTurn = true
facing = 1
#TODO use blendspace value 0 for turn animations instead of this?
# Can you make the blendspace animation play out till end?
if direction.x < 0 && facing == 1:
didTurn = true
facing = -1
elif direction.x > 0 && facing == -1:
didTurn = true
facing = 1
#TODO Yeah... deal with it
if didTurn:
_set_blendspaces_direction(facing)
_trigger_turn_animation()
#TODO Yeah... deal with it
if didTurn:
_set_blendspaces_direction(facing)
_trigger_turn_animation()
parent.velocity = handle_input_ref.call_func(delta, direction)
parent.velocity = handle_input_ref.call_func(delta, direction)
parent.execute_movement()
parent.execute_movement()
func handle_idle_input(delta, direction) -> Vector2:
return parent.handle_grounded_movement(delta, direction)
return parent.handle_grounded_movement(delta, direction)
func handle_duck_input(delta, direction) -> Vector2:
return parent.handle_duck_movement(delta, direction)
return parent.handle_duck_movement(delta, direction)
func handle_walk_input(delta, direction) -> Vector2:
return parent.handle_grounded_movement(delta, direction)
return parent.handle_grounded_movement(delta, direction)
func handle_run_input(delta, direction) -> Vector2:
return parent.handle_grounded_movement(delta, direction)
return parent.handle_grounded_movement(delta, direction)
func handle_jump_input(delta, direction) -> Vector2:
return parent.handle_jump_movement(delta, direction)
return parent.handle_jump_movement(delta, direction)
func handle_fall_input(delta, direction) -> Vector2:
return parent.handle_fall_movement(delta, direction)
return parent.handle_fall_movement(delta, direction)
func handle_wallslide_input(delta, direction) -> Vector2:
return parent.handle_wallslide_movement(delta, direction)
return parent.handle_wallslide_movement(delta, direction)
func get_horizontal_direction() -> Vector2:
#TODO Check if this is fixed yet -> Seems like it, idk what i meant by that lul xd roflcopter lmao wtfbbq1!!!11!
if Input.is_action_pressed("move_right"):
return Vector2(1, 0)
if Input.is_action_pressed("move_left"):
return Vector2(-1, 0)
return Vector2(0,0);
#TODO Check if this is fixed yet -> Seems like it, idk what i meant by that lul xd roflcopter lmao wtfbbq1!!!11!
if Input.is_action_pressed("move_right"):
return Vector2(1, 0)
if Input.is_action_pressed("move_left"):
return Vector2(-1, 0)
return Vector2(0,0);
# Determines which state should be active at the moment
func _get_transition(delta):
parent.get_node("StateLabel").text = (
self.state
+ " x vel:"
+ String(round(parent.velocity.x))
# + " y vel/10:"
# + String(round(parent.velocity.y / 10))
)
var new_state
if !parent.is_on_floor():
if parent.velocity.y < -1:
was_coyote_hanging = false
parent.jump_buffer_filled = false
new_state = states.jump
parent.get_node("StateLabel").text = (
self.state
+ " x vel:"
+ String(round(parent.velocity.x))
# + " y vel/10:"
# + String(round(parent.velocity.y / 10))
)
var new_state
if !parent.is_on_floor():
if parent.velocity.y < -1:
was_coyote_hanging = false
parent.jump_buffer_filled = false
new_state = states.jump
# TODO SOMETHING IS SETTING Y SLIGHTLY BELOW ZERO WHEN MOVING HORIZONTALLY???
if parent.velocity.y >= -0.01:
new_state = states.fall
if parent.is_touching_wall_completely():
anim_tree.set("parameters/wallslideToJump/blend_position", parent.wall_touch_direction)
anim_tree.set("parameters/wallsliding/blend_position", parent.wall_touch_direction)
new_state = states.wallslide
# Begins coyote time only if walking from ledge
elif [states.walk, states.run].has(self.state) && !was_coyote_hanging:
$CoyoteTimer.start()
coyote_hanging = true
was_coyote_hanging = true
# TODO SOMETHING IS SETTING Y SLIGHTLY BELOW ZERO WHEN MOVING HORIZONTALLY???
if parent.velocity.y >= -0.01:
new_state = states.fall
if parent.is_touching_wall_completely():
anim_tree.set("parameters/wallslideToJump/blend_position", parent.wall_touch_direction)
anim_tree.set("parameters/wallsliding/blend_position", parent.wall_touch_direction)
new_state = states.wallslide
# Begins coyote time only if walking from ledge
elif [states.walk, states.run].has(self.state) && !was_coyote_hanging:
$CoyoteTimer.start()
coyote_hanging = true
was_coyote_hanging = true
if new_state == states.fall && $JumpBufferTimer.is_stopped():
$JumpBufferTimer.start()
if new_state == states.fall && $JumpBufferTimer.is_stopped():
$JumpBufferTimer.start()
# It's important to check this here and not set by event (order)
if (
$CoyoteTimer.is_stopped()
|| [states.idle, states.jump].has(self.state)
):
coyote_hanging = false
if coyote_hanging:
new_state = self.state
elif abs(parent.velocity.x) > 5:
was_coyote_hanging = false
if Input.is_action_pressed("boost_move"):
new_state = states.run
# TODO Walking when stopping and not pressing anything?
else:
new_state = states.walk
if Input.is_action_pressed("duck"):
new_state = states.duck
# It's important to check this here and not set by event (order)
if (
$CoyoteTimer.is_stopped()
|| [states.idle, states.jump].has(self.state)
):
coyote_hanging = false
if coyote_hanging:
new_state = self.state
elif abs(parent.velocity.x) > 5:
was_coyote_hanging = false
if Input.is_action_pressed("boost_move"):
new_state = states.run
# TODO Walking when stopping and not pressing anything?
else:
new_state = states.walk
if Input.is_action_pressed("duck"):
new_state = states.duck
else:
was_coyote_hanging = false
new_state = states.idle
if Input.is_action_pressed("duck"):
new_state = states.duck
else:
was_coyote_hanging = false
new_state = states.idle
if Input.is_action_pressed("duck"):
new_state = states.duck
if new_state != self.state:
state_time = 0
return new_state
init_boost = false
return null
if new_state != self.state:
state_time = 0
return new_state
init_boost = false
return null
func _enter_state(new_state, old_state):
if old_state == "idle" && (new_state == "walk" || new_state == "run"):
init_boost = true
init_boost_type = old_state + "_" + new_state
else:
init_boost = false
init_boost_type = ""
if(new_state == "run"):
running_particles.emitting = true
if(new_state == "jump"):
jump_point_particles.position.x = 0 if facing == 1 else 24
jump_point_particles.emitting = true
jump_point_particles.restart()
if old_state == "idle" && (new_state == "walk" || new_state == "run"):
init_boost = true
init_boost_type = old_state + "_" + new_state
else:
init_boost = false
init_boost_type = ""
if(new_state == "run"):
running_particles.emitting = true
if(new_state == "jump"):
jump_point_particles.position.x = 0 if facing == 1 else 24
jump_point_particles.emitting = true
jump_point_particles.restart()
if !["run", "walk", "idle", "duck"].has(old_state) && parent.is_on_floor():
emit_signal("got_grounded")
if !["run", "walk", "idle", "duck"].has(old_state) && parent.is_on_floor():
emit_signal("got_grounded")
match new_state:
states.walk:
# TODO I need this when there is a turn happening between two different states
# TODO Queue animation and only play if state time is exceeded, to not play animation on too small jumps/short wallslides
if old_state == states.idle && didTurn:
anim_state_playback.travel("idleTurn")
else:
anim_state_playback.travel("walking")
states.idle:
anim_state_playback.travel("idling")
states.duck:
anim_state_playback.travel("ducking")
states.jump:
if parent.rotation == 0 || !parent.snap_possible:
anim_state_playback.travel("jumping")
states.fall:
if parent.rotation == 0 || !parent.snap_possible:
anim_state_playback.travel("falling")
states.run:
anim_state_playback.travel("running")
states.wallslide:
# TODO When the hitbox transforms from wallslide to idle, blobby hangs in the air and that triggers the wallslide on landing
if(old_state != states.idle):
anim_state_playback.travel("wallsliding")
match new_state:
states.walk:
# TODO I need this when there is a turn happening between two different states
# TODO Queue animation and only play if state time is exceeded, to not play animation on too small jumps/short wallslides
if old_state == states.idle && didTurn:
anim_state_playback.travel("idleTurn")
else:
anim_state_playback.travel("walking")
states.idle:
anim_state_playback.travel("idling")
states.duck:
anim_state_playback.travel("ducking")
states.jump:
if parent.rotation == 0 || !parent.snap_possible:
anim_state_playback.travel("jumping")
states.fall:
if parent.rotation == 0 || !parent.snap_possible:
anim_state_playback.travel("falling")
states.run:
anim_state_playback.travel("running")
states.wallslide:
# TODO When the hitbox transforms from wallslide to idle, blobby hangs in the air and that triggers the wallslide on landing
if(old_state != states.idle):
anim_state_playback.travel("wallsliding")
func _exit_state(_old_state, _new_state):
if(_old_state == "run"):
running_particles.emitting = false
pass
if(_old_state == "run"):
running_particles.emitting = false
pass
func _set_blendspaces_direction(value):
running_particles.texture = run_dust_res if facing == -1 else run_dust_left_res
running_particles.scale.x = facing
anim_tree.set("parameters/ducking/blend_position", value)
anim_tree.set("parameters/falling/blend_position", value)
anim_tree.set("parameters/idling/blend_position", value)
anim_tree.set("parameters/jumpToFall/blend_position", value)
anim_tree.set("parameters/jumping/blend_position", value)
anim_tree.set("parameters/runToJump/blend_position", value)
anim_tree.set("parameters/running/blend_position", value)
anim_tree.set("parameters/turnToRun/blend_position", value)
anim_tree.set("parameters/walking/blend_position", value)
running_particles.texture = run_dust_res if facing == -1 else run_dust_left_res
running_particles.scale.x = facing
anim_tree.set("parameters/ducking/blend_position", value)
anim_tree.set("parameters/falling/blend_position", value)
anim_tree.set("parameters/idling/blend_position", value)
anim_tree.set("parameters/jumpToFall/blend_position", value)
anim_tree.set("parameters/jumping/blend_position", value)
anim_tree.set("parameters/runToJump/blend_position", value)
anim_tree.set("parameters/running/blend_position", value)
anim_tree.set("parameters/turnToRun/blend_position", value)
anim_tree.set("parameters/walking/blend_position", value)
func _trigger_turn_animation():
match self.state:
states.duck:
anim_state_playback.travel("duckTurn")
states.walk:
anim_state_playback.travel("idleTurn")
states.idle:
anim_state_playback.travel("idleTurn")
match self.state:
states.duck:
anim_state_playback.travel("duckTurn")
states.walk:
anim_state_playback.travel("idleTurn")
states.idle:
anim_state_playback.travel("idleTurn")
func _on_JumpBufferTimer_timeout() -> void:
parent.jump_buffer_filled = false
parent.jump_buffer_filled = false

View File

@ -108,7 +108,7 @@ func execute_movement(delta: float) -> void:
velocity.x = velocity.x * 0.8
velocity.y = velocity.y * 0.8
was_restricted = true
velocity = move_and_slide(velocity, FLOOR_NORMAL, false, 4, 0.785398,false)
velocity = move_and_slide(velocity, FLOOR_NORMAL, false, 4, 0.785398, false)
if(is_on_floor()):
velocity = Vector2(0,0)
@ -154,7 +154,7 @@ func search_next_target():
if(target != null && !weakref(target).get_ref()):
return
detect_food()
if(food_target == null):
if(food_target == null && is_bound):
detect_player()
@ -246,7 +246,7 @@ func detect_player() -> void:
func sleeping() -> Vector2:
jump_timer.stop()
detect_player()
# detect_player()
return velocity
@ -356,24 +356,25 @@ func consider_jump_landing_space(v: Vector2) -> Vector2:
collider = check_feeler(Vector2(jump_distance * get_facing_direction(), - jump_height/2))
if((!is_jump_path_safe(v, global_position) || collider != null) && can_reverse_facing_direction()):
# Can be printed when frog would jump into a wall too
print("no safe landing space found")
print("at wall or no safe landing spot")
return Vector2(0,0)
return v
func consider_jumping_on_top() -> Vector2:
var collider = check_feeler(Vector2(42 * get_facing_direction(),0))
# 0 just for tile coordinate calculation
var facing = 0 if get_facing_direction() >= 0 else - 1
if (collider == null):
return Vector2(0,0)
var local_position = tilemap.to_local(feeler_raycast.get_collision_point())
var map_position = tilemap.world_to_map(local_position)
var tile_position = Vector2(map_position.x + facing, map_position.y)
var tile_position = Vector2(map_position.x + facing, map_position.y - 1)
# TODO Here the climb height of frog is limited to one constantly
var cell_id = tilemap.get_cell(tile_position.x, tile_position.y - 2)
var cell_id = tilemap.get_cell(tile_position.x, tile_position.y - 1)
if (cell_id != -1 &&
#TODO 9 is the navigation tile, but thats subject to change!
cell_id != 8):
#TODO 0 is the navigation tile, but thats subject to change!
cell_id != 7):
return Vector2(0,0)
var tile_upper_left_corner = tilemap.to_global(tilemap.map_to_world(tile_position))
var tile_upper_right_corner = Vector2(tile_upper_left_corner.x + tilemap.cell_size.x, tile_upper_left_corner.y)
@ -387,11 +388,12 @@ func consider_jumping_on_top() -> Vector2:
var frog_bottom_right_corner = Vector2($EnemyBody.global_position.x + $EnemyBody.shape.extents.x,
$EnemyBody.global_position.y + $EnemyBody.shape.extents.y)
jump_angle = frog_bottom_right_corner.angle_to_point(tile_upper_left_corner) - PI
if(abs(rad2deg(jump_angle)) < 78):
return correct_jump_direction(velocity_for_jump_distance(default_jump_distance/2, abs(deg2rad(80))))
else:
return velocity_for_jump_distance(10, abs(deg2rad(45))) * -1 * facing
var v = velocity_for_jump_distance(block_size/1.5, abs(deg2rad(45)))
return Vector2(v.x * -1 * get_facing_direction(), v.y)
# Tries to shorten the jump, so that it lands in a tiles center

View File

@ -108,7 +108,7 @@ tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"update": 1,
"values": [ Vector2( 1, 1 ) ]
}
@ -138,7 +138,7 @@ tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"update": 1,
"values": [ Vector2( -1, 1 ) ]
}
@ -280,7 +280,7 @@ tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"update": 1,
"values": [ Vector2( 1, 1 ) ]
}
@ -310,7 +310,7 @@ tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"update": 1,
"values": [ Vector2( -1, 1 ) ]
}
@ -412,14 +412,14 @@ states/idleHappy/position = Vector2( -58.7619, 98.0433 )
states/idleMean/node = SubResource( 20 )
states/idleMean/position = Vector2( 451.952, 98.0432 )
states/liftOff/node = SubResource( 23 )
states/liftOff/position = Vector2( 184, -12 )
states/liftOff/position = Vector2( 184.223, -12 )
states/midJumping/node = SubResource( 26 )
states/midJumping/position = Vector2( 184.091, -141 )
states/sleeping/node = SubResource( 54 )
states/sleeping/position = Vector2( 176.896, 205.619 )
states/sleeping/position = Vector2( 177.848, 205.619 )
transitions = [ "idleHappy", "liftOff", SubResource( 27 ), "liftOff", "midJumping", SubResource( 28 ), "idleMean", "liftOff", SubResource( 29 ), "midJumping", "liftOff", SubResource( 30 ), "liftOff", "idleMean", SubResource( 31 ), "liftOff", "idleHappy", SubResource( 32 ), "idleHappy", "sleeping", SubResource( 55 ), "idleMean", "sleeping", SubResource( 56 ), "sleeping", "idleHappy", SubResource( 57 ), "sleeping", "idleMean", SubResource( 58 ) ]
start_node = "idleHappy"
graph_offset = Vector2( -375, -158 )
graph_offset = Vector2( -379, -204 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=11]
@ -427,15 +427,15 @@ graph_offset = Vector2( -375, -158 )
extents = Vector2( 12, 9 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 12, 1.5 )
extents = Vector2( 11, 1.875 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 18.2143, 13.5955 )
[node name="WhatAreFrog" type="KinematicBody2D"]
collision_layer = 2
collision_mask = 57
collision/safe_margin = 0.001
collision_mask = 185
collision/safe_margin = 0.002
script = ExtResource( 2 )
[node name="Statemachine" type="Node2D" parent="."]
@ -494,10 +494,10 @@ active = true
root_motion_track = NodePath(".:frame")
parameters/playback = SubResource( 11 )
parameters/idleHappy/blend_position = 1.0
parameters/idleMean/blend_position = 1.0
parameters/idleMean/blend_position = 1.2434
parameters/liftOff/blend_position = 1.0
parameters/midJumping/blend_position = 1.0
parameters/sleeping/blend_position = 1.0
parameters/sleeping/blend_position = -0.00214911
[node name="VisibilityEnabler2D" type="VisibilityEnabler2D" parent="."]
position = Vector2( 954, 0 )
@ -509,7 +509,7 @@ physics_process_parent = true
[node name="FeelerRayCast" type="RayCast2D" parent="."]
enabled = true
cast_to = Vector2( 0, -1 )
collision_mask = 280
collision_mask = 281
collide_with_areas = true
[node name="Orientation" type="RayCast2D" parent="."]
@ -521,14 +521,14 @@ collide_with_bodies = false
position = Vector2( -10, 6 )
enabled = true
cast_to = Vector2( -5, 0 )
collision_mask = 40
collision_mask = 41
collide_with_areas = true
[node name="Right_Wallcast" type="RayCast2D" parent="."]
position = Vector2( 10, 6 )
enabled = true
cast_to = Vector2( 5, 0 )
collision_mask = 40
collision_mask = 41
collide_with_areas = true
[node name="VisionRayCast" type="RayCast2D" parent="."]
@ -556,7 +556,7 @@ input_pickable = false
monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="StompDetector"]
position = Vector2( 0, -1 )
position = Vector2( 0, -0.875 )
shape = SubResource( 2 )
[node name="EnemySkin" type="Area2D" parent="."]

View File

@ -5,67 +5,75 @@ onready var anim_state_playback = $"../FrogSprite/AnimationTree".get("parameters
func _ready() -> void:
add_state("searching")
add_state("hunting")
add_state("sleeping")
state = states.searching
set_state(states.searching)
print(self.state)
for state in states:
if state_matching_method_exists(state):
continue
else:
printerr("StateMachine -> State: " + state + " has no matching method in parent.")
push_error("StateMachine -> State: " + state + " has no matching method in parent.")
add_state("searching")
add_state("hunting")
add_state("sleeping")
state = states.searching
set_state(states.searching)
print(self.state)
for state in states:
if state_matching_method_exists(state):
continue
else:
printerr("StateMachine -> State: " + state + " has no matching method in parent.")
push_error("StateMachine -> State: " + state + " has no matching method in parent.")
# _animation_logic()
# Game logic consequences of state
func _state_logic(delta):
var state_action_ref = funcref(parent, self.state)
parent.velocity = state_action_ref.call_func()
parent.execute_movement(delta)
var state_action_ref = funcref(parent, self.state)
parent.velocity = state_action_ref.call_func()
parent.execute_movement(delta)
func _get_transition(_delta):
parent.get_node("StateLabel").text = self.state
_animation_logic()
var new_state
if parent.target == null:
new_state = states.searching
if parent.target != null:
new_state = states.hunting
if parent.is_hurt:
new_state = states.sleeping
if new_state != self.state:
return new_state
return null
parent.get_node("StateLabel").text = self.state
_set_blendspaces_direction()
_animation_logic()
var new_state
if parent.target == null:
new_state = states.searching
if parent.target != null:
new_state = states.hunting
if parent.is_hurt:
new_state = states.sleeping
if new_state != self.state:
return new_state
return null
func _enter_state(_new_state, _previous_state):
pass
pass
func _exit_state(_previous_state, _new_state):
pass
pass
func _animation_logic():
_set_blendspaces_direction()
if parent.is_on_floor():
if(parent.is_hurt):
anim_state_playback.travel("sleeping")
elif (parent.is_bound):
anim_state_playback.travel("idleMean")
else:
anim_state_playback.travel("idleHappy")
else:
anim_state_playback.travel("midJumping")
func _animation_logic():
var animation = "sleeping"
if parent.is_on_floor():
if(parent.is_hurt):
animation = "sleeping"
elif (parent.is_bound):
animation = "idleMean"
else:
animation = "idleHappy"
# The frog is lifted from the ground slightly when blobby stands on him for whatever reason
elif state != "sleeping":
animation = "midJumping"
if anim_state_playback.get_current_node() != animation:
print(anim_state_playback.get_current_node())
print(animation)
anim_state_playback.travel(animation)
func _set_blendspaces_direction():
var value = parent.get_facing_direction()
# var leash_orientation := sign($"../LeashAnchor".position.x)
# $"../LeashAnchor".position.x *= -1 if leash_orientation == value else 1
anim_tree.set("parameters/idleHappy/blend_position", value)
anim_tree.set("parameters/idleMean/blend_position", value)
anim_tree.set("parameters/liftOff/blend_position", value)
anim_tree.set("parameters/midJumping/blend_position", value)
var value = parent.get_facing_direction()
# var leash_orientation := sign($"../LeashAnchor".position.x)
# $"../LeashAnchor".position.x *= -1 if leash_orientation == value else 1
anim_tree.set("parameters/idleHappy/blend_position", value)
anim_tree.set("parameters/idleMean/blend_position", value)
anim_tree.set("parameters/liftOff/blend_position", value)
anim_tree.set("parameters/midJumping/blend_position", value)
anim_tree.set("parameters/sleeping/blend_position", value)

View File

@ -0,0 +1,135 @@
[gd_resource type="TileSet" load_steps=14 format=2]
[ext_resource path="res://assets/contraption/drop-through-platform.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 0, 0, 16, 0, 16, 0, 0, 0 )
[resource]
2/name = "drop-through-platform.png 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 16, 0, 192, 16 )
2/tile_mode = 2
2/autotile/icon_coordinate = Vector2( 0, 0 )
2/autotile/tile_size = Vector2( 16, 16 )
2/autotile/spacing = 0
2/autotile/occluder_map = [ ]
2/autotile/navpoly_map = [ ]
2/autotile/priority_map = [ ]
2/autotile/z_index_map = [ ]
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape = SubResource( 1 )
2/shape_one_way = true
2/shape_one_way_margin = 1.0
2/shapes = [ {
"autotile_coord": Vector2( 2, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 10, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 11, 0 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
2/z_index = 0

View File

@ -1,332 +0,0 @@
[gd_resource type="TileSet" load_steps=32 format=2]
[ext_resource path="res://assets/environment/blocks/basic_tileset_blobb-jakob-remix.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=15]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=16]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=17]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=18]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=19]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=20]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=21]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=22]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=23]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=24]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=25]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=26]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=27]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=28]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=29]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=30]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=31]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=32]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=33]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=34]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="NavigationPolygon" id=35]
vertices = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
outlines = [ PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) ]
[resource]
0/name = "basic_tileset_blobb-jakob-remix.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 128, 128 )
0/tile_mode = 1
0/autotile/bitmask_mode = 0
0/autotile/bitmask_flags = [ Vector2( 0, 1 ), 1, Vector2( 0, 6 ), 321, Vector2( 1, 0 ), 256, Vector2( 1, 6 ), 320, Vector2( 2, 0 ), 320, Vector2( 3, 0 ), 64, Vector2( 4, 0 ), 260, Vector2( 5, 0 ), 65, Vector2( 5, 4 ), 324, Vector2( 5, 5 ), 321, Vector2( 6, 0 ), 4, Vector2( 6, 5 ), 64, Vector2( 7, 0 ), 5, Vector2( 7, 5 ), 65 ]
0/autotile/icon_coordinate = Vector2( 6, 5 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 6 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 15 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 17 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 6 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
1/name = "basic_tileset_blobb-jakob-remix.png 1"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 0, 0, 128, 128 )
1/tile_mode = 2
1/autotile/icon_coordinate = Vector2( 5, 3 )
1/autotile/tile_size = Vector2( 16, 16 )
1/autotile/spacing = 0
1/autotile/occluder_map = [ ]
1/autotile/navpoly_map = [ ]
1/autotile/priority_map = [ ]
1/autotile/z_index_map = [ ]
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape = SubResource( 20 )
1/shape_one_way = false
1/shape_one_way_margin = 1.0
1/shapes = [ {
"autotile_coord": Vector2( 1, 6 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 23 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 24 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 25 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 26 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 27 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 28 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 29 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 30 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 31 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 32 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 33 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 34 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
1/z_index = 0
2/name = "basic_tileset_blobb-jakob-remix.png 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 0, 0, 16, 16 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/navigation = SubResource( 35 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape_one_way = false
2/shape_one_way_margin = 0.0
2/shapes = [ ]
2/z_index = 0

View File

@ -1,12 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/environment/background/background.png" type="Texture" id=1]
[node name="Simple Background" type="CanvasLayer"]
[node name="background" type="TextureRect" parent="."]
margin_right = 426.667
margin_bottom = 240.0
texture = ExtResource( 1 )
expand = true
stretch_mode = 1

View File

@ -1,30 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/environment/decor/straight_straw.png" type="Texture" id=1]
[node name="GrassWithBones" type="Node2D"]
[node name="Polygon2D" type="Polygon2D" parent="."]
offset = Vector2( -6.5, -12.5 )
texture = ExtResource( 1 )
skeleton = NodePath("../Skeleton2D")
polygon = PoolVector2Array( 4.166, 12.5, 4.166, 7.25, 4.166, 1.5, 9.103, 1.5, 9.10325, 7.25, 9.103, 12.5 )
uv = PoolVector2Array( 4.166, 12.5, 4.166, 7.25, 4.166, 1.5, 9.103, 1.5, 9.10325, 7.25, 9.103, 12.5 )
polygons = [ PoolIntArray( 5, 0, 1, 2, 3, 4 ) ]
bones = [ "Base", PoolRealArray( 1, 0.34, 0, 0, 0, 1 ), "Base/Mid", PoolRealArray( 0.66, 1, 0, 0.5, 1, 0.83 ), "Base/Mid/Top", PoolRealArray( 0.49, 0.32, 1, 1, 0.49, 0.49 ) ]
[node name="Skeleton2D" type="Skeleton2D" parent="."]
[node name="Base" type="Bone2D" parent="Skeleton2D"]
rest = Transform2D( 1, 0, 0, 1, 0, 0 )
default_length = 7.0
[node name="Mid" type="Bone2D" parent="Skeleton2D/Base"]
rest = Transform2D( 1, 0, 0, 1, 0, 0 )
default_length = 7.0
[node name="Top" type="Bone2D" parent="Skeleton2D/Base/Mid"]
position = Vector2( 0, -5 )
rotation = -1.5708
rest = Transform2D( 2.22127e-06, -1, 1, 2.22127e-06, 0, -5 )
default_length = 4.0

View File

@ -0,0 +1,178 @@
[gd_resource type="TileSet" load_steps=18 format=2]
[ext_resource path="res://assets/environment/blocks/BasicTileSet.png" type="Texture" id=2]
[sub_resource type="NavigationPolygon" id=21]
vertices = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
outlines = [ PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) ]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=26]
points = PoolVector2Array( 0, 0, 0, 0, 16, 0, 16, 11.0125, 2.92126, 8.9875 )
[sub_resource type="ConvexPolygonShape2D" id=27]
points = PoolVector2Array( 0, 0.03125, 0, 0, 16, 0, 16, 10.9094, 0, 10.9688 )
[sub_resource type="ConvexPolygonShape2D" id=28]
points = PoolVector2Array( 0, 0, 16, 0, 12.9719, 8.84687, 0, 10.9719 )
[sub_resource type="ConvexPolygonShape2D" id=29]
points = PoolVector2Array( 1.97188, 14.1594, 0, 0, 15.9719, 0, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=30]
points = PoolVector2Array( 0, 0, 16, 0, 14.0969, 14.1469, 0, 16 )
[sub_resource type="NavigationPolygon" id=31]
vertices = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
outlines = [ PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) ]
[resource]
5/name = "Green House Tiles"
5/texture = ExtResource( 2 )
5/tex_offset = Vector2( 0, 0 )
5/modulate = Color( 1, 1, 1, 1 )
5/region = Rect2( 0, 0, 176, 160 )
5/tile_mode = 2
5/autotile/icon_coordinate = Vector2( 5, 6 )
5/autotile/tile_size = Vector2( 16, 16 )
5/autotile/spacing = 0
5/autotile/occluder_map = [ ]
5/autotile/navpoly_map = [ Vector2( 0, 0 ), SubResource( 21 ) ]
5/autotile/priority_map = [ ]
5/autotile/z_index_map = [ ]
5/occluder_offset = Vector2( 0, 0 )
5/navigation_offset = Vector2( 0, 0 )
5/shape_offset = Vector2( 0, 0 )
5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
5/shape = SubResource( 1 )
5/shape_one_way = false
5/shape_one_way_margin = 1.0
5/shapes = [ {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 10, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 26 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 27 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 28 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 29 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 30 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
5/z_index = 0
7/name = "Navigation Tile"
7/texture = ExtResource( 2 )
7/tex_offset = Vector2( 0, 0 )
7/modulate = Color( 1, 1, 1, 1 )
7/region = Rect2( 0, 0, 16, 16 )
7/tile_mode = 0
7/occluder_offset = Vector2( 0, 0 )
7/navigation_offset = Vector2( 0, 0 )
7/navigation = SubResource( 31 )
7/shape_offset = Vector2( 0, 0 )
7/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
7/shape_one_way = false
7/shape_one_way_margin = 0.0
7/shapes = [ ]
7/z_index = 0

View File

@ -0,0 +1,26 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://assets/environment/decor/platform-plants.png" type="Texture" id=1]
[resource]
0/name = "platform-plants.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 16, 0, 256, 16 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 5, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape_one_way = false
0/shape_one_way_margin = 0.0
0/shapes = [ ]
0/z_index = 0

File diff suppressed because one or more lines are too long

View File

@ -44,10 +44,10 @@ unique_name_in_owner = true
drag_margin_bottom = 0.3
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 5
frame = 8
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 10
frame = 13
[node name="Blobby" parent="." instance=ExtResource( 9 )]
unique_name_in_owner = true
@ -228,19 +228,19 @@ position = Vector2( 756, -15 )
z_index = -1
[node name="AnimatedSprite" parent="Coin" index="2"]
frame = 5
frame = 154
[node name="Coin2" parent="." instance=ExtResource( 11 )]
position = Vector2( 744, -120 )
[node name="AnimatedSprite" parent="Coin2" index="2"]
frame = 250
frame = 85
[node name="Coin3" parent="." instance=ExtResource( 11 )]
position = Vector2( 1320, -282 )
[node name="AnimatedSprite" parent="Coin3" index="2"]
frame = 250
frame = 85
[node name="Coin4" parent="." instance=ExtResource( 11 )]
position = Vector2( 2340, -156 )

View File

@ -44,10 +44,10 @@ wait_time = 20.0
unique_name_in_owner = true
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 9
frame = 2
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 13
frame = 6
[node name="Blobby" parent="." instance=ExtResource( 15 )]
unique_name_in_owner = true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,41 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=13 format=2]
[ext_resource path="res://src/Environment/AlienShipTileSet.tres" type="TileSet" id=1]
[ext_resource path="res://src/Environment/GreenHouseTiles.tres" type="TileSet" id=1]
[ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Utilities/LevelState.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Actors/BlobbyCam.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/Contraptions/DropThroughPlatforms.tres" type="TileSet" id=6]
[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=7]
[ext_resource path="res://src/UserInterface/UserInterface.tscn" type="PackedScene" id=8]
[ext_resource path="res://src/Levels/Templates/LevelTemplate.gd" type="Script" id=9]
[ext_resource path="res://assets/environment/decor/platform-plants.png" type="Texture" id=10]
[sub_resource type="AnimationNodeStateMachinePlayback" id=4]
[sub_resource type="TileSet" id=5]
0/name = "platform-plants.png 0"
0/texture = ExtResource( 10 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 16, 0, 256, 16 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 5, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape_one_way = false
0/shape_one_way_margin = 0.0
0/shapes = [ ]
0/z_index = 0
[node name="LevelTemplate" type="Node2D"]
script = ExtResource( 9 )
__meta__ = {
@ -34,10 +59,10 @@ unique_name_in_owner = true
drag_margin_bottom = 0.3
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 2
frame = 3
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 1
frame = 2
[node name="Blobby" parent="." instance=ExtResource( 7 )]
unique_name_in_owner = true
@ -50,17 +75,27 @@ parameters/playback = SubResource( 4 )
[node name="TileMap" type="TileMap" parent="."]
unique_name_in_owner = true
tile_set = ExtResource( 1 )
cell_size = Vector2( 24, 24 )
cell_size = Vector2( 16, 16 )
cell_quadrant_size = 3
cell_custom_transform = Transform2D( 24, 0, 0, 24, 0, 0 )
collision_layer = 8
collision_mask = 8
bake_navigation = true
format = 1
tile_data = PoolIntArray( -458761, 1610612738, 0, -458760, 1610612738, 0, -458759, 1610612738, 0, -458758, 1610612738, 0, -458757, 1610612738, 0, -458756, 1610612738, 0, -458755, 1610612738, 0, -458754, 1610612738, 0, -458753, 1610612738, 0, -524288, 1610612738, 0, -524287, 1610612738, 0, -524286, 1610612738, 0, -524285, 1610612738, 0, -524284, 1610612738, 0, -524283, 1610612738, 0, -524282, 1610612738, 0, -524281, 1610612738, 0, -524280, 1610612738, 0, -524279, 1610612738, 0, -524278, 1610612738, 0, -524277, 1610612738, 0, -524276, 1610612738, 0, -393226, -1610612734, 0, -458739, -1073741822, 0, -327690, -1610612734, 0, -393203, -1073741822, 0, -262154, -1610612734, 0, -327667, -1073741822, 0, -196618, -1610612734, 0, -262131, -1073741822, 0, -131082, -1610612734, 0, -196595, -1073741822, 0, -65546, -1610612734, 0, -131059, -1073741822, 0, -10, -1610612734, 0, -65523, -1073741822, 0, 65526, -1610612734, 0, 13, -1073741822, 0, 131062, -1610612734, 0, 65549, -1073741822, 0, 196598, -1610612734, 0, 131085, -1073741822, 0, 262134, -1610612734, 0, 196621, -1073741822, 0, 327670, -1610612734, 0, 262157, -1073741822, 0, 393206, -1610612734, 0, 327693, -1073741822, 0, 458743, 2, 0, 458744, 2, 0, 458745, 2, 0, 458746, 2, 0, 458747, 2, 0, 458748, 2, 0, 458749, 2, 0, 458750, 2, 0, 458751, 2, 0, 393216, 2, 0, 393217, 2, 0, 393218, 2, 0, 393219, 2, 0, 393220, 2, 0, 393221, 2, 0, 393222, 2, 0, 393223, 2, 0, 393224, 2, 0, 393225, 2, 0, 393226, 2, 0, 393227, 2, 0, 393228, 2, 0 )
tile_data = PoolIntArray( -393230, 1610612741, 65539, -393229, 1610612741, 3, -393228, 1610612741, 3, -393227, 1610612741, 3, -393226, 1610612741, 3, -393225, 1610612741, 3, -393224, 1610612741, 3, -393223, 1610612741, 3, -393222, 1610612741, 3, -393221, 1610612741, 3, -393220, 1610612741, 3, -393219, 1610612741, 3, -393218, 1610612741, 3, -393217, 1610612741, 3, -458752, 1610612741, 3, -458751, 1610612741, 3, -458750, 1610612741, 3, -458749, 1610612741, 3, -458748, 1610612741, 3, -458747, 1610612741, 3, -458746, 1610612741, 3, -458745, 1610612741, 3, -458744, 1610612741, 3, -458743, 1610612741, 3, -458742, 1610612741, 3, -458741, 1610612741, 3, -458740, 1610612741, 3, -458739, 1610612741, 3, -458738, 1610612741, 3, -458737, 1610612741, 3, -458736, 1610612741, 3, -458735, 1610612741, 3, -458734, 1610612741, 3, -458733, 1610612741, 65538, -327694, 5, 7, -393197, 5, 6, -262158, 5, 7, -327661, 5, 6, -196622, 5, 7, -262125, 5, 6, -131086, 5, 7, -196589, 5, 6, -65550, 5, 7, -131053, 5, 6, -14, 5, 7, -65517, 5, 6, 65522, 5, 7, 19, 5, 6, 131058, 5, 7, 65555, 5, 6, 196594, 5, 7, 131091, 5, 6, 262130, 5, 7, 196627, 5, 6, 327666, 5, 7, 262163, 5, 6, 393202, 5, 7, 327699, 5, 6, 458738, 5, 7, 393235, 5, 6, 524274, 5, 65538, 524275, 5, 2, 524276, 5, 2, 524277, 5, 2, 524278, 5, 2, 524279, 5, 2, 524280, 5, 2, 524281, 5, 2, 524282, 5, 2, 524283, 5, 2, 524284, 5, 2, 524285, 5, 2, 524286, 5, 2, 524287, 5, 2, 458752, 5, 2, 458753, 5, 2, 458754, 5, 2, 458755, 5, 2, 458756, 5, 2, 458757, 5, 2, 458758, 5, 2, 458759, 5, 2, 458760, 5, 2, 458761, 5, 2, 458762, 5, 2, 458763, 5, 2, 458764, 5, 2, 458765, 5, 2, 458766, 5, 2, 458767, 5, 2, 458768, 5, 2, 458769, 5, 2, 458770, 5, 2, 458771, 5, 65539 )
[node name="DropThroughPlatforms" type="TileMap" parent="."]
tile_set = ExtResource( 6 )
cell_size = Vector2( 16, 16 )
format = 1
[node name="PlatformPlants" type="TileMap" parent="."]
tile_set = SubResource( 5 )
cell_size = Vector2( 16, 16 )
format = 1
[node name="Portal" parent="." instance=ExtResource( 5 )]
position = Vector2( 288, 120 )
position = Vector2( 288, 96 )
next_scene = "res://src/Levels/Actual Level 1.tscn"
[connection signal="body_exited" from="Blobby/BlobbySkin" to="Blobby" method="_on_BlobbySkin_body_exited"]

View File

@ -5,7 +5,7 @@
[ext_resource path="res://src/UserInterface/Buttons/RetryButton.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/UserInterface/Screens/InGameMenu/PauseScreen.gd" type="Script" id=5]
[ext_resource path="res://src/UserInterface/Screens/InGameMenu/Continue.gd" type="Script" id=6]
[ext_resource path="res://src/transparency.gdshader" type="Shader" id=7]
[ext_resource path="res://assets/effects/transparency.gdshader" type="Shader" id=7]
[ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/ReallyQuitMenu.gd" type="Script" id=8]
[ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/ActionKeyList.gd" type="Script" id=9]
[ext_resource path="res://src/UserInterface/Screens/InGameMenu/ControlsMenuIngame.gd" type="Script" id=10]

View File

@ -16,7 +16,7 @@
[ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/ActionKeyList.gd" type="Script" id=14]
[ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/InputMapper.gd" type="Script" id=15]
[ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/Reset.gd" type="Script" id=16]
[ext_resource path="res://src/transparency.gdshader" type="Shader" id=17]
[ext_resource path="res://assets/effects/transparency.gdshader" type="Shader" id=17]
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=18]
[ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=19]