Jump to content

Aosora

Member
  • Posts

    21
  • Joined

  • Last visited

Community Answers

  1. Aosora's post in Making a random projectile attack was marked as the answer   
    You can do this pretty easily. The main idea is to use M.U.G.E.N’s built-in "random" expression to pick different animations.

    Option 1: Using Projectile (simplest):

    If you already have multiple projectile animations set up (say 200, 201, 202), you can randomize like this:
     
    [State 2000, Random Projectile] type = Projectile trigger1 = AnimElem = 2 projanim = 200 + random % 3 projhitanim = 210 projremanim = 220 velocity = 6,0 attr = S, SP damage = 80,10 What’s happening
    random % 3 gives you 0, 1, or 2 So you get: 200 201 202 Each time the move runs, it picks a different sprite/animation.

    Option 2: Using a Helper (more control, more chaos):
    Helpers are like little actors you spawn on stage. You can give each one a random look and behavior.
    Spawn the helper:
    [State 2000, Spawn Random Projectile] type = Helper trigger1 = AnimElem = 2 helpertype = normal name = "RandomShot" ID = 3000 stateno = 3000 pos = 0,0 anim = 200 + random % 3  
    Inside the helper state:
     
    [Statedef 3000] type = A movetype = A physics = N [State 3000, Velocity] type = VelSet trigger1 = Time = 0 x = 5 + random % 4 ; speed variation [State 3000, HitDef] type = HitDef trigger1 = animelem = 3 attr = S, SP damage = 70 + random % 20, 10 animtype = Light

    If you want multiple projectiles at once, stack helpers:

    This creates up to 5 projectiles instantly when the move hits the right frame
    [State 2000, Random Storm - Stack] type = Helper trigger1 = AnimElem = 2 trigger1 = numhelper(3000) < 5 persistent = 0 helpertype = normal name = "RandomStorm" ID = 3000 stateno = 3000 pos = 0,0 anim = 200 + random % 3

    The key is that the expression "random % (n)" where n is the number of random sprites you want for both projectiles and helpers so "anim = 200 + random % 3" would give you 3 animation variations 200, 201 and 202 if you wanted 5 variations you'd put "anim = 200 + random % 6". Hope this helps.
×
×
  • Create New...