News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Creating a Magnetism effect...

Started by Zero-Sennin, December 29, 2008, 10:37:14 PM

Previous topic - Next topic

Zero-Sennin

Yeah. I'm making a Mariah, and while I've set up her basics (except her throw) and the 'levels' of her magnetism, I need a bit of help actually replicating some of the things that happen with her specials.

For instance, she has a move where she laughs for a bit, then tosses a few items out of nowhere; they spin for a bit then fly directly at the opponent. I've gotten the rotation right before but I can't quite get it to fly straight at the opponent based on their position - I had to have it break the rotation and just fly at a specific angle instead of breaking the rotation and shooting directly at the opponent.

(I removed the code because it got a bit buggy when I tried fixing it, so when I rewrite it, I'll post it up.)

I have a few more issues I may need resolved, but I'll start with that one. Thanks in advance.

~ZS
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Cyanide

This was in the code section, i forget if it's still there. It's math, and involves sin and cos to establish the velocity required. Have a look through the code library. If no luck i've used it before i'll try and search it out of one of my characters and post it.


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.

Bastard Mami

[State ProjEsp ]
Type      = AngleDraw
trigger1   = 1
value          = atan((-1* vel Y) / (vel X))*57.2957795
scale          = 1.0,1.0


make sure the projectile is facing right in it's original state. You need to put this code in the last part of the helper's code, after any vel has been applied.

Bastard Mami

as far as flying to the oponent it would be something like:

[State Vel ]
Type        = VelSet
Trigger1    = time=0
X               = p2dist X
Y               = p2dist Y

that takes one tick. you can divide it by the amount of ticks like:

[State Vel ]
Type        = VelSet
Trigger1    = time=0
X               = p2dist X /120.0
Y               = p2dist Y /120.0


you can play around with that a lot, like using the angle instead.

[State Vel ]
Type        = VelSet
Trigger1    = time=0
X               = 5*cos(atan((-1* p2dist Y) / (p2dist X))*57.2957795 )
Y               = 5*sin(atan((-1* p2dist Y) / (p2dist X))*57.2957795 )


Zero-Sennin

Hoooh...might take me a while. Thanks so far. Lemme get this thing back together before I get back to ya.
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Zero-Sennin

OK, I've finally made some progress here. Good news is that they spin and fly at the enemy much like they do in the game. Now I have CLSN issues though. :P

I can already tell that the CLSN1s don't rotate when the tools she spawns do. If that's the case, then will I have to create rotation frames manually in order to use CLSNs or what?
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Rajaa Retired

from what it sounds like, it doesn't really matter just make he clsn a reasonable box, that shouldn't be a problem. If it is then yes you'd have to make your own rotation frames with altered clsn in each one.

Cyanide

Yes, the clsn's would have to be rotated manually. Anything done using angledraw only affects the sprite, not the clsns. Scale changes with angledraw have this problem as well.


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.

Zero-Sennin

Nuts. >____<

Even though I phrased the question kind of wrong (I should have asked if there was a way to make the CLSN match the angle the items are drawn at after the items stop spinning) your answers are still valid. I'll try to do something with those CLSN's but...meh.

OK, next issue. Mariah has a move where she tosses a knife into the air. It goes offscreen (if it doesn't hit the opponent first) and brings down a hanging electric wire near the target that moves towards them and shocks them several times (the number of hits is dependent on the charge level system that I've already worked out) then falls down.

I would need the wire to change its angle up until the opponent is within 5...whatever-the-measure-of-distance-in-MUGEN-is, then hold it there to damage the opponent, then swing back to its original position before falling down. I can figure out bits and pieces of it overall and haven't experimented with it just yet, but if I do (and I get problems), I'll tell you guys.

Any advice on this part before I get into it?
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Zero-Sennin

OK, just bumping so that you can see what's up.

I've gotten the wire move to work up until it's summoned. Currently, Mariah throws the knife and the wire comes down after it goes up, and just hangs right next to the opponent. Now, would I be able to create a swing effect using AngleDraws and the like? (If the axis needs to be at the tip of the wire where it emerges, then let me know. Right now it's closer to the center.)
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Iced

for the game effect, yeah, at the tip where it emerges.


One suggestion for her throw tho, try it with the opponent standing stance, instead of a hut frame.

Zero-Sennin

Quote from: Iced the 8Ball on January 11, 2009, 10:57:41 PM
for the game effect, yeah, at the tip where it emerges.


One suggestion for her throw tho, try it with the opponent standing stance, instead of a hut frame.

Duly noted on the throw. Haven't coded the electricity-ball effect yet though, 'cuz I haven't figured out how to bind the spark ball to the severed part.

And just to be clear in case I miscommunicated (which happens often), I meant the top tip of the wire, where it would be swinging from.
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Iced

make the ball sprite the same size as the wire sprite, then use the same coding on both.

Zero-Sennin

Quote from: Iced the 8Ball on January 11, 2009, 11:18:44 PM
make the ball sprite the same size as the wire sprite, then use the same coding on both.

Right on. Thanks Iced.

OK, here's what I've got so far for the wire code.

Spoiler (click to show)
[StateDef 1024]
type = A
movetype= I
physics = N
juggle  = 1
velset = 0,0
ctrl = 0
poweradd = 20
sprpriority = 2
anim = 1024

[State 1024, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 0
value = 0

[State 1024, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 1
value = 5

[State 1024, VarAdd]
type = VarAdd
trigger1 = Time < 60 ;Adjust as you wish.
fv = 0
value = FVar(1)

;Just in case you want the helper to spin itself as well:
[State 1024, AngleSet]
type = AngleSet
trigger1 = Time < 60
Value = FVar(0)*2*pi ;Angle must be given on degrees.

[State 1024, AngleDraw]
type = AngleDraw
trigger1 = time < 60

So far, this code makes the spin around in circles for 60 ticks, which I did on purpose to make sure it was spinning right. Now I have to get it to work like it does in this video, following the opponent as they move and adjusting the angle appropriately:
http://www.youtube.com/watch?v=2aNMNG9SPfY&feature=related
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

MikeDaBike

#14
I do not exactly know how your wire sprite looks, but this should rotate towards the opponent:
[State XXX, Rotate]
Type = AngleDraw
trigger1 = 1
value = -atan(P2Dist Y/P2Dist X)*180/Pi
Try this and maybe remove the minus at the atan expression.

For aligning the Ball at the end of the wire you could use this:
Save the angle used above in a var (I call it M here)
Save the length of the wire in a var (I call it N here)
[State YYY, Move to wire end]
Type = PosSet
trigger1 = 1
x = 'wire',Pos X + N*cos(M)
y = 'wire',Pos Y + N*sin(M)
Problems here might be again the negative/positve value of the angle.
Latest Creation: SSBB Assist Trophies

Zero-Sennin

Well, it kind of works... With the negative in (and a few adjustments) the wire draws itself like planned and adjusts accordingly. The only problem is that it is several feet away from the opponent, horizontally speaking, like so:



Move forward, it appears behind them; back, it draws closer but not in range. >__<
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

Iced

give it a max angle that it can never exceed, for both sides , something like 45 degrees for now, for testing purposes

Zero-Sennin

How, using a variable? (I'm a bit slow later at night, it's round 8:15 PM where I am. Forgive me.)
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.

MikeDaBike

I dont see the wire in that screenshot, is it the red line? If yes it looks to me like its off 90°.
I guess your normal wire sprite without any angle is a vertical line?
Anyway, try adding -90 to the angle value:
value = -atan(P2Dist Y/P2Dist X)*180/Pi - 90
If its not working try +90 (Im always confusing the direction  --;)
Latest Creation: SSBB Assist Trophies

Zero-Sennin

#19
Actually, I've wound up using them both. :D

[State 1024, Rotate]
Type = AngleDraw
trigger1 = Time > 0
trigger1 = P2BodyDist X < 0
value = -atan(P2Dist Y/P2Dist X)*180/Pi-90

[State 1024, Rotate]
Type = AngleDraw
trigger1 = Time > 0
trigger1 = P2BodyDist X < 0
value = -atan(P2Dist Y/P2Dist X)*180/Pi-90

[State 1024, Rotate]
Type = AngleDraw
trigger1 = Time > 0
trigger1 = P2BodyDist X = 0
value = ???

[State 1024, Rotate]
Type = AngleDraw
trigger1 = Time > 0
trigger1 = P2BodyDist X >= 0
value = -atan(P2Dist Y/P2Dist X)*180/Pi+90

It works pretty well, except for the one in the middle (the question marks obviously aren't the actual value). I've been trying to just get the wire to draw straight (no change whatsoever in drawing)when the target is standing right on top of it (so to speak), but for some really stupid reason it just disappears until you move forward or back a teensy bit.

Any suggestions?

EDIT: I found out what causes the disappearance - divide by zero error. I'm investigating now.
Youtube 
Twitter
Ask.fm
Zero-Sennin's Workshop
Quote[22:18] <Ebil_Homer> because you messed up?
[22:18] <Ebil_Homer> well that's a fucking shame
[22:18] <Ebil_Homer> pick up your sucks

I don't provide old versions of my characters once they're updated. Please don't ask me for them.