How do I get proper kill point value to show when you kill an enemy?

0 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hello all, im working on the kill point value again because I added 2 types of points the player can make from killing the enemy and that is either half or the full point value of the enemy thats been killed. Example, Blue enemy has 50-100Pts. If you kill B.Enemy with gun1 or gun2, you just get 50pts. But, if you kill them with both guns, gun1 & gun2, you get 100pts. Now, I got it to spawn the 50 because you hit an enemy with one or the other gun of course, but what im trying to do is spawn the full value (100pts) when both bullets kill the enemy so it can let the player know they got the full point from killing that enemy. Im unsure of how to do that and would like some insight on how to do it.

  • You can set 2 boolean variables on the enemy, true or false depending on if its been hit by bullet A or bullet B. If both booleans are true when it dies then spawn 100 otherwise, 50.

  • Thanks, I'll try that. I don't really do true or false or boolean variables, but I'll give it a try and look up on it more of how it works. Thanks once more.

  • It's an instance variable, if you prefer you can use a number that changes from 0 to 1 and they must both be 1, same thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll try the boolean one first, if I have any issue coding it out, I'll just send you a short demo link of how im doing it if it goes wrong. Thanks once more.

  • Okay, I think I got this. So I made 2 Boolean Instances called HitA and HitB for my Enemies family. I did HitA for Gun1 and HitB for Gun 2. Im not sure if HITA&B are ture, But I think I get what you meant.

  • Heres the other part...

  • Where's the hp check to see if it should be destroyed, it is always after one hit? It might not work if that's the case because you wouldn't hit them with both bullets ever.

  • Yeah, my enemies do not use HP. Only two of them but the rest are weaker types.When my player shoots, it has right gun and a left gun. It shoots both bullets at the same time, each bullet contains half the point of the full kill point value. I kinda figured that it won't work cause theres no way i could also get bullet 1 to join for HitA&B. It's kinda already done the way I had it, it's just that I can't get the full value to show when both bullets hit. They both spawn 50pts when the score totals to 100pts. But I want to spawn a 100Pt value of that when they earned it from killing the enemy.

  • I'm still not understanding the concept, how can both bullets hit if the enemy is destroyed on any of the bullets hitting. Also how is the player firing 2 different bullets at once in your game?

  • I'm still not understanding the concept, how can both bullets hit if the enemy is destroyed on any of the bullets hitting. Also how is the player firing 2 different bullets at once in your game?

    I told you already, Gun1 & Gun2. It's a fighter jet that shoots from its right gun and left gun. They both have a value of 50 which adds to 100. They hit at the same time.

  • Same time though in terms of your code, the bullets would have to hit within the same tick, that's very close and I'm not sure you can detect bullet A and B as hitting simultaneously unless you add a delay before destroying.

  • As far as I can tell what you want can't happen currently. In terms of code, Construct (or any engine) checks things 1 at a time. This means that in every tick the game will first check if bullet A has hit it, and then bullet B. Since you destroy the object immediately on either event, both variables cannot become true because the object is destroyed before this becomes possible.

    My solution would be to have a small timer.

    Give the enemies an instance variable called "deathTimer". Make its default value 50 (or something).

    if Drones - HitA = false

    OR if Drones - HitB = false

    Subtract 1 from deathTimer

    if deathTimer = 0, destroy Drones

    This will give you "deathTimer" amount of ticks for the enemy to be hit before being destroyed. You can experiment with the number of time to give so it suits you.

    I hope I understood your problem correctly and that this was useful.

  • Okay, I think everyone's getting confused a little of what I want trying to do. So im just posting this as an example to explain and to clarify things.

    All im trying to do is get the full value to spawn like in the picture. My players shoots out of both guns, 1 & 2. Most of my enemies are one hit kill. No health. When bullet 1 or 2 of gun 1 or 2 collide with enemy, it destroys it. They add 50 to players score. If no bullets hits, nothing happens. If one of the bullets hits, 50 pts to player. It spawns 50 pts. If bullet 1 or 2 hits, 100pts to player and adds 100 to players score. I just want it to spawn the 100pts value of the kill to let player know they earned 100pts.

  • These are actual pics of how both bullets from gun 1 & 2 can collide and destroy enemy and add the points.

    In this pic, both bullets have been shot and is bout to destroy enemy. Player has 0 score. each bullet is 50 pts.

    In this pic, enemy 1 had been destroyed by both bullets. It added 100pts to the players score. All I want to do is spawn the 100pt value of that. But, we're on to enemy 2 and if you look closely, only one bullet is going to kill the enemy, only adding 50pts to the score and will total to 150.

    Score is now 150 and enemy had been destroyed by one of the bullets. 1 bullet is only 50pts. and spawns the 50 point kill value.

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