mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-14 22:32:24 +02:00
Minor Cleanup
- Renamed SoundController - Cleaned up spacings - File endings
This commit is contained in:
@@ -14,19 +14,23 @@ var totaldamage := 0.0
|
||||
|
||||
var rollvector = Vector2.ZERO
|
||||
|
||||
|
||||
func _debug_update():
|
||||
debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n"
|
||||
|
||||
|
||||
func _ready():
|
||||
grid = get_tree().current_scene.get_node("Grid")
|
||||
|
||||
|
||||
# IMPORTANT: If you are using move_and_slide don't multiply by delta
|
||||
# Godots physics system does that internally
|
||||
# In move_and_collide(...) you have to multiply by delta.
|
||||
# In move_and_collide(...) you have to multiply by delta.
|
||||
func move():
|
||||
move_and_slide(velocity)
|
||||
_animate(velocity)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
totaldamage += damage_per_second * delta
|
||||
player_stats.speed += 10 * delta
|
||||
@@ -37,7 +41,7 @@ func _physics_process(delta):
|
||||
totaldamage += 1
|
||||
player_stats.health += 1
|
||||
_debug_update()
|
||||
|
||||
|
||||
run(Vector2.ZERO, delta)
|
||||
makeMove(delta)
|
||||
move()
|
||||
@@ -54,18 +58,20 @@ func _on_Hurtbox_area_entered(area):
|
||||
|
||||
func _on_Hurtbox_area_exited(area):
|
||||
damage_per_second -= area.damage
|
||||
|
||||
|
||||
|
||||
# API Interface for ai_hero
|
||||
func run(direction, delta):
|
||||
direction = direction.normalized()
|
||||
rollvector = direction
|
||||
velocity = velocity.move_toward(player_stats.speed * rollvector, ACCELERATION * delta)
|
||||
|
||||
|
||||
if direction == Vector2.ZERO:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
func _animate(vec):
|
||||
match get_nearest_diretion(vec):
|
||||
"up":
|
||||
@@ -80,8 +86,6 @@ func _animate(vec):
|
||||
"left":
|
||||
$Sprite.flip_h=true
|
||||
$Sprite.play("right")
|
||||
|
||||
|
||||
|
||||
|
||||
func get_nearest_diretion(vec):
|
||||
|
||||
Reference in New Issue
Block a user