Compare commits
2 Commits
34a8273063
...
a4662f2797
| Author | SHA1 | Date | |
|---|---|---|---|
| a4662f2797 | |||
| 6a0e7c6ca7 |
@@ -33,6 +33,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
|
||||
func is_usage_need_proximity() -> bool:
|
||||
return true
|
||||
|
||||
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
||||
return false
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 0
|
||||
|
||||
func is_usage_need_proximity() -> bool:
|
||||
return false
|
||||
|
||||
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ func get_description() -> String:
|
||||
return tr("SHIP_TELEPORT_DESC_TEXT")
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return preload("res://common/icons/chevrons-up.svg")
|
||||
return preload("res://common/icons/rocket.svg")
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return 0
|
||||
@@ -19,6 +19,9 @@ func get_energy_used() -> int:
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 0
|
||||
|
||||
func is_usage_need_proximity() -> bool:
|
||||
return false
|
||||
|
||||
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@ func _end_pass_day():
|
||||
func _process(delta):
|
||||
last_action_area_movement_timer += delta
|
||||
if controlling_player:
|
||||
calculate_direction()
|
||||
|
||||
var input_direction : Vector2 = calculate_direction_input_direction()
|
||||
|
||||
if (
|
||||
last_action_area_movement_timer >= ACTION_AREA_UPDATE_TIME
|
||||
@@ -67,6 +68,15 @@ func _process(delta):
|
||||
):
|
||||
instruction.do(self)
|
||||
instruction = null
|
||||
|
||||
if instruction and instruction.need_movement:
|
||||
if input_direction.length() != 0:
|
||||
instruction = null
|
||||
input_direction = calculate_direction_instruction_direction()
|
||||
|
||||
velocity = input_direction * speed
|
||||
turn_animate(input_direction)
|
||||
|
||||
move_preview_zone(get_global_mouse_position())
|
||||
else:
|
||||
velocity = Vector2.ZERO
|
||||
@@ -76,12 +86,7 @@ func _on_inventory_updated(_inventory: Inventory):
|
||||
setup_preview_zone(data.inventory.get_item())
|
||||
emit_signal("player_updated", self)
|
||||
|
||||
func calculate_direction():
|
||||
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
|
||||
if input_direction.length() != 0:
|
||||
instruction = null
|
||||
|
||||
func calculate_direction_instruction_direction() -> Vector2:
|
||||
if (
|
||||
instruction
|
||||
and (
|
||||
@@ -89,11 +94,11 @@ func calculate_direction():
|
||||
or instruction is MoveInstruction
|
||||
)
|
||||
):
|
||||
input_direction = self.global_position.direction_to(instruction.position)
|
||||
return self.global_position.direction_to(instruction.position)
|
||||
return Vector2.ZERO
|
||||
|
||||
velocity = input_direction * speed
|
||||
|
||||
turn_animate(input_direction)
|
||||
func calculate_direction_input_direction() -> Vector2:
|
||||
return Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
|
||||
|
||||
func turn_animate(input_direction):
|
||||
@@ -243,6 +248,7 @@ func move_preview_zone(zone_position : Vector2):
|
||||
class Instruction:
|
||||
|
||||
var position : Vector2
|
||||
var need_movement : bool = true
|
||||
|
||||
func _init(_pos : Vector2):
|
||||
position = _pos
|
||||
@@ -259,14 +265,16 @@ class MoveInstruction extends Instruction:
|
||||
|
||||
|
||||
class ItemActionInstruction extends Instruction:
|
||||
var item = Item
|
||||
var item : Item
|
||||
|
||||
func _init(_pos : Vector2, _item : Item):
|
||||
position = _pos
|
||||
item = _item
|
||||
need_movement = item.is_usage_need_proximity()
|
||||
|
||||
func can_be_done(player : Player):
|
||||
return (
|
||||
not item.is_usage_need_proximity() or
|
||||
player.global_position.distance_to(position) < player.MAX_REACH
|
||||
)
|
||||
|
||||
@@ -274,7 +282,7 @@ class ItemActionInstruction extends Instruction:
|
||||
player.use_item(item)
|
||||
|
||||
class InteractableInstruction extends Instruction:
|
||||
var interactable = Interactable
|
||||
var interactable : Interactable
|
||||
|
||||
func _init(_interactable : Interactable):
|
||||
interactable = _interactable
|
||||
|
||||
@@ -131,7 +131,6 @@ func update_dashboard():
|
||||
dashboard.main_screen_icon = TAKE_OFF_ICON
|
||||
dashboard.main_screen_label = tr("TAKE_OFF")
|
||||
dashboard.main_screen_interactable = can_take_off
|
||||
dashboard.status_text = "" if can_take_off else tr("NOT_ENOUGH_ENEGY")
|
||||
|
||||
dashboard.left_destination = null
|
||||
dashboard.right_destination = null
|
||||
@@ -141,3 +140,5 @@ func update_dashboard():
|
||||
dashboard.destination_title_label = tr("LOCATION")
|
||||
dashboard.destination_label = current_region_data.region_name
|
||||
dashboard.destination_longitude = float(current_region_data.region_level) / RunData.RUN_POINT_MAX_LEVEL
|
||||
|
||||
dashboard.status_text = "" if can_take_off else tr("NO_MORE_ENERGY")
|
||||
|
||||
@@ -187,7 +187,7 @@ DESTINATION,Destination,Destination
|
||||
LOCATION,Location,Location
|
||||
LAND_SHIP,Land Ship,Atterrir
|
||||
TAKE_OFF,Take Off,Décoller
|
||||
NOT_ENOUGH_ENEGY,Not enough energy,Pas assez d'énergie
|
||||
NO_MORE_ENERGY,No more energy,Plus assez d'énergie
|
||||
CHOOSE_DESTINATION,Choose destination,Choisissez la destination
|
||||
THANKS_FOR_PLAYING,Thanks for playing to the demo!,Merci d’avoir joué à la démo !
|
||||
JOIN_OUR_INSTAGRAM,Join our Instagram,Rejoins-nous sur Instagram
|
||||
|
||||
|
Reference in New Issue
Block a user