Problem description:
We have Bob.
Bob wants to find his enemies, though they're off screen. To assist Bob, I would like arrows pointing in their direction along with the arrows' screen_loc based on the directional orientation.
The arrows, I can turn. My only problem thus far is properly moving the arrow. What sort of formula would I use to adjust the offsets?
Help me help Bob!
Edit: Bob is happy!
ID:1951751
Sep 30 2015, 10:26 am (Edited on Sep 30 2015, 2:36 pm)
(See the best response by Kaiochao.)
|
|
In response to Kaiochao
|
|
if(isnull(MinDistance)) Where are you pulling the client's bound width and height variables from? They aren't native to .dm |
In response to Bl4ck Adam
|
|
They're new to 509, which is in beta. There are other ways to get this information, though.
// I already made a library that includes it |
In response to Bl4ck Adam
|
|
Should I make this a library...? It's kind of simplistic, especially if you remove all the comments.
|
I don't see why not. Many a game could probably use something of the sort, be it a quest tracker or anything they can think of in that case.
|
There was a really old library that would put arrows on the edge of the map/view and you could move with those. I wasn't able to track it down though (it is really old and I don't remember what it was called).
Seems like kaio got it handled for you, though! :) |
In response to AERProductions
|
|
AERProductions wrote:
There was a really old library that would put arrows on the edge of the map/view and you could move with those. I wasn't able to track it down though (it is really old and I don't remember what it was called). This is what you're talking about! |
In response to Bl4ck Adam
|
|
Yes it is, thanks for reminding me!
That is what I was going to suggest, but it probably isn't optimal. :) |
In response to Bl4ck Adam
|
|
Bl4ck Adam wrote:
AERProductions wrote: Wow, I forgot all about that, it's from twelve years ago. Not what they were looking for though. |
In response to Kaiochao
|
|
Kaiochao wrote:
Should I make this a library...? It's kind of simplistic, especially if you remove all the comments. Please do. I can see myself wanting this somewhere down the line |
In response to Flick
|
|
The magical things the years do, eh flick?
I remember messing around with that library all those years ago on a certain, unreleased project which was my first attempt at a game on byond. Still have the design docs for that project, but not the original source (lost to hdd damage). |
Here's the library. It's a bit updated and easier to include, compared to what's in the forum post.
http://www.byond.com/developer/Kaiochao/ScreenArrows |
In response to Kaiochao
|
|
Kaiochao wrote:
Here's the library. It's a bit updated and easier to include, compared to what's in the forum post. It looks a lot nicer both in game and code itself. You're the best! |
All you have to do is add an obj with the arrow's appearance to client.screen and call this proc whenever you want to update it. For example:
You could even add to this demo a verb on the arrow that removes the target, but I've probably done enough already.