Game Development Reference
In-Depth Information
Drag in a
Change Attribute
behavior, change it to
Change Attribute
|
game.current
Speech to
|
tableCellValue (game.Intro Speech, game.currentRow, 1)
.
Let's break this down. What you did here is create a function that immediately changes
the
CurrentSpeech
attribute to the
Currentrow
attribute in the Speech table.
You cannot type in these values! You must click on the
…
button to change the attributes, then click on
Game
, then
CurrentSpeech
. Then click on the
To
and then the
e
button to
open the expressions editor. To find the
tableCellValue()
,
click on the
insert
function drop down box and scroll down
near the bottom. When you click on it, it will show up like this:
tableCellValue(table,row,col)
. Highlight
table
within the
brackets, and click on the down arrow button to fill in the attribute
game.intro Speech
, then highlight the row and do the same,
but click
game.currentRow
. Finally, highlight
col
and type in the
number
1
. If you simply type these values in, it will not work.
Now let's drag in a Display Text behavior, and click on the
e
button to change it to
game.Current Speech
. I changed the text size to
15
, but use whatever works for you.
This will change the currently displayed text to the current row of text within the
table (as defined in the previous image).
Drag in a Timer behavior and change it to
Every 3 seconds
, or for however long you
want the text to delay changing to the next line. We are going to drag in two Change
Attribute behaviors, as follows:
•
Change Attribute
from
game.Current Speech
|
to
|
tableCellValue
(
game.Intro Speech
,
game.currentRow,1
)
•
Change Attribute
from
game.currentRow
|
to
|
game.currentRow + 1