LD56 is over. This is the game.
This commit is contained in:
19
entities/resources/collectable_resource.gd
Normal file
19
entities/resources/collectable_resource.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
class_name CollectableResource extends StaticBody3D
|
||||
|
||||
enum ResourceType {FOOD, STONE, WOOD}
|
||||
@export var type:ResourceType
|
||||
|
||||
var capacity := 100
|
||||
|
||||
func collect(amount:int)->int:
|
||||
if capacity > amount:
|
||||
capacity -= amount
|
||||
return amount
|
||||
else:
|
||||
var remains := capacity
|
||||
capacity = 0
|
||||
return remains
|
||||
|
||||
func _on_tick() -> void:
|
||||
if capacity < 100: return
|
||||
capacity += 1
|
||||
Reference in New Issue
Block a user