By killenjoke (Aug 2015)
Copied from ProjectSpark.com
this has been brought up a couple of times which got me thinking of a couple of methods to do this, and I decided to finalize the Kode I had been mentally working on. Here it is
W:D:[Play fx][projectile trail][scale(fx modifier)][scale]
W:D:[position][=][Position][+][(][forward][X][(][Speed multiplier][X][World pace][)][)]
W:D:[timer(#var.)][decrement by][X][world pace]
W:[timer][less than or equal to]D:[Destroy]
W:[Y][Pressed]D:[Shoot][IWP(custom projectile)][lifetime][at speed]
the lifetime of the projectile must be high because world pace does not affect the game clock, if the lifetime were default it could easily be destroyed while world pace was 0. The [Timer] Kode in the projectile acts like the new lifetime timer and it IS affected by world pace.
the shoot speed being set to 0 in the player brain is done for 2 reasons.
1. when a projectile is stopped and then started again it stops being a projectile and shoot speed no longer affects it’s movement, that’s also the reason I’m not using the [is projectile] tile in the projectile brain, since any Kode under this tile would stop working once world pace was stopped then reset
2. the shoot speed does not match the projectile speed but affect it, so when the object stops then starts there would be a noticeable difference in the speed, it’s better to allow the projectile to control its own speed.
the FX scale Kode is simply there so this can be dropped into any projectile from 9mm pistol rounds to Tank shells and missiles.
since speed and lifetime are affected by world pace this projectile will work with any world pace modification, either slowing it or speeding it up. so it’s possible to create Bullet time mechanics like that of Max Payne.
feel free to ask any questions and let me know if you use the Kode, I’d like to see what people do with it.