SaverLoader base
This commit is contained in:
parent
ad7cb69355
commit
d4acde846c
4 changed files with 50 additions and 2 deletions
|
@ -87,7 +87,7 @@ func _physics_process(delta):
|
|||
|
||||
if Input.is_action_pressed("fire_missile") and fireBulletTimer.time_left == 0 and PlayerStats.missiles > 0 and PlayerStats.missiles_unlocked:
|
||||
fire_missile()
|
||||
|
||||
|
||||
func fire_bullet():
|
||||
var bullet = Utils.instance_scene_on_main(PlayerBullet, muzzle.global_position)
|
||||
bullet.velocity = Vector2.RIGHT.rotated(playerGun.rotation) * bullet_speed
|
||||
|
@ -233,6 +233,15 @@ func wall_detach(delta, wall_axis):
|
|||
if wall_axis == 0 or is_on_floor():
|
||||
state = MOVE
|
||||
|
||||
func save():
|
||||
var data = {
|
||||
"filename": get_filename(),
|
||||
"parent": get_parent().get_path(),
|
||||
"position_x": position.x,
|
||||
"position_y": position.y
|
||||
}
|
||||
return data
|
||||
|
||||
func _on_Hurtbox_hit(damage):
|
||||
if not invincible:
|
||||
PlayerStats.health -= damage
|
||||
|
|
|
@ -122,7 +122,9 @@ tracks/1/keys = {
|
|||
} ]
|
||||
}
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
[node name="Player" type="KinematicBody2D" groups=[
|
||||
"Persists",
|
||||
]]
|
||||
collision_mask = 2
|
||||
script = ExtResource( 2 )
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue