walkway crash not working

(snowy_duck) #1

okay i’m making an espionge game and at the beginning u see stairs r broken so u can’t get up you’re spossed to look around and nock out a weak walkway strut and it falls making a ramp well the walkway falling doesn’t work at sometimes and sometimes does work. i have a touch sensor to tell it’s been shot. a near sensor doesn’t work cause u could shoot the air and the bridge would still fall. how do i make it better?


if u could help i would appreciate it :slight_smile:

(saluk) #2

Try using a collision sensor instead
Property bullet
frequency (the f on the collision sensor) should be zero

(joecool) #3

also, the collision detection doesn’t always work…especially with a fast moving object (ie, a bullet)

(snowy_duck) #4

the collision sometimes works also. what r your opinions about using radar/ray as the gun and not add object? should the gun then send off a message saying fall? has anyone else done a thing like this? i do know how to use python scripts thanks to asdf_46 but i don’t know how to write one? any addvice?

(wiseman303) #5

Attach this script to the ‘gun’ (an empty) and hook it up to a ray sensor.
Also give anything you want to be shootable an int property named ‘damage’ (without the quotes) and set it to any number you want. (higher number means it can withstand more damage.)

cont = GameLogic.getCurrentController()
ray = cont.getSensors()[0]
if ray.isPositive():
    target = ray.getHitObject()
    if hasattr(target, damage):
        target.damage = target.damage - 1

Set the walkway’s damage property to 1, and set up these logic bricks:
property (damage = 0) --> and --> IPO (fall)