Any ideas? Thank you :)
Code:
Projectile
parent_type = /obj
icon = 'Projectile.dmi'
var
speed = 0.2 // Time to move 32 pixels
atom/owner
Fireball
icon_state = "Fireball"
New(var/turf/location, var/Vector/path, var/atom/_owner)
..()
owner = _owner
Move(location)
animate(src, pixel_x = path.x, pixel_y = path.y, time = speed * (path.Magnitude() / 32))
One way to accomplish that is to create a separate, invisible, dense object to handle collisions. You would physically move this object over time, copying how the animate() interpolates the visual position.
It might be better to use /Projectile for the "physical" object, and some other type of object (such as /obj) for the purely visual effect, because /Projectile would be a good place to handle those interactions, since the purely visual effect doesn't really do anything. The visual effect should react to changes in the physical object, e.g. destroy the visual effect when the physical object is also destroyed.
Or, you could do your own collision detection. I recommend against this if your projectiles can move very fast, i.e. significantly farther than their size per world-tick, because BYOND does movement subdivision for you to avoid skipping over potential collisions. But if you really want to, you could use bounds(x, y, width, height, z) to check for obstacles in a position that you calculate using the same position interpolation used by your animate().
Off-topic, but I thought I should comment on a couple things:
Calling Move(location) in New() won't do anything since objects are initialized with their loc equal to the first argument passed to new type (args).
Traditionally, speed refers to an amount of distance covered per unit of time (e.g. meters per second, pixels per second, or pixels per world-tick). Speed should be something that makes objects move faster when the number is higher, but yours does the complete opposite of that, so I wouldn't use the word "speed" for that. Sure, it's related to speed (inversely), but it's not the speed itself. Maybe inverseSpeed?