S
Sake_v2
Guest
Let's say I have 3 enemies, and they should have 3 different sprite animations. Instead of having 3 different enemy objects with walkSprite set on create event accordingly (doing so, creating 30 enemies would create 30 variables when you only need 3), I have an oEnemyControl object with an array like this
enemySetup[0,0] = sEnemy1Walk;
enemySetup[0,1] = sEnemy1Power;
enemySetup[1,0] = sEnemy2Walk;
enemySetup[1,1] = sEnemy2Power;
enemySetup[2,0] = sEnemy3Walk;
enemySetup[2,1] = sEnemy3Power;
and I have a enemy parent object that everytime it needs to call the walk sprite accordingly, uses it like this:
var walksprite = oEnemyControl.enemySetup[enemyID,0];
if Moving
{
sprite_index = walksprite;
}
(ignore long and not practical objects and variables names, just an example).
Would you do it any different? Maybe not using arrays? Referencing oEnemyControl over and over could slow the game down? I'm having some performance issues in a project where the "stepevent bar" on show_debug_overlay is not optimal. Thanks
enemySetup[0,0] = sEnemy1Walk;
enemySetup[0,1] = sEnemy1Power;
enemySetup[1,0] = sEnemy2Walk;
enemySetup[1,1] = sEnemy2Power;
enemySetup[2,0] = sEnemy3Walk;
enemySetup[2,1] = sEnemy3Power;
and I have a enemy parent object that everytime it needs to call the walk sprite accordingly, uses it like this:
var walksprite = oEnemyControl.enemySetup[enemyID,0];
if Moving
{
sprite_index = walksprite;
}
(ignore long and not practical objects and variables names, just an example).
Would you do it any different? Maybe not using arrays? Referencing oEnemyControl over and over could slow the game down? I'm having some performance issues in a project where the "stepevent bar" on show_debug_overlay is not optimal. Thanks