ID:1688212
 
Keywords: coding, to, transform
I am creating a game. I'm a beginner and need some advice or help. I am trying to code like for example, if I type the letter B I will activate the Sharingan, and if that's already activated, I press Z to activate the Mangekyou Sharingan. Some help will be much appreciated! I have the icons made ready. for example.. I have the normal state as in standing and movement. with the sharingan I have made for standing and movement, same with the Mangekyou Sharingan, but I don't know how to code it so when activated, each icon state will show.
mob
var
Sharinganlvl=0
verb
macro1()
if(!usr.Sharingan)
usr.Sharinganlvl = 1
usr<<"Sharingan"
macro2()
if(usr.Sharingan==1)
usr.Sharinganlvl = 2
usr<<"Mangekyou Sharingan"


Use interface>macros and bind macro1 with a and macro2 with b. LoL
Alright I understand that part but when activated, I want that specific Icon to show. Like.. in my normal state, I don't have anything over my head.. but when I click on Mangekyou Sharingan or Sharingan, I have the eye above my head.
In other words, the player icon size is 32, but the mangekyou sharingan icon size is 64.
U have to use the same icon_size icons for the game :p
In response to Phat T
Phat T wrote:
U have to use the same icon_size icons for the game :p
False. As of BYOND 4.0 (we're pretty much in 5.0 currently), icons of any size can be simply used in any game, as long as world.map_format isn't TILED_ICON_MAP, which exists for backwards compatibility and is not the default setting.

You can change an atom's icon by setting its "icon" or "icon_state" variables to match the state you want.
Aww my bad ...
In response to Phat T
It's okay. It seems like unless you closely follow the forum activity (particularly the announcements and release notes), you'll get left behind on all the new things. Maybe someone should start a reminder-type series of articles on development features that people may be missing out on.
Kaiochao, question, I managed to set up a verb with a flick(). For example, I set it up for attack it'll show the animation sprite for attack. When I set it up for a sprite for Transformation, well, it shows that image for like, a second. Is it temporarily only? Or can you set it up like after activated, the icon sprite stays till whenever you deactivate? like for example... I'm in my normal state... when I activate a power up, it stays powered up with the animation for however long I want, till deactivated. I'm learning little by little here and understanding a little more. Just takes time to study lol
In response to Ssj2Jo333
flick() plays through an animated icon state once. It doesn't actually set the icon_state of the object.
(If the icon state isn't animated, nothing happens.)

If you want to go from one icon_state to a flick() animation, and then end up in another icon_state, then you just set the icon_state and flick() at the same time.
icon_state = "initial"
// ...
flick("transition", src)
icon_state = "final"
oh okay. how do I set the verb so once activated it continuously plays an animated icon? And then to turn of, click on same link again but deactivated..
I just figured out how to get it to continuously play.. wow.. for to add icon='asdlfjdsa' lol.
how do I set it up to deactivate with the same link
In response to Ssj2Jo333
If you set icon_state to an animated state, it'll keep playing indefinitely, or a certain number of times, as specified in the animated icon editor.

I don't really know what you're asking though. If you want to reset the icon_state, can't you just set it back to what it was? By default, icon_state = "", an empty string (maybe null works too).
mob
verb
Mangekyou_Sharingan()
icon= 'mangekyou sharingan.dmi'


this is how I have it set up so far. When I click on the verb Mangekyou Sharingan in the game, it continuously plays like how I wanted. but I want to be able to revert back to normal after clicking on the verb again.
sorry I don't know how to post code stuff in byond yet. Still new here.
In response to Ssj2Jo333
<dm>
code
</dm>
(DM is the name of the language)

To "revert back to normal" you have to set the variables back to how they were before. But you need to be able to know which state you are in, in order to change to the other.
mob
verb
toggle_special_state()
// if we're in the special state,
// revert back to normal.
if(icon == 'special state.dmi')
icon = 'normal state.dmi'

// otherwise change to the special state
else
icon = 'special state.dmi'
God bless you man. Very much appreciate.