source: Studio/Food_Pickup.gd@ 25e7b67

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
Line 
1extends Spatial
2
3
4var is_ready = true
5var Food = 10
6
7func _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
15func _physics_process(delta):
16 $AnimationFood.playback_speed = 4
17
18
19
20func 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.