[Solved]How do I Know If This Is Using Resources?

0 favourites
  • 6 posts
From the Asset Store
Space Mining Resource
$5.60 USD
30% off
Mine those precious space resources & start trading
  • I have three hearts on my GUI. If the player is hit, he/she looses one life point, setting the first two hearts to red and the third one to an empty heart. The process continues until the player has ran out of life points. It's all controlled by one variable.

    What I am wondering is, if there is a simpler way to implement this?

    and

    Will this code cause lag on my GUI? If I understand this correctly, the hearts are being placed there every frame?

    Thank You

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That's a solid approach, common sense, I use the same thing.

  • I was going to comment on this on your other thread, but couldn't actually prove this causes lag, however, there is no good reason to test this every tick. You know exactly when the health value goes up or down, so call a function at that point that processes this code. That is ultimately more efficient.

  • blackhornet Could you give me an example of how this code might work? I am still a noob when it comes to Functions.

    I will try to figure it out in the mean time.

  • I've done this quickly, so there may be some missing cases. I also altered your health icons to 0-speed. You can also get away with just one heart object, not three, but that won't affect performance much.

  • I was just coming back to say I had figured it out, lol. But I will review yours and see how they differ.

    Edit

    Exactly what I had come up with, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)