Moderator
M
Moderator
22:31, 22nd Aug 2012
Magtheridon96:
Magtheridon96:
- Since you're creating 1 special effect 32x times a second, you may end up causing lag. In order to reduce the amount of lag, you can create special effects half the time, or maybe even a third of the time.
Look:
-
if randomInteger(0, 2) == 0 then
- // create special effect
- endif
-
if randomInteger(0, 2) == 0 then
- You don't need to have the local reals x and y since you're only referencing them once. If you're referencing locals only once, then you don't need them.
- You can cache the Cos/Sin values into the hashtable so you don't have to avoid retrieving the constant value in the loop during every single iteration. It's more efficient this way because Cos/Sin are heavy function calls despite their short name. (Optional)