Plants Vs. Zombies Style Game - Health bar question

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • We are developing a Plants Vs. Zombies grid defense style game. We want the "characters" that move to have there own health bar using the counter object. The problem is that when any of the characters gets hit all the health bars go down. We need to have an independent health bar for each object. We could do this by cloning the counter object and the character's active but it is my understanding that when you clone an active it also duplicates all the graphics and therefore increases the memory used. Since we are talking about dozens of cloned animated characters on or off the screen, that would use a lot of memory.

    What I was thinking is to use duplicate objects but assign alterable values to each one as they colide with a detector off screen but when I started to map it out my brain when to mush. Does anyone have an idea of how to do this?

    Again to clearify, we need to have duplicate actives (not cloned) with their own health bar(counter). The health bar will lock to the position of the character as it moves across the screen using: Always--->Set Position of "Coouter" relative to "Active"

    Edited once, last by Puff_N_Stuff (May 9, 2012 at 6:14 PM).

  • Give all your Character/ Enmy Objects an AlterableValue called Health_
    Give all your Character/ Enmy Objects an AlterableValue called MaxHealth_
    When damage is delivered ( through a Collission or Overlap event ), subtract from Enemies Health_

    Event Editor, do 3 Events:

    If number of HealthBars is lower than number of Enemies
    --> Create HealthBar at 0,0

    If number of HealthBars is greater than number of Enemies
    + Pic a HealthBar at random
    --> Destroy HealthBar

    Allways
    --> Set HealthBar possition to Enemy possition
    --> Set HealthBar maxValue to Enemy MaxHealth_
    --> Set HealthBar value to Enemy Health_

    How can i change username and display name?
    Please login to see this link.

  • You should do the above, but for future reference, MMF won't duplicate identical images in its cache. Even if they belong to completely different objects, it will only store it once.

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

  • Thanks for the help, I will try this tomorrow and report back

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!