feat: Option for frog to jump in narrow pits
If this is enabled the frog will jump into pits in which he will slide along the wall when he falls. This causes the frog to always jump directly against a wall before it considers jumping ontop of it. So it's slightly dumber.
This commit is contained in:
parent
499928b096
commit
8cf677677f
@ -19,6 +19,7 @@ export var vision_distance := 6.0
|
||||
export var vision_angle := 180.0
|
||||
export var attack_jump_range := 6.0
|
||||
export var aggressive_to_player := false
|
||||
export var jump_into_narrow_pit := false
|
||||
export var loose_target_seconds := 3.0
|
||||
# Jump distance in blocks
|
||||
export var default_jump_distance := 4.0
|
||||
@ -344,6 +345,8 @@ func jump():
|
||||
# TODO fix that you could call jump from jumping on top
|
||||
# and let it fail if the top is dangerous for jump height or not safe
|
||||
v = consider_jumping_on_top()
|
||||
if v == zero_vector && jump_into_narrow_pit:
|
||||
v = consider_jump_landing_space(v, jump_into_narrow_pit)
|
||||
if v == zero_vector && can_reverse_facing_direction():
|
||||
reverse_facing_direction()
|
||||
|
||||
@ -398,7 +401,7 @@ func consider_jump_headspace(v: Vector2, recursive_check_count = 0, max_checks =
|
||||
# Check the block in jump distance for danger or height
|
||||
# If danger check neighboring blocks: if still danger, then jump closer (or jump over)
|
||||
# If height move to distance which allows 1 block high jump
|
||||
func consider_jump_landing_space(v: Vector2) -> Vector2:
|
||||
func consider_jump_landing_space(v: Vector2, jump_into_narrow_pit = false) -> Vector2:
|
||||
var jump_distance = calculate_jump_distance(v)
|
||||
var jump_height = calculate_jump_height(v)
|
||||
var collider = check_feeler(Vector2(jump_distance * get_facing_direction(), -jump_height / 2))
|
||||
@ -417,7 +420,7 @@ func consider_jump_landing_space(v: Vector2) -> Vector2:
|
||||
v = correct_jump_direction(v)
|
||||
collider = check_feeler(Vector2(jump_distance * get_facing_direction(), -jump_height / 2))
|
||||
if (
|
||||
(!is_jump_path_safe(v, global_position) || collider != null)
|
||||
(!is_jump_path_safe(v, global_position) || (collider != null && !jump_into_narrow_pit))
|
||||
&& can_reverse_facing_direction()
|
||||
):
|
||||
# Can be printed when frog would jump into a wall too
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=50 format=2]
|
||||
[gd_scene load_steps=52 format=2]
|
||||
|
||||
[ext_resource path="res://assets/enemy/froshler.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/Actors/Friendlies/WhatAreFrog.gd" type="Script" id=2]
|
||||
@ -8,6 +8,38 @@
|
||||
[ext_resource path="res://assets/enemy/leash-hook.png" type="Texture" id=6]
|
||||
[ext_resource path="res://src/Utilities/SceneAudio.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="Shader" id=61]
|
||||
code = "shader_type canvas_item;
|
||||
uniform float wavelength = 10.0;
|
||||
uniform float wavespeed = 1.0;
|
||||
uniform float alpha = 0.25;
|
||||
uniform float displacement = 0.0;
|
||||
uniform float displacement_speed = 1.0;
|
||||
|
||||
uniform sampler2D noise_texture;
|
||||
uniform sampler2D noise_displacement_texture;
|
||||
uniform sampler2D gradiant;
|
||||
|
||||
void vertex()
|
||||
{
|
||||
vec3 perlin = texture(noise_displacement_texture, UV + (TIME * displacement_speed)).rgb;
|
||||
VERTEX = VERTEX + (perlin * displacement);
|
||||
}
|
||||
|
||||
|
||||
void fragment()
|
||||
{
|
||||
vec3 perlin = texture(noise_texture, UV).rgb;
|
||||
float ndotp = dot(VIEW, perlin) * wavelength;
|
||||
float waves = (1.0 + sin(ndotp + TIME * wavespeed)) / 2.0;
|
||||
vec4 color = texture(gradiant, vec2(waves, 0.5));
|
||||
ALBEDO = color.rgb;
|
||||
ALPHA = min(color.a, alpha);
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=62]
|
||||
shader = SubResource( 61 )
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
@ -479,6 +511,7 @@ texture = ExtResource( 6 )
|
||||
|
||||
[node name="FrogSprite" type="Sprite" parent="."]
|
||||
unique_name_in_owner = true
|
||||
material = SubResource( 62 )
|
||||
position = Vector2( 0, -7 )
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 2
|
||||
|
||||
@ -1146,6 +1146,9 @@ initial_wait_time = 2.0
|
||||
[node name="Button" parent="Tutorials/RightTut" index="0"]
|
||||
material = SubResource( 13 )
|
||||
|
||||
[node name="Label" parent="Tutorials/RightTut/TextureRect" index="0"]
|
||||
autowrap = false
|
||||
|
||||
[node name="AnimationPlayer" parent="Tutorials/RightTut" index="4"]
|
||||
anims/RESET = SubResource( 9 )
|
||||
anims/cease_4_exist = SubResource( 10 )
|
||||
@ -1326,7 +1329,7 @@ position = Vector2( -70, 1 )
|
||||
scale = Vector2( 0.878906, 0.936025 )
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 7
|
||||
frame = 8
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 33 )
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -41,12 +41,12 @@ resource_name = "LowPassFilter"
|
||||
cutoff_hz = 3000.0
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = -6.93575
|
||||
bus/0/volume_db = inf_neg
|
||||
bus/1/name = "Music"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = false
|
||||
bus/1/bypass_fx = false
|
||||
bus/1/volume_db = -6.0206
|
||||
bus/1/volume_db = 0.0
|
||||
bus/1/send = "Master"
|
||||
bus/1/effect/0/effect = SubResource( 1 )
|
||||
bus/1/effect/0/enabled = false
|
||||
@ -68,7 +68,7 @@ bus/3/name = "UI"
|
||||
bus/3/solo = false
|
||||
bus/3/mute = false
|
||||
bus/3/bypass_fx = false
|
||||
bus/3/volume_db = -6.0206
|
||||
bus/3/volume_db = 0.0
|
||||
bus/3/send = "Master"
|
||||
bus/3/effect/0/effect = SubResource( 6 )
|
||||
bus/3/effect/0/enabled = true
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
extends StateMachine
|
||||
|
||||
func _ready() -> void:
|
||||
add_state("robbing")
|
||||
state = states.robbing
|
||||
set_state(states.robbing)
|
||||
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()
|
||||
|
||||
add_state("robbing")
|
||||
state = states.robbing
|
||||
set_state(states.robbing)
|
||||
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):
|
||||
return null
|
||||
return null
|
||||
|
||||
|
||||
func _enter_state(_new_state, _previous_state):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
func _exit_state(_previous_state, _new_state):
|
||||
pass
|
||||
pass
|
||||
|
||||
2
src/ThirdParty/Demo/IridescenceBall.tscn
vendored
2
src/ThirdParty/Demo/IridescenceBall.tscn
vendored
@ -12,7 +12,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3 )
|
||||
far = 150.0
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1.0, -0.00767937, 0, 0.00767937, 1.0, 0, 0, 0, 1, 0, 0, 0 )
|
||||
transform = Transform( 1, -0.00767937, 0, 0.00767937, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = ExtResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
@ -7,28 +7,28 @@ var focus_player
|
||||
var press_player
|
||||
|
||||
func _ready() -> void:
|
||||
focus_player = AudioStreamPlayer.new()
|
||||
focus_player.bus = "UI"
|
||||
var asrp = AudioStreamRandomPitch.new()
|
||||
asrp.audio_stream = GlobalState.sound_library[focus_sound]
|
||||
focus_player.stream = asrp
|
||||
#focus_player.volume_db = 5
|
||||
add_child(focus_player)
|
||||
connect("focus_exited", self, "focus_play")
|
||||
focus_player = AudioStreamPlayer.new()
|
||||
focus_player.bus = "UI"
|
||||
var asrp = AudioStreamRandomPitch.new()
|
||||
asrp.audio_stream = GlobalState.sound_library[focus_sound]
|
||||
focus_player.stream = asrp
|
||||
#focus_player.volume_db = 5
|
||||
add_child(focus_player)
|
||||
connect("focus_exited", self, "focus_play")
|
||||
|
||||
press_player = AudioStreamPlayer.new()
|
||||
press_player.bus = "UI"
|
||||
var asrp2 = AudioStreamRandomPitch.new()
|
||||
asrp2.audio_stream = GlobalState.sound_library[press_sound]
|
||||
press_player.stream = asrp2
|
||||
#press_player.volume_db = 5
|
||||
add_child(press_player)
|
||||
connect("button_down", self, "press_play")
|
||||
press_player = AudioStreamPlayer.new()
|
||||
press_player.bus = "UI"
|
||||
var asrp2 = AudioStreamRandomPitch.new()
|
||||
asrp2.audio_stream = GlobalState.sound_library[press_sound]
|
||||
press_player.stream = asrp2
|
||||
#press_player.volume_db = 5
|
||||
add_child(press_player)
|
||||
connect("button_down", self, "press_play")
|
||||
|
||||
func focus_play():
|
||||
if visible:
|
||||
focus_player.play()
|
||||
if visible:
|
||||
focus_player.play()
|
||||
|
||||
func press_play():
|
||||
if visible:
|
||||
press_player.play()
|
||||
if visible:
|
||||
press_player.play()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user