ID:1316528
 
(See the best response by DarkCampainger.)
I've been testing some things on my game to turn my icon invisible, but I can't find a way to do it.

Currently I'm creating an overlay on my icon, then setting the player's layer to 0, so only the overlay is meant to be visible, but for some reason both icons are visible.

This is what I'm doing:

obj/Animation
proc/Animate(loc, mob/Creator)
Creator.layer = 0
icon = Creator.icon
Creator.overlays += src
flick("Animation", Creator)


The reason I'm using the player's icon on the overlay is because BYOND takes few miliseconds to update a big icon's appareance when you change it's pixel_y on run-time, and with this step I can simulate the animation perfectly without a single delay.

I tried to do the same with a different icon (so it doesn't take Creator.icon), and it worked, but I don't want to create tons of icons on the folder for simple animations which could be kept in the same icon.


Thank you! :)
Do you wanna make the mob invisible to other mobs near by. Or so he can't see himself?
In response to Wissam
Wissam wrote:
Do you wanna make the mob invisible to other mobs near by. Or so he can't see himself?

Nobody is meant to see his "main icon" when that animation happens, only the overlay. I would use images if it was a simple effect, but he's able to move during the animation, so I can't do it that way.

For some reason flick() or putting an overlay on a mob and then turning the mob's layer to 0 doesn't do anything if the overlay's layer is higher :S
In response to Eternal_Memories
The player and overlay won't go invisible after
Creator.layer = 0;

?
In response to Wissam
Wissam wrote:
The player and overlay won't go invisible after
> Creator.layer = 0;
>

?

Nope, actually both stay visible after that.

Edit: I checked the overlay's layer and mob's layer during the animation and it displayed 105 (overlay's layer), and 0 (mob's layer), but both were actually visible.
In response to Eternal_Memories
The mob should go invisible, after setting the overlay to 0. Does by any chance the turf's layer that the player is standing on also 0?
Have you not tried simply setting the mob's icon to null?
In response to Rushnut
Wissam wrote:
The mob should go invisible, after setting the overlay to 0. Does by any chance the turf's layer that the player is standing on also 0?

I checked the turf's layer, and it's 2

Rushnut wrote:
Have you not tried simply setting the mob's icon to null?

I tried to, but then the animation didn't start.
Make an obj that will preform the animation but don't set as an overlay, but simply making it follow the mob.
Well if the effect is purely visual, why not simply set the players icon, to the icon of the thing
In response to Rushnut
Wissam wrote:
Make an obj that will preform the animation but don't set as an overlay, but simply making it follow the mob.

I thought about that after testing this, but I wondered if there was another way, because I really wish it to use very few CPU Usage.

Rushnut wrote:
Well if the effect is purely visual, why not simply set the players icon, to the icon of the thing

How can I do that then o-o?
In response to Eternal_Memories
Make the mob's icon the animation. Don't add any overlays.
In response to Wissam
Wissam wrote:
Make the mob's icon the animation. Don't add any overlays.

I want to make it this way because if I didn't the appareance would be a mess for some miliseconds (big icons on BYOND take some time before updating their pixel_y and pixel_x)
Bump :S
Not sure but why not make an invisibility state as part of the mob's icon set. Like in Base.dmi have an invisibility state then just change the mob's state in the code.


Or try this:
 obj/Animation
proc/Animate(loc, mob/Creator)
Creator.layer = 0
Creator.overlays += src
flick("Animation", Creator)

In response to SilencedWhisper
SilencedWhisper wrote:
Not sure but why not make an invisibility state as part of the mob's icon set. Like in Base.dmi have an invisibility state then just change the mob's state in the code.


Or try this:
>  obj/Animation
> proc/Animate(loc, mob/Creator)
> Creator.layer = 0
> Creator.overlays += src
> flick("Animation", Creator)



I tried that aswell before :S
It works well on the other icons, for example. I got an animation for a meteoryte, and for it I use another icon, let's say I have X Icon, and Y Icon. X Icon disappears perfectly, and X icon has an empty state which lasts 3 seconds; Y icon (the overlay), has the animation which lasts 3 seconds aswell, and it works perfectly. But I wonder if there's a way to do the same using the same icon for animation, because then I would have to create many icons for simple animations and that would take many space :S
I might be worth mentioning that flick() doesn't support overlays.

Forum_account has a workaround in his Overlays library.
In response to Kaiochao
Kaiochao wrote:
I might be worth mentioning that flick() doesn't support overlays.

Forum_account has a workaround in his Overlays library.

I'll take a look, thanks.

I'll probably just update the object's loc every tick, I think it won't lag much, but I wish I would have found a better way to do this with overlays.
In response to Kaiochao
Best response
Kaiochao wrote:
I might be worth mentioning that flick() doesn't support overlays.

When you flick() an atom, all overlays will also flick if they are inheriting that value from the parent atom. So if you have a player mob with the icon 'Mob.dmi' and state "assassin", and add an overlay with the icon 'Cape.dmi' and state "", then the overlay will inherit both the mob's icon_state and flick animations.
Wouldn't the invisibility variable be of use in this situation?
Page: 1 2