Skip to content

Fixed Commenting and Player Speed Issues #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/characters/ghost.atlastex
Binary file not shown.
31 changes: 2 additions & 29 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,8 @@ animations/join_default="res://addons/dialogic/Modules/Character/DefaultAnimatio
animations/leave_default="res://addons/dialogic/Modules/Character/DefaultAnimations/instant_in_or_out.gd"
text/autocolor_names=true
settings/text_speed=1.0
directories/dch_directory={
"enemy_ghost": "res://maps/town/enemy_ghost.dch",
"fan_of_four": "res://maps/town/fan_of_four.dch",
"ghost": "res://maps/grove/ghost.dch",
"monk": "res://maps/town/monk.dch",
"runner": "res://maps/town/runner.dch",
"smith": "res://maps/town/smith.dch",
"thief": "res://maps/town/thief.dch",
"warrior": "res://maps/town/warrior.dch",
"wizard": "res://maps/town/wizard.dch"
}
directories/dtl_directory={
"encounter_before_combat": "res://maps/town/encounter_before_combat.dtl",
"encounter_on_loss": "res://maps/town/encounter_on_loss.dtl",
"encounter_on_victory": "res://maps/town/encounter_on_victory.dtl",
"fan_of_four": "res://maps/town/fan_of_four.dtl",
"ghost": "res://maps/grove/ghost.dtl",
"monk": "res://maps/town/monk.dtl",
"opening_cutscene": "res://maps/opening_cutscene.dtl",
"runner": "res://maps/town/runner.dtl",
"sign": "res://maps/town/sign.dtl",
"smith": "res://maps/town/smith.dtl",
"strange_tree": "res://maps/town/strange_tree.dtl",
"thief": "res://maps/town/thief.dtl",
"wand_pedestal": "res://maps/house/wand_pedestal.dtl",
"wand_pedestal_occupied": "res://maps/house/wand_pedestal_occupied.dtl",
"warrior": "res://maps/town/warrior.dtl",
"wizard": "res://maps/town/wizard.dtl"
}
directories/dch_directory={}
directories/dtl_directory={}
text/initial_text_reveal_skippable=true
text/text_reveal_skip_delay=0.05
text/autoadvance_per_character_delay=0.1
Expand Down
4 changes: 3 additions & 1 deletion src/field/cutscenes/popups/interaction_popup.gd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ func _ready() -> void:
if not Engine.is_editor_hint():
FieldEvents.input_paused.connect(_on_input_paused)


## The areas are designed to ensure the player is
## 1. Inside the area, and
## 2. The necessary animations are loaded.
func _on_area_entered(_entered_area: Area2D) -> void:
_is_shown = true

Expand Down
1 change: 1 addition & 0 deletions src/field/gamepieces/animation/gamepiece_animation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func _on_gamepiece_arrived() -> void:


func _on_gamepiece_direction_changed(new_direction: Vector2) -> void:
# The line "is_equal_approx(Vector2.ZERO)" makes sure the new direction is not Vector2.ZERO
if not new_direction.is_equal_approx(Vector2.ZERO):
var direction_value: = Directions.angle_to_direction(new_direction.angle())
set_direction(direction_value)
Expand Down
41 changes: 20 additions & 21 deletions src/field/gamepieces/gamepiece.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## [br][br][b]Note:[/b] The [code]gameboard[/code] is considered to be the playable area on which a
## Gamepiece may be placed. The gameboard is made up of cells, each of which may be occupied by one
## or more gamepieces.
@icon("res://assets/editor/icons/Gamepiece.svg")
@icon("res://assets/editor/icons/Gamepiece.svg") #Makes editor icon player piece
class_name Gamepiece extends Node2D

## Emitted when the gamepiece begins to travel towards a destination cell.
Expand Down Expand Up @@ -38,6 +38,8 @@ signal direction_changed(new_direction: Vector2)

## The [Gameboard] object used to tie the gamepiece to the gameboard. A gamepiece without a valid
## gameboard reference will produce errors, stopping the program.
## We use set() to make sure the gameboard is correct when the variable is changed. This property is described in the
## documentation here: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#properties-setters-and-getters
@export var gameboard: Gameboard:
set(value):
gameboard = value
Expand Down Expand Up @@ -66,17 +68,29 @@ signal direction_changed(new_direction: Vector2)
## derive their position from this follower and, consequently, appear to move smoothly.
## See [member camera_anchor] and [member gfx_anchor].
var cell: = Vector2i.ZERO:
set = set_cell
set(value):
if Engine.is_editor_hint():
return

var old_cell: = cell
cell = value

if not is_inside_tree():
await ready

position = gameboard.cell_to_pixel(cell)
cell_changed.emit(old_cell)

## The [code]direction[/code] is a unit vector that points where the gamepiece is 'looking'.
## In the event that the gamepiece is moving along a path, direction is updated automatically as
## long as the gamepiece continues to move.
## long as the gamepiece continues to move. Vector2.DOWN is considered the default value for the gameobject
## to look down.
var direction: = Vector2.DOWN:
set(value):
value = value.normalized()
if not direction.is_equal_approx(value):
direction = value
direction_changed.emit(direction)
#Piece movement works without if condition (editor's note)
direction = value
direction_changed.emit(direction)

## A camera may smoothly follow a travelling gamepiece by receiving the camera_anchor's transform.
@onready var camera_anchor: = $Decoupler/Path2D/PathFollow2D/CameraAnchor as RemoteTransform2D
Expand Down Expand Up @@ -214,20 +228,5 @@ func reset_travel() -> void:
func is_moving() -> bool:
return is_physics_processing()


func set_cell(value: Vector2i) -> void:
if Engine.is_editor_hint():
return

var old_cell: = cell
cell = value

if not is_inside_tree():
await ready

position = gameboard.cell_to_pixel(cell)
cell_changed.emit(old_cell)


func get_faced_cell() -> Vector2i:
return (Vector2(cell) + direction).round()
1 change: 0 additions & 1 deletion src/main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ y_sort_enabled = true
position = Vector2(24, 200)
gameboard = ExtResource("6_kd8tv")
blocks_movement = true
move_speed = 96.0
metadata/_edit_group_ = true

[node name="GoBotGFX" parent="Field/Terrain/Gamepieces/Player" instance=ExtResource("12_oablq")]
Expand Down