How To Do This
craps
Member Posts: 353
In many of the sling shot games the ammunition travels up the screen and "destroys" when it hits a target.
Not hard to figure out. But if the the ammo does not hit a target - falls short or misses - the ammo hits the ground and destroys.
How do you set up something like that? You cant have the ammo (actor) collide with an invisible wall because it
would destroy - hitting the wall - as it moved up the screen.
Not hard to figure out. But if the the ammo does not hit a target - falls short or misses - the ammo hits the ground and destroys.
How do you set up something like that? You cant have the ammo (actor) collide with an invisible wall because it
would destroy - hitting the wall - as it moved up the screen.
Comments
I didn't understood what you meant in you can't have the ammo collide with an invisible wall ....
The trouble is that the actor - trying to hit something near the top of the screen has to travel over the invisible wall - collides with it and is destroyed - before it gets to the top of the screen and the target.
Anyway I think you need to test when the ammo starts to descent and activate the collision only then. I'm not sure how you do that but it might work by testing the velocity on Y. Again, I'm not sure because I don't have access to my mac to test it but if the Y velocity is bellow 0 then it descends. I did something similar but on the X axis, based on the velocity I tested if an actor moves left or right so I guess you can do the same on Y. Goes up or down if it's above or bellow 0. Again, not sure if it's the velocity but should be a similar attribute anyway.
You will notice that if you miss a target on purpose the ammo gets destroyed when it hits the ground. Is it colliding with an invisible actor? If so why doesn't it get destroyed as it "travels" over ( lower on the screen) invisible actors?
Also how can you constrain the height that the ammo moves up the screen? I never "goes off" the top of the screen.
Rule when overlaps with invisible actor
-----Rule when width is > ????
--------destroy actor.
Because interpolate works like a built in timer it will only reach the "reset size" if you fire a really wimpy shot. Otherwise you could try the above rule set and check for the speed of the projectile (linear.motion.Y) insrtead of size. If it is going to slow destroy it.