YesNoOk
avatar

Moving a beam manually (Read 418 times)

Started by Noctis, June 23, 2009, 07:24:21 am
Share this topic:
Moving a beam manually
#1  June 23, 2009, 07:24:21 am
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
Just like Lucario's attack in SSBB. I tried adding an AngleAdd that adds 1 to the angle as long as I'm holding right and -1 as long as I'm holding left, but it won't work.

I need to know how to properly write the code. Apparently the code below does not work. This code is in a helper by the way.

Code:
[State 0, AngleAdd]
type = AngleAdd
triggerall = command = "holdfwd"
trigger1 = Time > 0
value = 1

[State 0, AngleAdd]
type = AngleAdd
triggerall = command = "holdback"
trigger1 = Time > 0
value = -1
"There is nothing either good or bad, but thinking makes it so."
Re: Moving a beam manually
#2  June 23, 2009, 09:42:13 am
  • ******
[mcode]type = AngleDraw
type = AngleAdd[/mcode]And, adding 1 ? That's very small. The thing is, this isn't incremental.
You hold a direction during one tick, it adds 1 to the 0 angle (1 is practically invisible). Next tick, you're still holding the direction, so it adds 1... to the 0 angle, not to what you previously added. It counts from 0 and resets constantly.
You'd need to count for how long you hold one direction, substract the time you hold the opposite direction for, and use the sum for the angledraw.
By the way, remember the rotation doesn't affect the clsn boxes.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Last Edit: June 23, 2009, 10:02:43 am by Byakko
Re: Moving a beam manually
#3  June 23, 2009, 02:43:31 pm
  • **
It's pretty hard to make this move like in the original game, because of the CLSN boxes like Byakko mentioned.
You will have to "simulate" the beam with more invisible "projectile-like" helpers with CLSN1 boxes, that rotate around the player (think of it like simulating a slant line with pixels/squares) and rotate just the animation of the beam (with no CLSN boxes).

Anyway, you should use a var that holds the angle (basically just replace AngleAdd with VarAdd and value with var(X) in your code).
Latest Creation: SSBB Assist Trophies
Re: Moving a beam manually
#4  June 23, 2009, 03:16:30 pm
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
It's already done.

Code:
[State 200, Varset]
type = VarSet
trigger1 = !Time
v = 1
value = 0

[State 200, Varadd]
type = VarAdd
trigger1 = (root, Command = "holdfwd") || (root, command = "holdback")
v = 1
value = IfElse((root,command = "holdfwd"), IfElse(var(1) >= 5,0,1),IfElse(var(1) <= -5,0,-1))

[State 200, AngleDraw]
type = AngleDraw
trigger1 = Time > 1
scale = 2,2
value = -45+var(1)

Anjel did it before I got a chance too. :P

I'll just summon helpers whenever I am at a certain angle to make the CLSN boxes follow the beam and remove them whenever I'm not at that angle anymore. I already know this works because I summoned a bunch of projectiles once I hit Var(1) = 5 which is my beam's angle moving up by 5... things.

Edit:
I just realized I've never removed a helper before if it's at a certain angle. How would I do that? I tried adding different destroyself's in the helper of CLSN's like this.

Code:
[State 0, DestroySelf]
type = DestroySelf
trigger1 = var(1) != [-5,5]

[State 0, DestroySelf]
type = DestroySelf
triggerall = var(1) != [-5,5]
trigger1 = time = 0

[State 0, DestroySelf]
type = DestroySelf
trigger1 = var(1) > 6 || var(1) < -6 ;(I tried var(1) > -6 too)

None of'em work. T_T

I have a helper that summons a beam, and that beam summons helpers with CLSN boxes during certain angles in case anyone is confused.
"There is nothing either good or bad, but thinking makes it so."
Last Edit: June 23, 2009, 03:50:13 pm by Noctis
Re: Moving a beam manually
#5  June 23, 2009, 03:55:00 pm
  • ******
It's a helper, and helpers have their own variables.
Var(1) belongs to the parent, so writing "var(1)" when in the helper will always be = 0 (since it's the default value).
Look for info on trigger redirection and write "parent,var(1) != [-5,5]" instead to access the parent's var(1).

Quote
I have a helper that summons a beam, and that beam summons helpers with CLSN
... geh. A helper that summons a beam ? I hope you mixed that up (you mean the character summons a helper which displays a beam ?), but regardless, nevermind. Just remember that "root" is the character itself ("root,var(1)" is the character's var(1)), and that you can't do multiple redirection (you can't write "parent, parent, var(1)" if you have two levels of helpers...) If you have a helper A that summons a helper B, which summons other helpers Cs, then for the Cs to access A's var, you might need to pass it to B before. Have B set one of its own variable to the same as "parent,var(1)" and then have the Cs read B's variable with "parent,var(1)".
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Last Edit: June 23, 2009, 04:03:56 pm by Byakko
Re: Moving a beam manually
#6  June 23, 2009, 05:04:25 pm
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
That is what I meant. My attack uses a helper (Helper A) that displays a beam, and that same beam helper uses another helper (Helper B) depending on the angle. And Parent,var(1) duh.... I should of known that.

Edit:
Helper... Helper.... Helper..... The word has lost all meaning.
"There is nothing either good or bad, but thinking makes it so."
Re: Moving a beam manually
#7  June 24, 2009, 02:23:56 pm
  • **
Instead of spawning new helpers at a certain angle you could just move them to the exact angle with trigonometrical functions:
[mcode][State 0, BindToRoot]
type = BindToRoot
trigger1 = 1
pos = 50*cos(root,var(1)*Pi/180),50*sin(root,var(1)*Pi/180)[/mcode]
Change the multiplier (50 here) to increase / decrease the distance to the player.
Latest Creation: SSBB Assist Trophies
Re: Moving a beam manually
#8  June 24, 2009, 11:25:57 pm
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
[mcode][State 0, AngleAdd]
type = AngleAdd
triggerall = command = "holdfwd"
trigger1 = Time > 0
value = 1

[State 0, AngleAdd]
type = AngleAdd
triggerall = command = "holdback"
trigger1 = Time > 0
value = -1[/mcode]

Too late now, but this probably didn't work because you keyctrl = 0'ed and you didn't redirect your commands back to the parent. The hitbox thing would have always been an issue and you're on your way to a better solution now anyway.


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: Moving a beam manually
#9  June 24, 2009, 11:49:40 pm
  • ******
  • [E]
    • Mexico
I have been getting ood result by using a lot of projectiles in loop code, you could just use an angledraw-ed explod for the gfx while the projectiles are using sprite -1.