Alternate random animation code plus ifelse facing (Read 507 times)

Started by Carmell, November 30, 2019, 01:52:55 PM
Share this topic:
Alternate random animation code plus ifelse facing
#1  November 30, 2019, 01:52:55 PM
  • **
    • USA
Okay so I want to have my character throw out a series of random projectiles. My problem lies when some of the projectiles need to be flipped if youre in the P2 position.

 I understand the coding of Anim = 0+random% well enough, but since I need to have some flipped Im going to need an alternate I think and I wouldnt know where to look for an example since Anim = 0+random% is just so much more convenient. I also understand anim =IfElse(facing well enough as well but only the most basic way of using it.

I assume I need some kind of combo of the 2 but Im not very code minded and wouldnt know where to begin.

Something like Anim=random each individual animation number plus if else facing on the ones that need it all in one code line.

**Example of current code**

[Statedef 302]
type = S
movetype = A
physics = N
anim = 1200+random%10
velset = 28,-16

So there's 10 animations but 1204 1205 and 1207 each need to have a P2 facing option with anims 1210 1211 and 1212 respectively.
Last Edit: December 01, 2019, 10:13:10 PM by Carmell
Re: Alternate random animation code plus ifelse facing
#2  December 01, 2019, 10:07:08 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
Your character has a unique anim for when hes facing the other way? Sequence your animations differently to start. The p1 facing anims should now be 1200 1201 and 1202. Then do the rest in order. That way you can do the following

Anim = ifelse(facing = 1, 1200+random%10, 1203+random%10)

So itll show the normal anims when facing right. Otherwise it gets access to the fancy ones when facing left. The common ones remain available throughout. There are a few ways to do this but its probably easiest with the above.

In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Alternate random animation code plus ifelse facing
#3  December 01, 2019, 10:12:58 PM
  • **
    • USA
Thank you Cyanide that was exactly what I was looking for.