When I make my games, I normally use an object to shoot missiles and cause damage. I'll just do something like this:
obj/Missile
Bump(atom/a)
if(istype(a,/atom/movable))
a.damage(5)
This has it's advantages and drawbacks. As a pro, it allows you to make some very fancy missiles. You can make them home, and do all sorts of odd things. However, sometimes it can cause a lot of lag(particularly when using them for rapid fire weapons :-/). I was wondering how other people approach shooting missiles.
ID:154194
Apr 13 2002, 3:24 pm
|
|
Apr 13 2002, 5:39 pm
|
|
i use the missile proc. But that's just me.
|
In response to Nebathemonk
|
|
Nebathemonk wrote:
i use the missile proc. But that's just me. Missile is only a visual effect. I need to have something set up a long with it. I am thinking of having it check a path at the same speed the missile in moving. |
I use non-dense missiles in Tanks, which means I have to do my own checking for turf density, and targets in the current loc. You can take advantage of the fact that turf/contents[contents.len] will be the top mob in that turf to make it a little faster.
I haven't had any trouble with multiple missiles lagging, except the seeking missiles. The slowest part on my seekers is target aquisition, because it loops through all the tanks (soldiers and decoys are both children of the tank type) in view and goes for the one closest to it's current trajectory. Get a few going on the same screen with dozens of decoys and there will be noticable lag. I have a couple of different projectile demos on my site at http://shadowdarke.byond.com/snippets, though I doubt you need them. TrippleWideBeam shows a way to use non-dense projectiles and the projectiles demo demonstrates code very similar to the Tanks projectiles, except that in the projectiles snippet they are dense and rely on Bump(). |