Skip to content
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
6 changes: 3 additions & 3 deletions SampleProject/Game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func _input(event: InputEvent) -> void:
top_draw.queue_redraw()

# Assigns the initial offset when the map is opened. It centers on the player position.
func update_offset():
func update_offset() -> void:
offset = MetSys.get_current_flat_coords() - SIZE / 2
# Player position node needs to be moved accordingly.
player_location.offset = -Vector2(offset) * MetSys.CELL_SIZE
Expand All @@ -105,7 +105,7 @@ func update_offset():
# Update all cells of MapView to reflect the current state.
map_view.update_all()

func reset_starting_coords():
func reset_starting_coords() -> void:
# Starting position for the delta vector.
var coords := MetSys.get_current_flat_coords()
starting_coords = Vector2i(coords.x, coords.y)
Expand All @@ -126,7 +126,7 @@ func _notification(what: int) -> void:
if what == NOTIFICATION_VISIBILITY_CHANGED:
update()

func update():
func update() -> void:
# Only update when visible.
if is_visible_in_tree():
# Show the percentage.
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Maps/DiceRoom.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func _on_body_entered(body: Node2D) -> void:
%Gate.enabled = false

# The thread method for generating maps. The algorithm is simple: pick random cell and direction and make an adjacent cell if it doesn't exist.
func generate_map():
func generate_map() -> void:
# Gets rid of errors. This method is thread-safe, trust me.
Thread.set_thread_safety_checks_enabled(false)
# The grid of generated cells. The key is cell coordinates relative to the first generated cell, the value is a bitmask of exits.
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Maps/Junction.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var exits: int
var has_collectible: bool

# Remove the walls and collectible, based on the config values.
func apply_config():
func apply_config() -> void:
for i in 4:
%TileMap.get_child(i + 2).enabled = not bool(exits & 1 << i)

Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Maps/LeftStaircase.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extends Node
# Gate layer index.
@export var layer: int

func open():
func open() -> void:
# Disable the Gate layer.
%Gate.enabled = false
"
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Objects/CollectionGridItem.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script/source = "extends TextureRect
# ID of the tracked object.
@export var id: String

func update_collectible():
func update_collectible() -> void:
# Become visible if the tracked object was stored (collected).
self_modulate.a = float(MetSys.is_object_id_stored(id))
"
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Objects/Elevator.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func _physics_process(delta: float) -> void:
$Label.hide()

# Called after being transported to the target room.
func enter():
func enter() -> void:
# Set initial position of the elevator.
if up:
position.y = -64
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Objects/MiniPortal.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func _on_body_entered(body: Node2D) -> void:
Game.get_singleton().load_room(target_map)

# Needs to be static, because the old portal disappears before the new scene is loaded.
static func move_to_portal():
static func move_to_portal() -> void:
var map := Game.get_singleton().map
# Get the portal node.
var portal: Node2D = map.get_node(^\"MiniPortal\")
Expand Down
2 changes: 1 addition & 1 deletion SampleProject/Objects/Pipe.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func _ready() -> void:
add_point(current_point)
set_process(false)
# Manually progresses the water (used to initialize pipes).
func flow(delta: float):
func flow(delta: float) -> void:
_process(delta / FLOW_SPEED)

func _process(delta: float) -> void:
Expand Down
4 changes: 2 additions & 2 deletions SampleProject/Scripts/CustomElements.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func _init() -> void:
# Some text that displays on the map.
register_element("label", draw_label)

func draw_elevator(canvas_item: RID, coords: Vector3i, pos: Vector2, size: Vector2, data: String):
func draw_elevator(canvas_item: RID, coords: Vector3i, pos: Vector2, size: Vector2, data: String) -> void:
# For elevator to display, both top and bottom cell must be discovered.
if not MetSys.is_cell_discovered(coords + Vector3i(0, -1, 0)) and not MetSys.is_cell_discovered(coords + Vector3i(0, size.y, 0)):
return
Expand All @@ -19,7 +19,7 @@ func draw_elevator(canvas_item: RID, coords: Vector3i, pos: Vector2, size: Vecto
pos + Vector2(MetSys.CELL_SIZE.x * 0.5 - elevator_texture.get_width() * 0.5, 0),
Vector2(elevator_texture.get_width(), size.y)), true, MetSys.settings.theme.default_border_color)

func draw_label(canvas_item: RID, coords: Vector3i, pos: Vector2, size: Vector2, data: String):
func draw_label(canvas_item: RID, coords: Vector3i, pos: Vector2, size: Vector2, data: String) -> void:
# The label is only visible if it's cell is discovered.
if not MetSys.is_cell_discovered(coords):
return
Expand Down
6 changes: 3 additions & 3 deletions SampleProject/Scripts/Game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static func get_singleton() -> Game:
return (Game as Script).get_meta(&"singleton") as Game

# Save game using MetSys SaveManager.
func save_game():
func save_game() -> void:
var save_manager := SaveManager.new()
save_manager.set_value("collectible_count", collectibles)
save_manager.set_value("generated_rooms", generated_rooms)
Expand All @@ -84,10 +84,10 @@ func save_game():
save_manager.set_value("abilities", player.abilities)
save_manager.save_as_text(SAVE_PATH)

func reset_map_starting_coords():
func reset_map_starting_coords() -> void:
$UI/MapWindow.reset_starting_coords()

func init_room():
func init_room() -> void:
MetSys.get_current_room_instance().adjust_camera_limits($Player/Camera2D)
player.on_enter()

Expand Down
6 changes: 3 additions & 3 deletions SampleProject/Scripts/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func _physics_process(delta: float) -> void:
prev_on_floor = is_on_floor()
move_and_slide()

var new_animation = &"Idle"
var new_animation := &"Idle"
if velocity.y < 0:
new_animation = &"Jump"
elif velocity.y >= 0 and not is_on_floor():
Expand All @@ -83,11 +83,11 @@ func _physics_process(delta: float) -> void:
elif velocity.x < -1:
$Sprite2D.flip_h = true

func kill():
func kill() -> void:
# Player dies, reset the position to the entrance.
position = reset_position
Game.get_singleton().load_room(MetSys.get_current_room_id())

func on_enter():
func on_enter() -> void:
# Position for kill system. Assigned when entering new room (see Game.gd).
reset_position = position