Game Development Reference
In-Depth Information
35.
}
36.}
Listing 91: A script to display weapon data in text format
It is important to notice that we use GetReloadProgress() function to know whether the
weapon is reloading. If this function returns zero, it means that no reloading is currently
in progress. In this case, we display the ammo. However, if this function returns a value
other than zero, this value is in fact the progress of reloading expressed in a value between
0 and 1. If we multiply the returned value by 100 then convert it to integer, we get a pro-
gress value that is neat to display. Illustration 92 shows a screen shot of the final scene. A
complete demo can be found in scene22 in the accompanying project.
Search WWH ::




Custom Search