Verse Library verse

05 Files

Defines board coordinate classes and utility functions for generating random tile positions.

extracted-snippets/documentation/en-us/fortnite/4-generate-the-board/05-files.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/4-generate-the-board
# Local doc:  epic-docs/documentation/en-us/fortnite/4-generate-the-board.md
# Section:    Files
using { /Verse.org/Simulation }
using { /Verse.org/Random }
DataTypes<public> := module:
tile_coordinate<public> := class<concrete>:
@editable
Left<public>:int = 0
@editable
Forward<public>:int = 0
bounds<public> := class<concrete>:
@editable
Low<public>:int = 0
@editable
High<public>:int = 0
board_bounds<public> := class<concrete>:
@editable
LeftBounds<public>:bounds = bounds{}
@editable
ForwardBounds<public>:bounds = bounds{}
UtilityFunctions<public> := module:
AreTileCoordinatesEqual<public>(LeftTileCoordinate:tile_coordinate, RightTileCoordinate:tile_coordinate)<decides><transacts>:void =
LeftTileCoordinate.Left = RightTileCoordinate.Left
LeftTileCoordinate.Right = RightTileCoordinate.Right
GenerateUniformRandomTileCoordinate<public>(BoardBounds:board_bounds)<transacts>:tile_coordinate =
tile_coordinate:
Left := GetRandomInt(BoardBounds.LeftBounds.Low, BoardBounds.LeftBounds.High)
Forward := GetRandomInt(BoardBounds.ForwardBounds.Low, BoardBounds.ForwardBounds.High)
NumberOfTileCoordinates<public>(BoardBounds:board_bounds)<transacts>:int =

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