How do I track number of hits on separate tanks when they are all inside a family of only 1?

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I have turrets and bases within their own separate family. I am trying to apply a pinning of a number 1-3 on each hit to the rear of the turret with 4 being the limit and naturally a number 4 is not needed with their health limit set at 4 hits. It works well on the number one tank however the other tanks do not apply the pinning on hits. I went back and tried making all individual tanks with separate names turrets and bases but that really messed up my using the drag and control around all my tanks enemy and friendly. Is there a way to use another approach to have the sprites of numbers pinned to all the friendly tank turrets when hit and still keep them all in a family showing one turret and one base no matter how many friendlies I have on the level. Since the hit number is pretty low at 4 you need to move your tanks pretty fast to save them and get them out of range which is the purpose of what I am trying.

    You can't keep track of the hits when you have more than a few tanks engaged at the same time. My setup is a bit different than the example tank game using sprites for small console and I am using large terrain and setup on desktop so it is a lot more realistic in the visual sense. I have the control setup where I am able to move both enemy and friendly around the level easily. I do have a HUD setup to show Kills of both sides so you know how many enemy you have left because they can be out of visual site if you are scrolled out and have the visuals larger. I could use some recommendations how to pin those sprites on the hits to all the friendly tank turrets and I don't need it for enemies on friendlies. For now I am using a simple pin to on each hit on the friendly tank turrets, I don't use the base for damage but only the turrets. I have them set as health in instances not damage.

    Thank you

  • Assign the turret family a hit variable, call it turhits. when your turret gets hit, up turhits by 1. create a text object called showhits. It is a small square that holds a number from 0 to 3.

    Every tic delete all showhits. For each turret then create a showhits text object and put it on top of the turret (or close where you want the number of hits to show). write that turrets turhits variable into the showhits text object.

    This looks like it is a waste of computer time but it will work fine and you will never see it slow you down by even a single frame.

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assign the turret family a hit variable, call it turhits. when your turret gets hit, up turhits by 1. create a text object called showhits. It is a small square that holds a number from 0 to 3.

    Every tic delete all showhits. For each turret then create a showhits text object and put it on top of the turret (or close where you want the number of hits to show). write that turrets turhits variable into the showhits text object.

    This looks like it is a waste of computer time but it will work fine and you will never see it slow you down by even a single frame.

    yours

    winkr7

    Thank you I will give this a try. I had my last try with similar variable names like Damage rather than showhits but I was not using text object to show the hits but was using the pin to with sprites. Getting back to one tank and turret families will make it easy to make different scenarios for me.

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