How do I kill a bullet ?

0 favourites
  • 6 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hello everyone,

    I'm making a sort of tower defense, and one of the tower sends "bouncing" lightning.

    The way I wanted to go about this was to make the tower have a turret behavior, spawn a lightning going to the monster.

    The lightning also has the turret behavior, and should, on collision with a monster, target a new one until its number of bounces reaches 0, upon which it is destroyed.

    I have two problems though :

    • If my lightning reaches its destination and the monster has moved, it simply stays put, not dying. The way I tried to go about this was something like "If move-to destination reached and no Monster collision detected, then destroy lightning" but it doesn't seem to activate...
    • When it reaches the first monster, i would like to make sure it picks a different one, so i tried to do something like this to make it pick another one, but it doesn't seem to work either :

    Any help or pointer would be really appreciated, thanks a lot !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • my lightning reaches its destination and the monster has moved, it simply stays put, not dying. The way I tried to go about this was something like "If move-to destination reached and no Monster collision detected, then destroy lightning" but it doesn't seem to activate...

    Please show the event you made for this.

    For the second event from looking I think you filtered the instances down to the one the lightning is overlapping then tried to pick all again. If it's a sub event you can open the picking again with pick all instances first then add the logic pick a random instance where UID is eclair variable.

  • Thanks for your answer !

    Here is the event basically, after finding the target :

    And I'm going to try the second part, thanks so much !

  • Not sure about target acquiring and if that would move to the correct monster, I've not seen it used like that before, but I guess if you pick a target then try and go to a monster it's not always the same picked thing, as you're not saying move to turret target but just any monster. The bit about destroying should work though hmm.

  • You're entirely right, you corrected my first problem too by talking about instance picking ! I added the line and the rebound works like a charm !

    For the "destroy" part, I think there IS a monster overlapping on arrival, but for some reason the lightning doesn't move right away, so the condition "not overlapping" and "on arrival" do not activate, and it stops moving.

    I'm going to search a bit I think I'm onto the answer, thanks again !!!

  • You can narrow it down by again picking the monster instance with UID targetUID for the overlap check. Or you can do something like checking if the instance with that UID still exists. The latter would be useful if in your game you have to destroy the bullet early before it reaches its destination by checking while bullet 'is moving' if that instance exists.

    And yes of course you would need an event for when there is a monster there on arrival. Not sure how your game works but if it's possible then you need to plan for that.

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