SetOnGenSpriteModifierSub


SetOnGenSpriteModifierSub sprite, onSpriteModifier()

Sets the on sprite modifier subroutine for the specified sprite. Once set, the specified onSpriteModifier() subroutine will be automatically called when sprite effects complete.

This particular event sub is the key to really good special effects. When you have a special effect in mind, like an explosion, you should break the effect down into a series of effects.



include "Game Engine Constants.inc"

'...Turn on the game engine and init a sprite...

SetOnGenSpriteModifierSub sprite, onSpriteModifier()

GenGrowSprite sprite, 1.5, 1.5, 5000

'...continue with program...

Sub onSpriteModifier(sprite, type)

if type = Mod_Grow_Complete then

GenSetSpriteRed sprite, rnd(100)
GenSetSpriteGreen sprite, rnd(100)
GenSetspriteBlue sprite, rnd(100)

endif

End Sub


sprite

The Game Engine sprite object. This is the sprite that triggered the event sub.


type

This event sub is triggered by several different sprite effect events. The type parameter tells you what effect triggered the sub call.

From the Game Engine Constants.inc file. This include file is located in the global include directory and may be used by any Basic program.

' Modifier event sub types
Const Mod_TimerA = 1
Const Mod_TimerB = 2
Const Mod_Fade_Complete = 3
Const Mod_Grow_Complete = 4
Const Mod_Spin_Loop = 5
Const Mod_Spin_Complete = 6
Const Mod_Rotate_Complete = 7
Const Mod_Move_Complete = 8

SetOnGenSpriteModifierSub sprite, Off

Turns off the automatic subroutine call.


GenSetSpriteTimerA


GenSetSpriteTimerB


GenFadeSprite


GenGrowSprite


GenSpinSprite


GenRotateSprite


GenRotateSpriteTo


GenMoveSprite


GenMoveSpriteX


GenMoveSpriteY


GenMoveSpriteXY


GenMoveSpriteToX


GenMoveSpriteToY


GenMoveSpriteToXY


Game Engine Events


Event Triggered Subs






Become a Patron