Skip to content

Commit

Permalink
added respawn button
Browse files Browse the repository at this point in the history
  • Loading branch information
LordCthulhu123 committed Jan 22, 2019
1 parent b01e66a commit 50f6df7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ up=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","de
down=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
]
Respawn=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null)
]

[rendering]

Expand Down
10 changes: 8 additions & 2 deletions scripts/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ const JUMP_HEIGHT = -750
const NORMAL = Vector2(0, -1)
var motion = Vector2() #var que modifica pos X e Y
var tempo_de_recarga = 0.5
var vivo = 1
onready var anim = get_node("anim") #var que vai guardar animacao do player

func _ready():
add_to_group(metadados.GRUPO_PLAYER)
pass

func _physics_process(delta):
_move(delta)
if vivo == 1 :
_move(delta)
else:
if Input.is_action_pressed("Respawn"):
get_tree().reload_current_scene()
pass

func _move(delta):
Expand Down Expand Up @@ -97,5 +102,6 @@ func dano_ao_player(dano_do_inimigo):
emit_signal("hp_change", hp )
if hp <= 0 :
emit_signal("dead", true)
queue_free()
vivo = 0
get_node("Sprite").visible = false
pass

0 comments on commit 50f6df7

Please sign in to comment.