Verse Library verse

02 Board Verse

UE device defining board dimensions, validating tile coordinates against bounds, and managing pawn placement for gameplay.

extracted-snippets/documentation/en-us/fortnite/8-complete-code-files-for-coordinate-battle/02-board-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/8-complete-code-files-for-coordinate-battle
# Local doc:  epic-docs/documentation/en-us/fortnite/8-complete-code-files-for-coordinate-battle.md
# Section:    board.verse
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 }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
board<public> := class(creative_device):
<# Variable Fields #>
@editable
Bounds<public>:board_bounds = board_bounds{}
@editable
TileSize<public>:vector2 = vector2{}
@editable
PawnStaticMesh:mesh = Meshes.SM_Box
@editable
NumberOfPawns:int = 5
var<private> Pawns:[]creative_prop = array{}
<# Function Fields - Utilities #>
GetDimensions<public>()<transacts>:vector3 =
vector3:
Y := -1.0 * (Bounds.LeftBounds.High - Bounds.LeftBounds.Low)
X := 1.0 * (Bounds.ForwardBounds.High - Bounds.ForwardBounds.Low)
GetTileCoordinate<public>(Pawn:creative_prop)<decides><transacts>:tile_coordinate =
PawnWorldTransform := Pawn.GetTransform()

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