Mintoris Forum

Author Topic: GEN002 Text Effects  (Read 1230 times)


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
GEN002 Text Effects
« on: Jul 12, 2016, 11:14 PM »
This example builds on the "Hello World" example. The program attached below shows how to do some special effects on the text. The text is made to spin and shrink (grow smaller).

Code: [Select]
' Set the text to twice normal size
GenSetTextScale text, 2.0

' Give the text a 45 degree per second spin
GenSpinText text, 45

' Make the text grow smaller over 4 secs
GenGrowText text, 0.1, 4000

An event sub is used to detect when the text has shrunk to 0.1.

Code: [Select]
' Set an event sub to trigger when grow smaller completes
SetOnGenTextModifierSub text, growDone()

The event sub then exits the program when the grow event completes. The Type Constants are found in the "Game Engine" file in the global include dir.

Code: [Select]
Sub growDone(text, type)
  if type = Mod_Grow_Complete then
End Sub

You should take advantage of the Event Subs whenever possible. Event subs offer a tremendous speed advantage over looping and polling for an event. The main loop of the best game programs will look something like this.

Code: [Select]
' Loop until the growDone() sub is triggered
  wait 1000
« Last Edit: Jul 12, 2016, 11:25 PM by Chuck »