how to make an explosion radius damage help?

CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
hello im trying to make it so if your in a certain distance of the bomb you will loose a life. i have no idea how to do this :/

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @CodeMonster using the vectortoAngle expression would help give you the result you want, but another way - much more straightforward - is to use an invisible actor centred on the origin of the explosion, collision shape set to circle, with a Collision rule.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    @gyroscope thanks for your reply except the explosion areas can be random so i cannot have a circle area unfortuantly like how can i make it so if its example like 100m away from bomb your safe?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2013

    @CodeMonster No worries, just change the radius of the circle… although in this case, change the size of the damage area actor, for instance, when 100m away is safe, set the width and height of the bomb area actor to 199 pixels each, (or 396 if you want to double it, for instance, assuming 2 pixels for every metre, or whatever other ratio you want to use).
    If player position X is > + / -100 bomb position X then (...)
    A good thought but, for the record, just the x consideration wouldn't be enough, you'd need the Y position distance as well, to consider, but even then, that'd make the bomb area square…. hence the suggestion I gave of using vectortoAngle, then perhaps easier, an invisible circle actor & collision rule.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SocksSocks London, UK.Member Posts: 12,822
    @gyroscope thanks for your reply except the explosion areas can be random so i cannot have a circle area unfortuantly like how can i make it so if its example like 100m away from bomb your safe?
    Gyroscope's circle actor / collision shape is the easiest, fastest, most flexible way to do this as far as I can see, you can of course make the circle any size you want, so if you want the 'explosion radius damage' to extend 100m in all directions then make the circle 200m wide.
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    hi all @socks and @gyroscope im still very confused because what happens is you jump up and hit a box, if your unlucky that box will drop a bomb this bomb will animate then animate a bomb explosion, so how can i constrain an invisible massive actor to the bomb actor thats being spawned then? im confused :(
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    just a question @sadida172 how do i constrain the invisible radius actor to the bomb actor after its spawned??
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    edited November 2013
  • SocksSocks London, UK.Member Posts: 12,822
    just a question @sadida172 how do i constrain the invisible radius actor to the bomb actor after its spawned??
    Why would you want to constrain the radius/collision actor to the bomb/explosion actor ?
  • SocksSocks London, UK.Member Posts: 12,822
    Where would you put the middle of the explosion circle then?
    I'm not sure what you mean by this question ?

    My question was asking what is the purpose of constraining the radius/collision actor to the explosion/bomb actor, I'm not sure why you'd want or need to do this ?
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    edited November 2013
    Well it all works fine.
    It's just when the bomb drops from a box (this can be any box. It's random)
    The bomb will fall hit ground. The bomb flashes them bomb! I made an actor constrained to the bomb. The actor being invisible and with a big size. So if the main actor collides with the constrained invisible actor when the bomb goes off. Loose life
    @socks
  • SocksSocks London, UK.Member Posts: 12,822
    Well it all works fine.
    If it works for you then that's good ! (and the most important thing !)

    For me personally I like to avoid unnecessary behaviours, attribute, rules and so on - so in this case I'd dump the attributes and the constrain behaviours and simply have the bomb spawn the collision actor when it explodes - I can't see any real reason to constrain the collision actor to the bomb.

    Anyhow, if it works, it works ! :)>-
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    @socks wow I can't believe I did not think of that! Wow haha I'll just do that
Sign In or Register to comment.