Hello Guest

Author Topic: Expensive Operation? 0.o  (Read 4054 times)

Christamin

  • Newbie
  • *
  • Posts: 1
    • View Profile
Expensive Operation? 0.o
« on: November 07, 2012, 03:04:45 am »
So let's just say I'm making an iPhone game,
If I were to to change the sprite id like this: sprite.spriteId = sprite.GetSpriteIdByName("PlatformSmall"); pretty often,
would this hinder the performance substantially?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Expensive Operation? 0.o
« Reply #1 on: November 08, 2012, 10:01:28 am »
Not massively, but you can always just cache the value and use it. Its just a couple lines more :)

Code: [Select]
int platformSmallSPriteId;
platformSmallSPriteId = sprite.GetSpriteIdByName("PlatformSmall");

...
sprite.spriteId = platformSmallSpriteId