Verse Library verse

12 Files

Validates tile positions against board boundaries and calculates their world coordinates.

extracted-snippets/documentation/en-us/fortnite/2-define-the-game-board/12-files.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/2-define-the-game-board
# Local doc:  epic-docs/documentation/en-us/fortnite/2-define-the-game-board.md
# Section:    Files
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Assets }
using { DataTypes }
using { UtilityFunctions }
board<public> := class(creative_device):
@editable
Bounds<public>:board_bounds = board_bounds{}
@editable
TileSize<public>:vector2 = vector2{}
# tile_coordinate within board_bounds
IsTileCoordinateOnBoard<public>(TileCoordinate:tile_coordinate)<decides><transacts>:void =
Bounds.LeftBounds.Low <= TileCoordinate.Left <= Bounds.LeftBounds.High
Bounds.ForwardBounds.Low <= TileCoordinate.Forward <= Bounds.ForwardBounds.High
# tile_coordinate -> vector3
ToVector3<public>(TileLocation:tile_coordinate)<decides><transacts>:vector3 =
IsTileCoordinateOnBoard[TileLocation]
BoardTransform:transform = GetTransform()
CenterOfBoard:vector3 = BoardTransform.Translation
TileOffsetFromCenter:vector3 = vector3:
X := (TileLocation.Forward * TileSize.X)
Y := (-TileLocation.Left * TileSize.Y)
Z := 0.0
CenterOfBoard + TileOffsetFromCenter
# vector3 -> tile_coordinate

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in