Action RPG Framework

by Forum_account
Action RPG Framework
A framework for developing action RPGs.
ID:806202
 
Resolved
I added the /missile object, which is a kind of projectile that is used to create visual effects only. It travels at a constant speed towards its target and doesn't bump anything. The Shoot Arrow ability in the sample game uses this to create its graphical effect.

It sounds like a beam is a projectile with a specific type of graphical effect. You can either use the /projectile or /missile object to create that effect.
Applies to:
Status: Resolved (6)

This issue has been resolved.
For the Features how about adding some beams in the game and beam battles.
How is a beam different than other projectiles?
I believe a beam refers to a projectile that makes a continuous line to the target. Such as a laser, force lightning, or whatever. Crossing the path of the beam would subject the crosser to effects and may or may not "break" the beam. Maybe useful for traps?
If it wasn't BYOND, it'd probably be easy to just send a stream of colliding particles. I'm not totally sure how fast this kind of ray works, but this is as simple as it gets off the top of my head:
proc/is_dense(atom/o)
return o.density

proc/cast_ray(
px, py,
z=1,
angle,
width=1, height=1,
method=/proc/is_dense,
life=-1)

if(life != -1)
life = round(life)

if(z <= 0 || z > world.maxz)
CRASH("Invalid z level ([z])")

if(width < 1) width = 1
if(height < 1) height = 1

// edit: I just noticed that the width/height
// only made it grow northeastward, so this is
// my quick solution to center the box.
// Probably not the best way.
px -= width / 2
py -= height / 2

if(!method)
CRASH("No collision-checking method provided ([method])")

var dx = cos(angle)
var dy = sin(angle)

var rx, ry, _rx, _ry

for()
rx = round(px)
ry = round(py)

// only check collisions when
// the rounded pixel coordinate changes
if(rx != _rx || ry != _ry)
_rx = rx
_ry = ry

// the main thing about this is
// using bounds() with absolute coordinates
for(var/atom/o in bounds(rx, ry, width, height, z))
if(call(method)(o))
return o

px += dx
py += dy

if(!(--life))
return
If you want the beam to be instant, you can use the library's mob.line_of_sight proc which traces a ray to the target. If the mob has line of sight to their target, the beam hits. If they don't, it doesn't. You'd just need to create the graphical effect.

If you want the beam to move gradually, I'd use the /projectile object and give it a graphical trail. If you want the beam to be persistent (walking into it from the side hurts you), I'm not sure how I'd handle it, but you could probably use /projectile objects too.
Forum_account resolved issue with message:
I added the /missile object, which is a kind of projectile that is used to create visual effects only. It travels at a constant speed towards its target and doesn't bump anything. The Shoot Arrow ability in the sample game uses this to create its graphical effect.

It sounds like a beam is a projectile with a specific type of graphical effect. You can either use the /projectile or /missile object to create that effect.