Active Vines now apply statusses
This commit is contained in:
parent
786444e789
commit
c33d892cf0
4 changed files with 11 additions and 4 deletions
|
|
@ -76,6 +76,7 @@ func _ready() -> void:
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
manage_velocity(delta)
|
manage_velocity(delta)
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
update_vine_statuses()
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
manage_iframes(delta)
|
manage_iframes(delta)
|
||||||
|
|
@ -214,4 +215,5 @@ func play_double_jump_animation() -> void:
|
||||||
func update_vine_statuses():
|
func update_vine_statuses():
|
||||||
var location = Grid.get_location_from_world_pos(global_position)
|
var location = Grid.get_location_from_world_pos(global_position)
|
||||||
for vine : Vine in Grid.vines_per_node[location.x][location.y]:
|
for vine : Vine in Grid.vines_per_node[location.x][location.y]:
|
||||||
Status.apply(vine.status_name, self, 0.1, vine.status_params)
|
if vine.active_depth > 0: #TODO: Properly manage procedural activation
|
||||||
|
Status.apply(vine.status_name, self, 0.1, vine.status_params)
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,13 @@ static func get_status(status_name : String, target : Node) -> Status:
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
timeout.connect(expire)
|
timeout.connect(expire)
|
||||||
|
|
||||||
func reapply(duration_new : float):
|
func reapply(duration_new : float, params_new : Dictionary = {}):
|
||||||
self.start(max(duration_new, time_left))
|
self.start(max(duration_new, time_left))
|
||||||
|
merge_params(params_new)
|
||||||
|
|
||||||
|
func merge_params(params_new):
|
||||||
|
if name == "Slow":
|
||||||
|
params.slow_factor = min(params.slow_factor, params_new.slow_factor)
|
||||||
|
|
||||||
func expire():
|
func expire():
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ class_name Vine extends Node2D
|
||||||
@export var bud_resource : PackedScene
|
@export var bud_resource : PackedScene
|
||||||
var img_path_inactive = "res://vines_petals/vine_inactive.png"
|
var img_path_inactive = "res://vines_petals/vine_inactive.png"
|
||||||
@export var img_path_active = "res://vines_petals/vine_active_green.png"
|
@export var img_path_active = "res://vines_petals/vine_active_green.png"
|
||||||
@export var status_name : String
|
@export var status_name : String = "Slow"
|
||||||
@export var status_params : Dictionary = {}
|
@export var status_params : Dictionary = {}
|
||||||
var active_depth = -1
|
var active_depth = -1
|
||||||
var fully_active = false
|
var fully_active = false
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func get_world_position (location: Vector2, offset: Vector2 = Vector2.ZERO) -> V
|
||||||
|
|
||||||
func get_location_from_world_pos(pos : Vector2):
|
func get_location_from_world_pos(pos : Vector2):
|
||||||
var angle = pos.angle()
|
var angle = pos.angle()
|
||||||
var x = floor(num_collumns * angle / TAU)
|
var x = floor(num_collumns * fposmod(angle, TAU) / TAU)
|
||||||
var height = pos.length()
|
var height = pos.length()
|
||||||
var y = ceil((height - ground_radius)/cell_height)
|
var y = ceil((height - ground_radius)/cell_height)
|
||||||
return Vector2(x, y)
|
return Vector2(x, y)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue