YesNoOk
avatar

Shooting a curved-landing arrow (Read 1136 times)

Started by unbeknowNst, August 02, 2009, 01:48:09 am
Share this topic:
Shooting a curved-landing arrow
#1  August 02, 2009, 01:48:09 am
  • avatar
  • ****
I know how to work projectiles only from shooting in straight directions but I'm pretty unfamiliar with how it to make it actually curve.

This move I'm trying to do is Mina.
I'm using a Helper as the Projectile, and not hitdef.
So the arrow shoots into the air, kinda high towards the middle the screen and should land somewhere near p2s head.
I thought I had a method in mind but it ended up only shooting only in straight directions.

here's my failed attempt of trying to code it
here's a correct functioning piece of the code

I've compared mine with this guy's code and it's entirely different. Umm, I'd like to know what it is I have to do to make it curve down like the other guy's code.
Re: Shooting a curved-landing arrow
#2  August 02, 2009, 02:13:14 am
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
Er... makes the Physics for the Arrow N and add a Gravity state.

Quote
[State 0, Gravity]
type = Gravity
trigger1 = [Whenever you want the arrow to fall]

If you want it to go to a state where the arrow is stuck in the ground then add a velset & changestate like this.

Quote
[State 0, VelSet]
type = VelSet
trigger1 = (Pos Y >= 0)
x = 0
y = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = (Vel Y > 0) && (Pos Y >= 0)
value = [State of the arrow stuck in ground or whatever you want]

In the state of the arrow in the ground, add these.

Quote
[State 0, VelSet]
type = VelSet
trigger1 = Time > 0
x = 0
y = 0

[State 0, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

That should do it. I didn't misunderstand your question did I?

Edit:

This is what my arrow stuck in the ground state would be like.

Quote
[Statedef 0]
type    = A
movetype= I
physics = N
poweradd= 0
ctrl = 0
velset = 0,0
anim = 0
sprpriority = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1
supermovetime = 9999
pausemovetime = 9999

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 0, VelSet]
type = VelSet
trigger1 = Time > 0
x = 0
y = 0

[State 0, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 0, PalFx]
type = PalFx
trigger1 = 1
time = 1
add = -(Time)*15,-(Time)*15,-(Time)*15

[State 0, Trans]
type = Trans
trigger1 = 1
trans = Add

The palfx makes it disappear. The lower those 15's are, the slower it disappears. So the higher those 15's are, the faster it disappears. Also, if you don't have a Trans then it'll turn black instead of disappearing.
Use this code if you want the palfx to work at a certain time.

Quote
[State 0, PalFx]
type = PalFx
trigger1 = Time > 7
time = 1
add = -(Time-7)*15,-(Time-7)*15,-(Time-7)*15

[State 0, Trans]
type = Trans
trigger1 = Time > 7
trans = Add

Just change the 7's around. They always have to be the same though. If one 7 is a 63, then the rest have to be 63.
"There is nothing either good or bad, but thinking makes it so."
Last Edit: August 02, 2009, 02:32:20 am by Noctis
Re: Shooting a curved-landing arrow
#3  August 02, 2009, 03:48:29 am
  • avatar
  • ****
Yeah, I had the gravity and physics set for that before but it's not quite giving me the right feel....

It's going straight up correctly but it's not landing correctly.
Sorry if I didn't explain my intention quite clearly, I'll post a quick clip.
http://www.youtube.com/watch?v=mEDVP9ZRSsQ
Re: Shooting a curved-landing arrow
#4  August 02, 2009, 06:51:16 am
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
What do you mean? You'll have to be more specific because it looks completely fine to me. Do you want it to go through your opponent without disappearing? Is it going to high? Falling down to fast? Not fast enough?
"There is nothing either good or bad, but thinking makes it so."
Re: Shooting a curved-landing arrow
#5  August 02, 2009, 09:20:30 am
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
If it doesn't feel like it's coming out correctly, then adjust the velocities.
Re: Shooting a curved-landing arrow
#6  August 02, 2009, 07:51:09 pm
  • avatar
  • ****
What do you mean? You'll have to be more specific because it looks completely fine to me. Do you want it to go through your opponent without disappearing? Is it going to high? Falling down to fast? Not fast enough?

Actually, that clip I posted is a clip of some other creator's. I meant to show an example of what I want it to look like.
What mine is, looks nothing like that right now.
Re: Shooting a curved-landing arrow
#7  August 02, 2009, 08:22:20 pm
  • ***
  • Man of the highest caliber
    • USA
    • soldier.ucoz.net/
Well, we would need to see your character shooting as well. Otherwise we won't be able to tell you what's different & what you need to change. Post a video, link or something. Which ever you prefer.

Edit:
Here's a better answer.
The only way you're going to get it the same as the other Mina is to copy the other Mina's arrow coding. All those velsets, veladds, velmuls & crap. So instead of trying to make it like someone else character, make it the way you want it to be.
"There is nothing either good or bad, but thinking makes it so."
Re: Shooting a curved-landing arrow
#8  August 02, 2009, 09:56:09 pm
  • avatar
  • ****
This is how it's like so far...

http://www.youtube.com/watch?v=A8cCPXhcIFc

Anything I add like gravity and stuff makes it function really strangely.
I was thinking of making another ChangeState for the Arrow when coming down....
but that didn't turn out too well either.
Re: Shooting a curved-landing arrow
#9  August 02, 2009, 10:59:32 pm
  • ******
  • [E]
    • Mexico

  • Online
gravity might be too high, try using a constant veladd instead.
Re: Shooting a curved-landing arrow
#10  August 05, 2009, 01:20:26 am
  • avatar
  • ****
forget it this shits too complicated. its not an ordinary projectile ill give you guys that
Re: Shooting a curved-landing arrow
#11  August 05, 2009, 01:26:28 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
How's it complicated? It's just using a velset, and then a veladd to bring the arrow down, one of the most uncomplicated codes in the world.
Re: Shooting a curved-landing arrow
#12  August 05, 2009, 05:01:57 pm
  • ******
  • [E]
    • Mexico

  • Online
it's as complicated as coding a dp, or most likely less complicated.
Re: Shooting a curved-landing arrow
#13  August 05, 2009, 10:36:52 pm
  • avatar
  • ****
How's it complicated? It's just using a velset, and then a veladd to bring the arrow down, one of the most uncomplicated codes in the world.

I already tried that.
Re: Shooting a curved-landing arrow
#14  August 05, 2009, 10:39:54 pm
  • ******
  • [E]
    • Mexico

  • Online
that should have gotten it done then. You just need to tweak the velocities.
Re: Shooting a curved-landing arrow
#15  August 06, 2009, 12:16:42 am
  • ******
Look, just do the exact same thing as the jump state, how is it so hard that you can't copy that ? If you copy the same velocities and anything related, you'll obviously get the same thing as when you jump. The only thing you have to do is make the statetype as N and replace it with a type = gravity (that way the arrow won't go into the landing state and turn into a clone, you replace that with the appropriate changestateNoctis posted). What you'll get is an arrow that follows the exact same trajectory as when you jump. if you can't get that, try again, because there's no way you can't obtain that to begin with if you just copy-paste and do the exact same thing as the jump states.
And seriously Noctis posted the whole code for you earlier. If you're not getting the right thing, it means you did something inbetween.
There's nothing more than a velset at the beginning, and then gravity, finished with the changestate. The only thing that can change is the value of the velsets and such. Start by taking the exact same as your character's.
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: August 06, 2009, 12:21:22 am by Byakko
Re: Shooting a curved-landing arrow
#16  August 10, 2009, 06:03:58 pm
  • avatar
  • ****
Well all right.
I got it to work correctly with how it's coming up now.

I'm using a ChangeState that Noctis suggested earlier for it to come down.
Just 2 things left...

1. When the arrow reaches the top of the screen, like the very tip top, the red CLSN disappears
2. Wrong anim is being used on arrow falling down... in the ChangeState I set the Anim to different arrow
3. The red CLSN for the arrow falling is missing...
Re: Shooting a curved-landing arrow
#17  August 10, 2009, 07:23:04 pm
  • **
Well all right.
I got it to work correctly with how it's coming up now.

I'm using a ChangeState that Noctis suggested earlier for it to come down.
Just 2 things left...

1. When the arrow reaches the top of the screen, like the very tip top, the red CLSN disappears
2. Wrong anim is being used on arrow falling down... in the ChangeState I set the Anim to different arrow
3. The red CLSN for the arrow falling is missing...

You'll have to adjust the animation for the arrow falling down, try adding another red clsn for that state.
Re: Shooting a curved-landing arrow
#18  August 10, 2009, 07:28:53 pm
  • ******
  • [E]
    • Mexico

  • Online
code comes from orochi sakura.

[mcode]
;_________________________________________________ __
;projectile

[StateDef 2055]
Type            = S
moveType        = A
physics         = N
ctrl            = 0
poweradd        = 0
juggle          = 10
facep2          = 0
hitdefpersist   = 0
movehitpersist  = 0
hitcountpersist = 0
sprpriority     = 3

[State outbounds]
Type        = destroyself
Trigger1        =  !(Pos X = [-170,170])
Trigger2        =  !(Pos Y = [-220,-10])
[State ProjEsp ]
Type      = PalFX
trigger1   = 1
time          = 1
color          = 256
invertall       = 0
add          = -16, -16, 255
mul          = 256, 256, 256
sinadd          = 0, 0, 0, 60


[State InitVel]
Type      = VelAdd
trigger1    = !time && Anim != StateNo
X         = 3.5
Y         = -3.5
[State InitVel]
Type      = VelAdd
trigger1    = 1
Y         = 0.2


[State ProjEsp ]
Type      = AngleDraw
trigger1   = 1
value          = atan((-1* vel Y) / (vel X))*57.2957795
scale          = 1.0,1.0
[State ProjEsp ]
Type       = Trans
Trigger1    = 1
trans          = add;add_alpha
;alpha          = 256, 0


[State ProjEsp ]
Type        = AssertSpecial
Trigger1    = 1
flag       = noshadow
[State esp]
Type      = NotHitBy
Trigger1   = 1
value         = SCA,AA, AT
time          = 1
[State esp]
Type      = HitOverride
Trigger1   = 1
attr         = SCA,AP
slot         = 0
stateno         = stateno+1
time          = 1
forceair       = 0
[State nextState ]
Type        = ChangeState
Trigger1    = movecontact ;|| AnimTime = 0
Value              = StateNo+1

[State Counter Hit Damage]
Type       = TargetLifeAdd
Trigger1    = NumTarget
Trigger1    = ((Parent,var(15))&1)
Value          = -1*(Floor((Parent,fvar(0))*(9.8*(random%2))+(random*.001)))
Kill         = 1
Absolute      = 0
Persistent      = 0
[State hit 1]
Type       = Hitdef
trigger1    = !time && Anim != StateNo
Attr             =  S, SP
HitFlag          = MAF
GuardFlag          = M
AffectTeam          = E
AnimType          = Medium
Air.AnimType          = back
Fall.AnimType          = back
Priority          = 3,Hit
Damage             = Floor((49+((random%2)*9.8))*(Parent,fvar(0))), Floor((9.8+((random%10)*.1))*((Parent,fvar(0))))
PauseTime          = Floor((Parent,fvar(3))*10),Floor((Parent,fvar(3))*12)
Guard.PauseTime       = Floor((Parent,fvar(3))*11), Floor((Parent,fvar(3))*11)
SparkNo          = 0
Guard.SparkNo          = 40
sparkxY          = 4,-60
HitSound          = 5, 0
GuardSound          = 6, 0
Ground.Type          = Low
Air.Type          = High
Ground.SlideTime       = 16
Guard.SlideTime       = 16
Ground.HitTime          = Floor((Parent,fvar(4))*24)
Guard.HitTime          = Floor((Parent,fvar(4))*24)
Air.HitTime          = Floor((Parent,fvar(4))*13)
Guard.CtrlTime          = 16
Airguard.CtrlTime       = 13
Guard.Dist          = 50
YAccel             = 0.64
Ground.Velocity       = -0
guard.Velocity          = -0
air.Velocity          = -9.64, -8.97
AirGuard.Velocity       = -12.61, -8.97
ground.cornerpush.veloff    = 0
Down.CornerPush.VelOff       = 0
Air.CornerPush.VelOff       = 0
Guard.CornerPush.VelOff    = 0
AirGuard.CornerPush.VelOff    = 0
Air.Juggle          = 0
SprPriority          = 2
;P1Facing          = -1
P1GetP2Facing          = 0
;P2Facing          = -1
;P1StateNo          =
;;P2StateNo          = 5610
P2GetP1State          = 0
;MinDist          =
;MaxDist          =
;Snap             =
ForceStand          = 0
Fall             = 0
fall.xVelocity          = 0
fall.yVelocity          = 0
Fall.Recover          = 0
Fall.RecoverTime       = 9
Fall.Damage          = 0
Air.Fall          = 1
down.Velocity          = 0
Down.HitTime          = 9
Down.Bounce          = 0
ID             = 0
chainID          = -1
nochainID          = -1,-1
HitOnce          = 1
Kill             = 1
Guard.Kill          = 1
Fall.Kill          = 1
NumHits          = 1
GetPower          = Floor((Parent,fvar(5))*(78.125+(random*.001))),Floor((Parent,fvar(5))*(78.125+(random*.001)))
GivePower          = Floor(15.625+(random*.001)),Floor(15.625+(random*.001))
Attack.Width          = 5,5
PalFx.Time          = 9
PalFx.Mul          = 256,256,256
PalFx.Add          = 0,0,0
;EnvShake.Time          = 7
;EnvShake.Freq          = 20
;EnvShake.Ampl          = -2
;Envshake.Phase       = 0
;Fall.EnvShake.Time       = 7
;Fall.EnvShake.Freq       = 20
;Fall.EnvShake.Ampl       = -2
;Fall.EnvShake.Phase       = 0

[State Anim ]
Type       = ChangeAnim
trigger1    = !time && Anim != StateNo
Value          = StateNo

[/mcode]

the important bits:

[mcode]
[State InitVel]
Type      = VelAdd
trigger1    = !time && Anim != StateNo
X         = 3.5
Y         = -3.5
[State InitVel]
Type      = VelAdd
trigger1    = 1
Y         = 0.2


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

The default angle in teh anim is the projectile pointing forwards.
Re: Shooting a curved-landing arrow
#19  August 13, 2009, 12:20:15 am
  • avatar
  • ****
Ok. I've got that taken care of, but there's a new problem.

So this projectile has two Statedefs. One for the arrow going up, one for the arrow going down. Arrow going up is Statedef 7400, and it changes to 7401 when it's going down.

The problem is when Statedef 7400 hits p2, the arrow does not destroy itself. This is because 7400 uses 7401 as the ChangeState.
ChangeState code
[mcode]
[State 7400, ChangeState]
type = ChangeState
trigger1 = (Vel Y > 0) && (Pos Y <= 0)
value = 7401[/mcode]

Again, Statedef 7401 is where proj falls down
The ChangeState for 7401 is working fine too, but I don't know what I'm gong to do for 7400, to make it destroyitself when it hits p2
Last Edit: August 13, 2009, 01:12:36 am by unbeknownst(*´∀`)
Re: Shooting a curved-landing arrow
#20  August 13, 2009, 12:35:59 am
  • ******
destroyself trigger Movecontact ??
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.
Re: Shooting a curved-landing arrow
#21  August 13, 2009, 01:13:19 am
  • avatar
  • ****
no, that's not it... actually you weren't suppose to see that. ignore what you just saw.

its the changestate not the destroy self
Re: Shooting a curved-landing arrow
#22  August 13, 2009, 01:33:04 am
  • ******
If you want your arrow to be removed when it hits, even in state 7400, then
destroyself trigger Movecontact ??
(and I mean DO THAT) I don't care about your changestate. If you want the arrow to disappear once it hits, be it in statedef 7400 or 7401, then the answer is A DESTROYSELF TRIGGERED BY MOVECONTACT. What else would you think it would need to disappear upon contact, other than TELLING IT TO DISAPPEAR UPON CONTACT.
Otherwise explain more clearly what you're trying to do because if it's not that, then I don't understand your question.
By the way I don't really see why you even need two statedefs - one for going up and the other for going down. Both can be in the same statedef. Well, I suppose maybe you copied the jump states and that's how the jump states do, but it's optional, it does a changestate only if you have different animations - if you put it all in the same animation, you don't really need a changestate.
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: August 13, 2009, 01:39:09 am by Byakko
Re: Shooting a curved-landing arrow
#23  August 13, 2009, 01:37:25 am
  • avatar
  • ****
I'm assuming you're talking about this destroy self (which comes before the ChangeState)

[mcode][State 4110, DestroySelf]
type = DestroySelf
triggerall = time > 1
trigger1 = FrontEdgeDist <= -40 && !var(1)[/mcode]

If you are, then I changed "trigger1 = Movecontact = 1". Did not make a difference though.
I don't know much about this trigger so...
Re: Shooting a curved-landing arrow
#24  August 13, 2009, 01:40:45 am
  • ******
Trigger2 = movecontact
(you don't need to change your current trigger, just add a new one, because you probably still want the arrow to destroyself when you reach the edge of the screen)
If you specify = 1, you most likely need to add a "ignorehitpause = 1" line after your triggers. Movecontact = 1 means exactly one tick after the movecontact ; but most of the time that'll be in the middle of the hitpoause, and if you don't tell the destroyself to ignorehitpause, then it won't activate, and afterward, when the hitpause ends, movecontact will be more than 1.

Oh, and I'm not talking about "this destroyself". I'm saying that you need to put a destroyself that would be triggered by movecontact. It can be this one (with a new trigger), or you can even make a new one (though that'd be redundant). the point is, it must be there - if you want the arrow to destroyself when it hits, then you need a destroyself to be triggered on movecontact.
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: August 13, 2009, 01:47:10 am by Byakko
Re: Shooting a curved-landing arrow
#25  August 13, 2009, 02:26:23 am
  • avatar
  • ****
Oh, and I'm not talking about "this destroyself". I'm saying that you need to put a destroyself that would be triggered by movecontact. It can be this one (with a new trigger), or you can even make a new one (though that'd be redundant). the point is, it must be there - if you want the arrow to destroyself when it hits, then you need a destroyself to be triggered on movecontact.

I added a trigger2 = MoveContact... no difference though. what else do I do?

Did you repeat yourself twice on "destroyself to be triggered on movecontact" ?
(the 2nd and last sentence of that paragraph)

either that or I'm understanding you wrong...
Re: Shooting a curved-landing arrow
#26  August 13, 2009, 03:10:09 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
You're understanding him wrong.

This really is simple. When the arrow hits, use destroyself. Thats all. Add a destroyself sctrl and have it triggered by movecontact. Thats it. Nothing more, nothing less, certainly not complex. Just do it. Make sure it's in a state that can frigging hit though.


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.