4.6, new attack, enemy spawning, shaders, bunch of stuff
This commit is contained in:
parent
e08e3ebb13
commit
19517a3176
84 changed files with 13348 additions and 91399 deletions
|
|
@ -13,13 +13,19 @@ var mask_time_remaining := 15.0
|
|||
|
||||
var closest_mask_drop: MaskDrop
|
||||
var last_mask_drop : MaskDrop
|
||||
const INTERACT_DIST = 60.0
|
||||
const INTERACT_DIST = 100.0
|
||||
|
||||
var dead = false
|
||||
|
||||
func _ready() -> void:
|
||||
health_changed.connect(EventBus.health_changed.emit)
|
||||
health_changed.emit(health)
|
||||
equip_mask(current_mask_data)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
if Input.is_action_pressed("attack"):
|
||||
use_mask(get_global_mouse_position())
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if dead: return
|
||||
|
|
@ -49,6 +55,9 @@ func revive():
|
|||
dead = false
|
||||
visible = true
|
||||
|
||||
func damage(amount: int = 1) -> void:
|
||||
EventBus.player_dmg.emit()
|
||||
super.damage(amount)
|
||||
|
||||
func start_dash(dir: Vector2):
|
||||
dash_active = true
|
||||
|
|
@ -60,21 +69,25 @@ func start_dash(dir: Vector2):
|
|||
tween.tween_property(player_sprite, "scale:x", 1, 0.1)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("attack") and current_mask_data:
|
||||
use_mask(get_global_mouse_position())
|
||||
#if event.is_action_pressed("attack") and current_mask_data:
|
||||
#use_mask(get_global_mouse_position())
|
||||
|
||||
if event.is_action_pressed("interact") and closest_mask_drop:
|
||||
equip_mask(closest_mask_drop)
|
||||
collect_drop(closest_mask_drop)
|
||||
|
||||
func equip_mask(drop_node : MaskDrop):
|
||||
func equip_mask(mask_data : MaskData):
|
||||
current_mask_data = mask_data
|
||||
mask_sprite.texture = mask_data.texture
|
||||
EventBus.mask_changed.emit(mask_data.mask_name)
|
||||
|
||||
|
||||
func collect_drop(drop_node : MaskDrop):
|
||||
if drop_node.has_method("collect"):
|
||||
drop_node.collect(global_position)
|
||||
|
||||
current_mask_data = drop_node.mask_type
|
||||
mask_time_remaining = mask_start_time
|
||||
|
||||
mask_sprite.texture = current_mask_data.texture
|
||||
EventBus.mask_changed.emit(current_mask_data.mask_name)
|
||||
equip_mask(drop_node.mask_type)
|
||||
|
||||
func _handle_mask_durability(delta : float):
|
||||
if get_tree().get_node_count_in_group("enemy") > 0:
|
||||
|
|
@ -96,9 +109,10 @@ func _check_items():
|
|||
|
||||
if last_mask_drop and closest_mask_drop != last_mask_drop:
|
||||
last_mask_drop.hide_popup()
|
||||
last_mask_drop = closest_mask_drop
|
||||
|
||||
if closest_mask_drop:
|
||||
if min_dist < INTERACT_DIST:
|
||||
closest_mask_drop.show_popup()
|
||||
else:
|
||||
closest_mask_drop.hide_popup()
|
||||
last_mask_drop = closest_mask_drop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue