Bullet Timeout

Discussion in 'How Can I...?' started by Mr Goodcat, Jun 18, 2017.

  1. Mr Goodcat

    Mr Goodcat Boxer

    Joined:
    Jun 10, 2017
    Messages:
    98
    Likes Received:
    28
    Hello,

    How do i give a character bullet a lifespan regardless of whether it collides with an enemy or not?

    Thanks
     
  2. AaroArts

    AaroArts Miniboss Boxer

    Joined:
    Jun 22, 2016
    Messages:
    1,546
    Likes Received:
    826
    You could put an invisible wall where you wish the bullet to end. Maybe this might work?
     
  3. Mr Goodcat

    Mr Goodcat Boxer

    Joined:
    Jun 10, 2017
    Messages:
    98
    Likes Received:
    28
    Thanks for your input. Unfortunately this wont work as there isn't a specific area i need this to be executed.
     
    AaroArts likes this.
  4. meremy

    meremy Avid Boxer

    Joined:
    Aug 26, 2016
    Messages:
    134
    Likes Received:
    66
    Have you tried death delay on bullet ?
     
    Mr Goodcat likes this.
  5. Mr Goodcat

    Mr Goodcat Boxer

    Joined:
    Jun 10, 2017
    Messages:
    98
    Likes Received:
    28
    Yes thanks! Thats one side of it, do you know a way i can now have the bullet life end before an enemy collides with it?
     
  6. meremy

    meremy Avid Boxer

    Joined:
    Aug 26, 2016
    Messages:
    134
    Likes Received:
    66
    You will have to be a little more specific.
     
  7. Mr Goodcat

    Mr Goodcat Boxer

    Joined:
    Jun 10, 2017
    Messages:
    98
    Likes Received:
    28
    So basically I would like to have the character bullet have a life of around three seconds. This would mean that the bullet disappears after three seconds regardless of any collisions.
     
  8. meremy

    meremy Avid Boxer

    Joined:
    Aug 26, 2016
    Messages:
    134
    Likes Received:
    66
    That means you have to make it take damage right after spawn. So either link an invisible enemy to the character in front of the bullet spawner. Or if you think the character might touch it at some point, put an enemy spawner right in front of the bullet spawner. That way Character bullet gets spawned and enemy bullet with 0 speed will basiclly kill each other but the character bullet has a death delay of 3 seconds.

    Another way to do it as I used in one of my games is if you know the distance where you want your bullet to stop, link an invisible enemy at for ex 1000 distance from character. Make it have 9999 life. That way your bullet spawns , goes forward and gets destroyed exactly at 1000 every time
     
    Mr Goodcat likes this.
  9. Mr Goodcat

    Mr Goodcat Boxer

    Joined:
    Jun 10, 2017
    Messages:
    98
    Likes Received:
    28
    Of course!
    Thanks for your help I'll give it a go.
     
    meremy likes this.

Share This Page