ajouts d'objectifs sur la carte, déplacements des icônes et divers changements
This commit is contained in:
@@ -2,7 +2,7 @@ extends InspectableEntity
|
||||
class_name Plant
|
||||
|
||||
const PLANT_AREA_WIDTH = 20
|
||||
const HARVESTED_SEED_POSITION_RANGE = 100
|
||||
const HARVESTED_SEED_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
const RANDOM_MAX_GROW_INTERVAL = Planet.PASS_DAY_ANIMATION_TIME/2. - 0.1
|
||||
|
||||
@@ -88,24 +88,12 @@ func harvest():
|
||||
var seed_plant_type : PlantType = plant_type
|
||||
if len(plant_type.harvest_types_path):
|
||||
seed_plant_type = load(plant_type.harvest_types_path.pick_random())
|
||||
loot_seed(seed_plant_type)
|
||||
planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
global_position,
|
||||
HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
plant_sprite.start_harvest_animation()
|
||||
await plant_sprite.harvest_animation_finished
|
||||
queue_free()
|
||||
|
||||
func loot_seed(type : PlantType):
|
||||
var item_object = planet.drop_item(
|
||||
Seed.new(type),
|
||||
global_position
|
||||
)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
Vector2(
|
||||
item_object.position.x + randi()%HARVESTED_SEED_POSITION_RANGE,
|
||||
item_object.position.y + randi()%HARVESTED_SEED_POSITION_RANGE
|
||||
),
|
||||
0.2
|
||||
)
|
||||
|
||||
@@ -5,7 +5,11 @@ class_name ProduceSeedsEffect
|
||||
@export var produce_number : Array[int] = [1]
|
||||
|
||||
func effect(plant):
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.loot_seed(seed_plant_type)
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
@@ -14,4 +14,4 @@ class_name PlantType
|
||||
@export var cyclic_effect : PlantEffect
|
||||
|
||||
@export_file var harvest_types_path : Array[String] = []
|
||||
@export var harvest_number : Array[int] = [1,2]
|
||||
@export var harvest_number : Array[int] = [1,2]
|
||||
Reference in New Issue
Block a user