GEN003 More Text Effects


The real power of the Game Engine effects comes from chaining effects together. This example builds on the GEN002 Text Effects.bas example. Instead of the text just spinning and shrinking, this example has the text oscillating between big and small while the text colors are always fading to a new random color.


Here is the text modifier event sub from the example.


' The following Event Sub is automatically triggered
' by a text effect event.
Sub onTextModifier(text, type)
  if type = Mod_Grow_Complete then
    if GenGetTextScale(text) < 1 then
      GenGrowText text, 2.0, 2000 + rnd(4000)
    else
      GenGrowText text, 0.1, 2000 + rnd(4000)
    endif
    GenFadeText text, 50 + rnd(50), 50 + rnd(50), 50 + rnd(50), 100, 2000 + rnd(4000)
  endif
End Sub

Every time a text grow effect completes this event sub is called. If the text scale is less than one the text is made to grow, otherwise it is made to shrink. On every grow event complete the text color is made to fade to a new color.

How to override the action of the back button is also demonstrated in this example.


' Override the back button so the program will
' exit without a message box when the back
' button is pressed
SetOnBackButtonSub onBack()

' The Back Button event sub override
' Just exit
Sub onBack()
  exit
End Sub

Download Source




Game Engine Overview


Game Engine Tutorial


Event Triggered Subs






Become a Patron