forked from interstellar_development/freeftf
Milestone 3: Freezer
The freezer is now implemented, just as it worked in the original. There are also a few fixes here and there in preparation for Milestonr 4.
This commit is contained in:
parent
d40c3ce1ab
commit
a92202b536
14 changed files with 199 additions and 114 deletions
30
scripts/freezer.gd
Normal file
30
scripts/freezer.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
extends StaticBody3D
|
||||
|
||||
var trapped_body
|
||||
var occupied = false
|
||||
var living = true
|
||||
|
||||
func _process(delta):
|
||||
if occupied:
|
||||
trapped_body.position = position
|
||||
if occupied and trapped_body.hp == 0:
|
||||
living = false
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body is StaticBody3D:
|
||||
pass
|
||||
elif body.beast and body.got_person and !occupied:
|
||||
trapped_body = body.caught_body
|
||||
occupied = true
|
||||
living = true
|
||||
body.lost_one()
|
||||
trapped_body.frozen()
|
||||
elif !body.beast and occupied and living and body != trapped_body:
|
||||
trapped_body.unfreeze()
|
||||
trapped_body._on_time_in_bag_timeout()
|
||||
occupied = false
|
||||
trapped_body = null
|
||||
|
||||
func _on_timer_timeout():
|
||||
if occupied and living:
|
||||
trapped_body.hp -= 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue