ZombieRangedModel
Model implementation for Ranged Zombies, a type of zombie that was never implemented.
ZombieRangedModel
Extends CharacterModel.
Properties
| Property | Type | Description |
|---|---|---|
healthBar | HealthBar | The health bar attachment. |
base | SpriteEntity | The base sprite of the ranged zombie. |
weapon | SpriteEntity | The bow sprite currently wielded by the ranged zombie. |
Methods
constructor()
ts
function constructor(): voidInitializes the model. Creates the healthBar with the specific color { r: 184, g: 70, b: 20 }, sets its position and scales it to 0.6. Adds the health bar at layer 0.
update()
ts
function update(dt: number, user: any): voidUpdates the model every frame. If the base sprite is not yet initialized, it calls updateModel to construct the zombie visually. Afterwards, it calls super.update(dt, user).
updateModel()
ts
function updateModel(tick: ENTITY_DATA, networkEntity: NetworkEntity): voidConstructs the ranged zombie's visual components based on tick.model.
- Parses the model string (e.g.,
ZombieRangedGreenTierX) to extract the tier. - Initializes the
basesprite corresponding to the parsed tier. - Initializes the
weaponsprite (a bow) and attaches an additionalbowHandssprite to it. - Assigns the
weaponUpdateFuncusingupdateBowWeapon(). - Adds the
weaponat layer1and thebaseat layer2.