shewhorn's Recent Forum Activity

  • Apologies if this has been answered out there, I have looked, a lot and have not been able to find anything that fully explains what I'm after.

    My basic problem is keeping track of everything relating to an enemy instance, for example:

    I have 10 instances of an enemy spaceship each one having:

    health bar

    shield

    projectiles

    a vision cone

    What is the best way for making sure that when something happens to one of these objects I can relate it back to the right enemy?

    I currently have everything in a container which is working for the health bar(which scales its length based on an instance variable on the enemy), however, when info goes the other way it applies to everything, for example:

    Enemy vision cone collides with the player, firing event triggers for all instances.

    Player projectile hits enemy shield, shield strength variable is decremented for all instances.

    I thought something to do with assigning the same ID to everything in the container on create might work but I can't work out how to do the check like:

    on collision

    vision cone ID = 34

    -> Enemy ID = 34 -> Spawn bullet

    I hope this makes sense, I'm not too experienced yet but I figure this would be really helpful to nail as early as possible so I can get my core gameplay up and running.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've actually just made something like this myself and found that one of the most annoying things to get right was the delay before the shield was able to charge (I assume you want this if Halo is inspiration).

    In my project I have a physical shield that disappears when exhausted so it is slightly different but essentially I have:

    A timer that registers time elapsed since last hit:

    On contact with an enemy I reset this to zero

    It counts up to three and then stops

    On the timer hitting 3 I set a bool ShieldCanCharge to True

    On being hit by an enemy I set it to false.

    For whether to damage health or shields I'd do

    if shields > 0 do damage to shields

    else

    do damage to health

    As for the recharge, have a max charge variable, a charge rate variable, you then check the shield bool is set to true and the shield is not already at max strength and charge away.

    Apologies if this reply is a bit rambling and useless, I've only just started tinkering myself and know nothing really. I have some shields that work though. I can post capx if interested but I'm at work atm.

shewhorn's avatar

shewhorn

Member since 8 Feb, 2013

None one is following shewhorn yet!

Trophy Case

  • 11-Year Club

Progress

11/44
How to earn trophies