sandbox
Last change
on this file since 25e7b67 was 25e7b67, checked in by Kevin Chapman <victory2b@…>, 3 years ago |
Got Food item to increase player stats by 10 when walking into the food space.
|
-
Property mode
set to
100644
|
File size:
557 bytes
|
Rev | Line | |
---|
[49e3bfa] | 1 | extends Spatial
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | var is_ready = true
|
---|
[25e7b67] | 5 | var Food = 10
|
---|
[49e3bfa] | 6 |
|
---|
| 7 | func _ready():
|
---|
| 8 |
|
---|
| 9 | # Get the area for the trigger, and assign it's body_entered signal to trigger_body_entered
|
---|
| 10 | $Holder/Food_Pickup_Trigger.connect("body_entered", self, "trigger_body_entered")
|
---|
| 11 |
|
---|
| 12 | # Now we can use all of our setget functions.
|
---|
| 13 | is_ready = true
|
---|
| 14 |
|
---|
| 15 | func _physics_process(delta):
|
---|
| 16 | $AnimationFood.playback_speed = 4
|
---|
[25e7b67] | 17 |
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | func trigger_body_entered(body):
|
---|
| 21 | if Globals.lifeforce != 100:
|
---|
| 22 | Globals.lifeforce += Food
|
---|
| 23 | if Globals.lifeforce >= 100:
|
---|
| 24 | Globals.lifeforce = 100
|
---|
| 25 | Globals.food_task = true
|
---|
Note:
See
TracBrowser
for help on using the repository browser.