ID:270339
 
The code I hace that does this, well, doesn't.

How would you go about it? The way I do is ineffectual.


--Vito
Vito Stolidus wrote:
The code I hace that does this, well, doesn't.

Have*

How would you go about it? The way I do is ineffectual.

You need to be more descriptive in what you want, since nobody can read your mind and know what the flashy slicing animation would look like.

~~> Unknown Person
In response to Unknown Person
Oh. Oops. Sorry.

An animation over the attacked mob that goes away after a few seconds. Can be one of several types, depending on what attacks the attacker is using.

That explanatory enough?


--Vito
In response to Vito Stolidus
You can just add an animation to the player's overlays, then take it away after a few seconds.

~~> Unknown Person
In response to Unknown Person
I'm sorry - this has been a problem for me in the past. Can you just:
obj/overlayer
icon = 'icon.dmi'
icon_state = ""
layer = MOB_LAYER + 100

mob/proc/flashyslashing(var/M) // given M is a text string
var/obj/overlayer/A = new()
src.overlays += A
flick(A, M)
del A

If not, why?


--Vito
In response to Vito Stolidus
That won't work because you can't modify what an overlay looks like when it's stuck on an icon. You're best bet is to use image(), and directly set the overlay's appearance to what you want.

atom/proc
add_overlay(icon_file, state)
src.overlays += image(icon_file, icon_state=state)
remove_overlay(icon_file, state)
src.overlays -= image(icon_file, icon_state=state)


And to do the fancy slashing animation...

mob/proc
flashyslashing(state)
src.add_overlay('slashing_images.dmi', state)
spawn(30) // remove it after 3 seconds
src.remove_overlay('slashing_images.dmi', state)


~~> Unknown Person
In response to Unknown Person
Wouldn't flick do just fine for an animation?
In response to Unknown Person
Okay, thanks.

--Vito
In response to Vito Stolidus
Oh, one more thing: How do you modify the "layer" of overlays like those? I kind of need to do that.


--Vito
In response to Vito Stolidus
You can't change the layer of flicks. They are best for things like doors so don't use flicks for this.
In response to SJRDOZER
Not necessary. Just fixed it. My 1st idea was, for once, successful.

--Vito