Created
May 19, 2023 02:28
-
-
Save rootVIII/5cde91f86430754fbbdcb6ab4ac0afae to your computer and use it in GitHub Desktop.
Verse Class Inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using { /Fortnite.com/Devices } | |
using { /Verse.org/Simulation } | |
using { /UnrealEngine.com/Temporary/Diagnostics } | |
using { /UnrealEngine.com/Temporary/SpatialMath } | |
pawn := class(): | |
var TotalHP<private> : int = 100 | |
var CurrentHP<private> : int = 100 | |
TakeDamage<public>(DamagePoints : int): void = | |
set CurrentHP -=DamagePoints | |
Heal<public>(HealPoints : int): void = | |
set CurrentHP += HealPoints | |
IsAlive<public>()<decides>: void = | |
if (CurrentHP > 0): | |
true | |
else: | |
false | |
platform := class(pawn): | |
PlatformProp : creative_prop = creative_prop{} | |
StartingPos : vector3 = vector3{} | |
EndingPos : vector3 = vector3{} | |
Move<public>()<suspends>: void = | |
loop: | |
if (not PlatformProp.IsValid[]): | |
break | |
PlatformProp.MoveTo(EndingPos, IdentityRotation(), 5.0) | |
if (not PlatformProp.IsValid[]): | |
break | |
PlatformProp.MoveTo(StartingPos, IdentityRotation(), 5.0) | |
lesson_08 := class(creative_device): | |
@editable PlatformAsset : creative_prop_asset = DefaultCreativePropAsset | |
var Platforms : []platform = array{} | |
InitPlatforms<public>(): void = | |
for (Index := 1..20): | |
Start := vector3{X:=Index * 500.0, Y := Index * 500.0, Z := 300.0} | |
End := vector3{X:=Index * 3000.0, Y := Index * 3000.0, Z := 300.0} | |
if (SpawnedProp := SpawnProp(PlatformAsset, Start, IdentityRotation())(0)?): | |
Platform := platform{PlatformProp:=SpawnedProp, StartingPos:=Start, EndingPos:=Start} | |
set Platforms += array{Platform} | |
MoveAllPlatforms<public>(): void = | |
for (Platform : Platforms): | |
spawn: | |
Platform.Move() | |
OnBegin<override>()<suspends>: void = | |
SomePawn := pawn{} | |
SomePawn.TakeDamage(10) | |
NewPlatform := platform{} | |
NewPlatform.TakeDamage(10) | |
InitPlatforms() | |
MoveAllPlatforms() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment