Dev pour la beta 1.4
* Changements de la texture des cristaux de Talion dans tous les assets 3D pour correspondre aux assets 2D * Ajout d'un évenement en fin de région, une résurgence de Talion qui décontamine et fait looter les plantes mature aux alentours * Ajout d'un path finding sur le mouvement du robot * Modification du flow des actions à la souris : ajout d'un nouveau son, d'un icône à l'emplacement de l'action * Modification du nombre et de l'ordre de mutation débloquées * Augmentation de la valeur maximale de zoom * Modification des scores à atteindre dans les premières régions * Modification de l'interface du vaisseau, laissant apparaitre une roadmap plus claire, et laissant inspecter l'inventaire actuel * Modification de l'icône d'action dans les scènes 3D * Augmentation de la zone d'écart entre les plantes, et augmentation du taux de zone fertile en conséquence * La station de recharge devient inutilisable après la fin de la région * Ajout d'une transparence lors de la sélection d'objets derrières d'autres objets * Les plantes juvéniles donneront toujours une graine si coupées * Ajout d'un bouclage sur les couleurs des mutations * Fix des hitbox des plantes pour l'inspection à la souris * Fix de plusieurs bugs sur la manipulation de l'inventaire * Ajout de nombreux screenshots d'utilisation des outils lors du tutoriel * Amélioration mineure de la traduction/wording
This commit is contained in:
@@ -5,6 +5,7 @@ const ACTION_AREA_UPDATE_TIME=0.05 # When creating an action_zone, we make sure
|
||||
const MAX_REACH = 100
|
||||
const HOLDING_ITEM_SPRITE_SIZE = 20.
|
||||
const TURN_ANIMATION_MINIMUM_THRESHOLD = 0.2
|
||||
const SPEED = 350
|
||||
|
||||
signal player_updated(player: Player)
|
||||
signal upgraded
|
||||
@@ -12,7 +13,6 @@ signal upgraded
|
||||
var terrain : Terrain
|
||||
var region : Region :
|
||||
get(): return terrain if terrain is Region else null
|
||||
@export var speed = 350
|
||||
|
||||
var data : PlayerData
|
||||
var last_action_area_movement_timer : float = 100.
|
||||
@@ -22,7 +22,13 @@ var controlling_player : bool = false :
|
||||
controlling_player = v
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
var instruction : Instruction = null
|
||||
var instruction : Instruction = null :
|
||||
set(i):
|
||||
if instruction and is_node_ready():
|
||||
instruction.abort(self)
|
||||
instruction = i
|
||||
if instruction and is_node_ready():
|
||||
instruction.spawn_indicator(self)
|
||||
|
||||
@onready var preview_zone : ActionZone = await setup_action_zone(Vector2.ZERO, null)
|
||||
@onready var action_zone : ActionZone = await setup_action_zone(Vector2.ZERO, null)
|
||||
@@ -81,7 +87,7 @@ func _process(delta):
|
||||
instruction = null
|
||||
input_direction = calculate_direction_instruction_direction()
|
||||
|
||||
velocity = input_direction * speed
|
||||
velocity = input_direction * SPEED
|
||||
turn_animate(input_direction)
|
||||
|
||||
move_preview_zone(get_global_mouse_position())
|
||||
@@ -106,8 +112,11 @@ func calculate_direction_instruction_direction() -> Vector2:
|
||||
instruction.position.distance_to(global_position) > (MAX_REACH - 1.)
|
||||
or instruction is MoveInstruction
|
||||
)
|
||||
):
|
||||
return self.global_position.direction_to(instruction.position)
|
||||
):
|
||||
if %NavigationAgent2D.target_position != instruction.position:
|
||||
%NavigationAgent2D.target_position = instruction.position
|
||||
return to_local(%NavigationAgent2D.get_next_path_position()).normalized()
|
||||
# return self.global_position.direction_to(instruction.position)
|
||||
return Vector2.ZERO
|
||||
|
||||
func calculate_direction_input_direction() -> Vector2:
|
||||
@@ -147,8 +156,8 @@ func try_interact(interactable : Interactable):
|
||||
func try_move(move_to : Vector2):
|
||||
instruction = MoveInstruction.new(move_to)
|
||||
|
||||
func can_pick_item(item: Item):
|
||||
return item.type == Item.ItemType.TOOL_ITEM || !data.inventory.is_full() || !data.inventory.current_is_tool()
|
||||
func can_pick_item(_item: Item):
|
||||
return true
|
||||
|
||||
func pick_item(item : Item):
|
||||
if item.type != Item.ItemType.TOOL_ITEM && data.inventory.is_full():
|
||||
@@ -163,13 +172,23 @@ func pick_item(item : Item):
|
||||
|
||||
func drop_item():
|
||||
var ind_to_drop := data.inventory.current_item_ind
|
||||
while (
|
||||
(data.inventory.get_item(ind_to_drop) == null or ind_to_drop < len(data.inventory.tools))
|
||||
and ind_to_drop < len(data.inventory.get_all_items()) - 1
|
||||
|
||||
if (
|
||||
data.inventory.get_item(ind_to_drop) == null or ind_to_drop < len(data.inventory.tools)
|
||||
):
|
||||
ind_to_drop += 1
|
||||
var item_to_drop = data.inventory.pop_item(ind_to_drop)
|
||||
if item_to_drop:
|
||||
var possible_ind : Array = range(
|
||||
len(data.inventory.tools),
|
||||
len(data.inventory.tools) + data.inventory.seeds_size
|
||||
).filter(
|
||||
func (i): return data.inventory.get_item(i) != null
|
||||
)
|
||||
if len(possible_ind):
|
||||
ind_to_drop = possible_ind.pop_back()
|
||||
else:
|
||||
return
|
||||
|
||||
var item_to_drop : Item = data.inventory.pop_item(ind_to_drop)
|
||||
if item_to_drop and item_to_drop.type != Item.ItemType.TOOL_ITEM:
|
||||
terrain.drop_item(item_to_drop, global_position)
|
||||
AudioManager.play_sfx("Drop")
|
||||
region.save()
|
||||
@@ -239,11 +258,10 @@ func setup_preview_zone(item : Item):
|
||||
return preview_zone
|
||||
elif preview_zone:
|
||||
preview_zone.destroy()
|
||||
preview_zone = null
|
||||
|
||||
if item:
|
||||
preview_zone = await generate_action_zone(item)
|
||||
else:
|
||||
preview_zone = null
|
||||
|
||||
func setup_action_zone(zone_position : Vector2, item: Item) -> ActionZone:
|
||||
if action_zone:
|
||||
@@ -259,8 +277,11 @@ func move_preview_zone(zone_position : Vector2):
|
||||
|
||||
class Instruction:
|
||||
|
||||
const INDICATOR_COLOR := Color("#96B3DB")
|
||||
|
||||
var position : Vector2
|
||||
var need_movement : bool = true
|
||||
var indicator := Sprite2D.new()
|
||||
|
||||
func _init(_pos : Vector2):
|
||||
position = _pos
|
||||
@@ -270,8 +291,46 @@ class Instruction:
|
||||
|
||||
func do(_player : Player):
|
||||
pass
|
||||
|
||||
func indicator_texture():
|
||||
return preload("res://common/icons/map-pin.svg")
|
||||
|
||||
func indicator_size():
|
||||
return 40
|
||||
|
||||
func indicator_shift():
|
||||
return Vector2.ZERO
|
||||
|
||||
func spawn_indicator(player : Player):
|
||||
indicator.texture = indicator_texture()
|
||||
|
||||
indicator.texture = indicator_texture()
|
||||
indicator.scale = Vector2(
|
||||
1./(float(indicator_texture().get_width())/indicator_size()),
|
||||
1./(float(indicator_texture().get_height())/indicator_size())
|
||||
)
|
||||
|
||||
indicator.modulate = Color(
|
||||
INDICATOR_COLOR.r,
|
||||
INDICATOR_COLOR.g,
|
||||
INDICATOR_COLOR.b,
|
||||
0.
|
||||
)
|
||||
|
||||
player.get_parent().add_child(indicator)
|
||||
|
||||
indicator.global_position = position + indicator_shift()
|
||||
|
||||
player.get_tree().create_tween().tween_property(indicator, "modulate:a", 0.8, 0.2)
|
||||
|
||||
func abort(player : Player):
|
||||
indicator.queue_free()
|
||||
|
||||
class MoveInstruction extends Instruction:
|
||||
|
||||
func indicator_shift():
|
||||
return Vector2.UP * 50
|
||||
|
||||
func can_be_done(player : Player):
|
||||
return player.global_position.distance_to(position) < 10.
|
||||
|
||||
@@ -289,7 +348,10 @@ class ItemActionInstruction extends Instruction:
|
||||
not item.is_usage_need_proximity() or
|
||||
player.global_position.distance_to(position) < player.MAX_REACH
|
||||
)
|
||||
|
||||
|
||||
func indicator_texture():
|
||||
return item.icon
|
||||
|
||||
func do(player : Player):
|
||||
player.use_item(item)
|
||||
|
||||
@@ -303,13 +365,16 @@ class InteractableInstruction extends Instruction:
|
||||
func can_be_done(player : Player):
|
||||
return player.global_position.distance_to(position) < player.MAX_REACH
|
||||
|
||||
func indicator_texture():
|
||||
return preload("res://common/icons/hand-grab.svg")
|
||||
|
||||
func do(player : Player):
|
||||
interactable.interact(player)
|
||||
|
||||
class ActionZone:
|
||||
var item : Item = null
|
||||
var area : Area2D = Area2D.new()
|
||||
var affected_areas : Array[InspectableEntity]= []
|
||||
var affected_areas : Array[Area2D]= []
|
||||
|
||||
func _init(_i : Item):
|
||||
item = _i
|
||||
@@ -330,9 +395,9 @@ class ActionZone:
|
||||
func update_preview_on_affected_area():
|
||||
var detected_areas = get_affected_areas()
|
||||
clear_preview_on_affected_area()
|
||||
var new_affected_areas : Array[InspectableEntity] = []
|
||||
var new_affected_areas : Array[Area2D] = []
|
||||
for a in detected_areas:
|
||||
if a is InspectableEntity and item.get_usage_object_affected(a):
|
||||
if a is Area2D and item.get_usage_object_affected(a) and a.has_method("affect_preview"):
|
||||
a.affect_preview(true)
|
||||
new_affected_areas.append(a)
|
||||
affected_areas = new_affected_areas
|
||||
|
||||
Reference in New Issue
Block a user