Health
This article is a stub. You can help us improve PlayBasic Wiki Complete by expanding it.

Health is the stat that represents the amount of life a game object has, or how much damage a game object can take.

Heath Basics

The health of a game object is usually stored in an integer (whole number) variable that is a part of the Type that defines the game object.

SetFPS 60

Type Obj
    health
EndType

Dim gameObject As Obj

gameObject.health = 100

Do
    Cls 0
        Print "Health :" + Str$(gameObject.health)
    Sync
Loop

Starting Health

The starting heath of a game object is given to the object in a PSub which sets up the game object.

SetFPS 60

Type Obj
    health
EndType

Dim gameObject As Obj

PSub startObj()
    gameObject.health = 100
EndPSub

startObj()

Do
    Cls 0
        Print "Health :" + Str$(gameObject.health)
    Sync
Loop

This is done so that you can call the

Draw | Display Health

Health Bar

Damage

Losing Health

Related Pages

Backlinks

These pages link back to this page. You may find them helpful.

page tags: damage health life stat