Module: PseudoGame.game.DeathEffect
Class to create the blinking hexagonal death effects around a player
Functions
PseudoGame.game.DeathEffect:new (player) | the constructor for a death effect | |
PseudoGame.game.DeathEffect:death () |
this function causes the death effect ot be shown permanently (should be called in onDeath )
make sure to update and draw the death effect in onRenderStage as the other functions aren't called after death
|
|
PseudoGame.game.DeathEffect:invincible_death () |
this function shows the death effect for a moment (should be called in onPreDeath )
|
|
PseudoGame.game.DeathEffect:update (frametime) | update the death effects shape and color | |
PseudoGame.game.DeathEffect:ensure_tickrate (render_stage, frametime, draw_function) | ensures that a function is called 240 times per second in onRenderStage after death (does nothing if the death method wasn't called) (only works if shaders are loaded, but that is usually the case when using this function as there's no need for a fake death effect if the player isn't hidden) |
Fields
pseudogame.game.deatheffect.polygon_collection | ||
pseudogame.game.deatheffect.player_hue | ||
pseudogame.game.deatheffect.dead | ||
pseudogame.game.deatheffect.timer | ||
pseudogame.game.deatheffect.player |
Functions
- 🔗 PseudoGame.game.DeathEffect:new (player)
-
the constructor for a death effect
Parameters:
Name Type(s) Description player Player the player the death effect is for Returns:
- 🔗 PseudoGame.game.DeathEffect:death ()
-
this function causes the death effect ot be shown permanently (should be called in
onDeath
) make sure to update and draw the death effect in onRenderStage as the other functions aren't called after death - 🔗 PseudoGame.game.DeathEffect:invincible_death ()
-
this function shows the death effect for a moment (should be called in
onPreDeath
) - 🔗 PseudoGame.game.DeathEffect:update (frametime)
-
update the death effects shape and color
Parameters:
Name Type(s) Description frametime number the time in 1/60s that passed since the last call to this function - 🔗 PseudoGame.game.DeathEffect:ensure_tickrate (render_stage, frametime, draw_function)
-
ensures that a function is called 240 times per second in onRenderStage after death (does nothing if the death method wasn't called)
(only works if shaders are loaded, but that is usually the case when using this function as there's no need for a fake death effect if the player isn't hidden)
Parameters:
Name Type(s) Description render_stage number the render stage that onRenderStage is being called for frametime number the inconsistent frametime that onRenderStage gets as second parameter draw_function function a function that will be called 240 times per second (should contain your drawing logic so the death effect can be drawn)
Fields
- 🔗 pseudogame.game.deatheffect.polygon_collection
-
Name Type(s) Description polygon_collection PolygonCollection The collection of polygons representing the visual death effect (use this for drawing) - 🔗 pseudogame.game.deatheffect.player_hue
-
Name Type(s) Description player_hue number The hue the player and the death effect currently have - 🔗 pseudogame.game.deatheffect.dead
-
Name Type(s) Description dead bool True if the player has died - 🔗 pseudogame.game.deatheffect.timer
-
Name Type(s) Description timer number The time the death effect is going to be shown for in invincible mode (counts down and stops showing the death effect once it reaches 0) - 🔗 pseudogame.game.deatheffect.player
-
Name Type(s) Description player Player The player the death effect is for