fix post-proto
* ajout d'un fondu de musique au changement de phase * résolution de bugs en tout genre
This commit is contained in:
@@ -54,9 +54,12 @@ func pointer_text() -> String:
|
||||
return plant_type.name
|
||||
|
||||
func inspect(is_inspected : bool = true):
|
||||
modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
||||
plant_sprite.modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
||||
influence_zone.show_influence = is_inspected
|
||||
|
||||
func affect_preview(is_affected : bool = true):
|
||||
plant_sprite.modulate = MODULATE_AFFECTED_COLOR if is_affected else default_modulate
|
||||
|
||||
func generate_sprite() -> PlantSprite:
|
||||
var sprite_object : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func _ready():
|
||||
sprite.radius = 100
|
||||
sprite.fill = false
|
||||
sprite.width = 1
|
||||
sprite.opacity = 0.2
|
||||
sprite.opacity = 0.5
|
||||
sprite.visible = show_influence
|
||||
add_child(sprite)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ static func get_rarity_text(rarity) -> String:
|
||||
if rarity < len(rarity_text):
|
||||
return rarity_text[rarity]
|
||||
else :
|
||||
return rarity_text[len(rarity_text) - 1] + " " + str(rarity - len(rarity_text) + 2)
|
||||
return rarity_text[len(rarity_text) - 1]
|
||||
|
||||
static func get_rarity_color(rarity : int) -> Color:
|
||||
var rarity_colors : Array[Color] = [
|
||||
|
||||
@@ -19,7 +19,6 @@ func mutate_score(plant_state : Plant.State, plant : Plant, score) -> int:
|
||||
if plant_state != Plant.State.MATURE:
|
||||
return score
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant and area != plant and area.plant_type.name == plant.plant_type.name:
|
||||
plant_count += 1
|
||||
|
||||
@@ -11,7 +11,7 @@ func get_mutation_name() -> String:
|
||||
return tr("STRONG")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("STRONG_EFFECT_TEXT_LEVEL_%d") % roundi(get_score_multiplier() * 100)
|
||||
return tr("STRONG_EFFECT_TEXT_LEVEL_%d") % [roundi(get_score_multiplier() * 100)]
|
||||
|
||||
func get_score_multiplier():
|
||||
return float(level)/2.
|
||||
|
||||
@@ -26,7 +26,7 @@ func get_icon() -> Texture2D:
|
||||
|
||||
func use_text() -> String:
|
||||
if machine_type:
|
||||
return tr("BUILD_%s") % machine_type.name
|
||||
return tr("BUILD_%s") % tr(machine_type.name)
|
||||
return ""
|
||||
|
||||
func is_one_time_use():
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends CharacterBody2D
|
||||
class_name Player
|
||||
|
||||
const ACTION_AREA_UPDATE_TIME=0.05 # When creating an action_zone, we make sure that the area setup correctly by waiting a little
|
||||
const MAX_REACH = 100
|
||||
const HOLDING_ITEM_SPRITE_SIZE = 20.
|
||||
|
||||
@@ -12,9 +13,8 @@ var planet : Planet :
|
||||
get(): return terrain if terrain is Planet else null
|
||||
@export var speed = 350
|
||||
|
||||
var has_just_received_instruction : bool = false # pour récupérer les zones dans les action_area, une frame doit être passée depuis la création de la zone
|
||||
|
||||
var data : PlayerData
|
||||
var last_action_area_movement_timer : float = 100.
|
||||
|
||||
var controlling_player : bool = true :
|
||||
set(v):
|
||||
@@ -54,18 +54,20 @@ func _pass_day():
|
||||
func _end_pass_day():
|
||||
controlling_player = true
|
||||
|
||||
func _process(_delta):
|
||||
func _process(delta):
|
||||
last_action_area_movement_timer += delta
|
||||
if controlling_player:
|
||||
var old_velocity=velocity
|
||||
calculate_direction()
|
||||
|
||||
if instruction and instruction.can_be_done(self) and not has_just_received_instruction:
|
||||
if (
|
||||
last_action_area_movement_timer >= ACTION_AREA_UPDATE_TIME
|
||||
and instruction and instruction.can_be_done(self)
|
||||
):
|
||||
instruction.do(self)
|
||||
instruction = null
|
||||
move_preview_zone(get_global_mouse_position())
|
||||
|
||||
has_just_received_instruction = false
|
||||
|
||||
# Sound
|
||||
if old_velocity.length()==0 and velocity.length()!=0:
|
||||
play_sfx("move")
|
||||
@@ -94,7 +96,7 @@ func calculate_direction():
|
||||
if input_direction.length() != 0:
|
||||
instruction = null
|
||||
|
||||
if instruction:
|
||||
if instruction and instruction.position.distance_to(global_position) > (MAX_REACH - 1.):
|
||||
input_direction = self.global_position.direction_to(instruction.position)
|
||||
|
||||
velocity = input_direction * speed
|
||||
@@ -112,7 +114,6 @@ func can_interact(interactable : Interactable):
|
||||
|
||||
func try_interact(interactable : Interactable):
|
||||
if interactable:
|
||||
has_just_received_instruction = true
|
||||
instruction = InteractableInstruction.new(
|
||||
interactable
|
||||
)
|
||||
@@ -148,7 +149,6 @@ func delete_item(item: Item):
|
||||
data.inventory.remove_item(item)
|
||||
|
||||
func try_use_item(item : Item, use_position : Vector2):
|
||||
has_just_received_instruction = true
|
||||
setup_action_zone(use_position, item)
|
||||
instruction = ItemActionInstruction.new(
|
||||
use_position,
|
||||
@@ -224,6 +224,7 @@ func setup_action_zone(zone_position : Vector2, item: Item) -> ActionZone:
|
||||
action_zone.destroy()
|
||||
action_zone = generate_action_zone(item)
|
||||
action_zone.move_to_position(zone_position)
|
||||
last_action_area_movement_timer = 0.
|
||||
return action_zone
|
||||
|
||||
func move_preview_zone(zone_position : Vector2):
|
||||
@@ -251,7 +252,7 @@ class Instruction:
|
||||
position = _pos
|
||||
|
||||
func can_be_done(player : Player):
|
||||
return player.global_position.distance_to(position) < 10
|
||||
return player.global_position.distance_to(position) < player.MAX_REACH
|
||||
|
||||
func do(_player : Player):
|
||||
pass
|
||||
@@ -267,7 +268,9 @@ class ItemActionInstruction extends Instruction:
|
||||
item = _item
|
||||
|
||||
func can_be_done(player : Player):
|
||||
return player.global_position.distance_to(position) < player.MAX_REACH
|
||||
return (
|
||||
player.global_position.distance_to(position) < player.MAX_REACH
|
||||
)
|
||||
|
||||
func do(player : Player):
|
||||
player.use_item(item)
|
||||
|
||||
Reference in New Issue
Block a user