I'm looking for an way to draw lasers in my game. What I'd like to do to represent this is just have a line drawn from the source to the target if they are close enough.
Can anyone tell me the proc if there is one to do this?
LJR
ID:178876
![]() Mar 23 2002, 9:49 pm
|
|
LordJR wrote:
Thanks but no thanks ;) s_missile probably wouldn't suit your purposes there anyway, since it's designed for graphical missiles that fly to their targets. =P |
Spuzzum wrote:
LordJR wrote: Yeah I knew, I just didn't want to insult him :) LJR |
Well in case anyone missed this, I can't find anything where it talked about Drawing.. What kinda procs are theses?? Is this new stuff since the Book came out?
LJR |
I started working on the problem and this is what I have so far. It won't draw an entire line from the src to the target but it will create a laser pulse (one turf large) that is aligned with the target.
mob You need to draw the laser icon from the bottum left corner to the top right corner of the icon. It doesn't need to be continuous just with that orientation (meaning it could be several torpedoes instead of one continuous beam). This will make use of the entire turf length of the turf. If you don't mind it partially filling the turf you can get rid of the angle += 45 line and make your icons from left center to right center (horizontally). It just depends on what you want. Anyway, I might try to allow one continuous beam but I'll have to think about that because the shifts involved could be troublesome. |
LordJR wrote:
Well in case anyone missed this, I can't find anything where it talked about Drawing.. What kinda procs are theses?? Is this new stuff since the Book came out? There are no drawing procs (yet) in the /icon class, but icon.Blend() can be used to take special single-pixel icons and overlay them. /* Obviously that proc is massively inefficient; it's better to cache a colored pixel first. Lummox JR |
Ok.. I've not had much exp. with this so I'm wondering if anyone can suggest some ways that I could do this syntax wise.
I've drawn 3 framed animated icons of my lasers when they fire, since there are no draw commands yet. So what I need to know now, is how to check 3 spaces in front of the mob, also how to define which side of the mob is the front. So when they fire, it shots out the lasers up to 3 spaces ahead, if any objs or mobs are encounted during this check it stops, and does a check to see if its a valid target, if so damage is done. LJR ps. I have heard some people recommend the missle() for this, but I'm worried about this considering there is no movement from source to target like a missle, but a instant 3 tile line and anything in the way gets hit. |
LordJR wrote:
Ok.. I've not had much exp. with this so I'm wondering if anyone can suggest some ways that I could do this syntax wise. missile() is clearly not what you want. I believe you want a simple straight line between two arbitrary tiles. Well, then you're going to want an algorithm to make the icons for you: /* I wrote that mostly as an exercise to see what I could come up with. Code to draw a thicker laser would be slightly harder because you'd need 1) to use ICON_ADD and icons with small circle and a black background, followed by a call to SwapColor() at the very end to replace black with the mask, and 2) to add to more than one icon at a time when the shifted circle covers more than one tile. Lummox JR |
http://www.byond.com/script/dms.cgi?url=byond:// Spuzzum.s_missile%23%23version=0