GOOC - Game Oriented Object C
GOOC - Game Oriented Object C
10.3. The trans Block
10.3. The trans Block
The trans block is one that runs continuously, every frame (before the execution of the code block). These are used for things like scaling a variable every frame.
A trans block does not have a list of parameters, but it can borrow the parameters from a previously-defined code block if the state has the __transargs modifier.
A trans block is defined like this:
trans pre-modifiers
{
subroutine-body
}
Note that pre-subroutine modifiers are the only type of modifiers that can be used.
trans blocks have certain constructs that only makes sense to apply for them. Such constructs include the once statement. This statement, everything after, including, and preceding its following block run only on the first execution of the trans block, after which the trans block pointer is moved to after the once statement. This is used to define variables that the state might use in the trans or code blocks, for example:
trans {
once {
var0 = 1S // we are going to be using this field so we define it right away
}
scalex = loopseek(var0, 1.2S, .1S)
scaley = scalex
scalez = scalex
}