Shooting a curved-landing arrow

Started by unbeknowNst, August 02, 2009, 01:48:09 AM

Previous topic - Next topic

unbeknowNst

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.

Noctis

#1
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.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

unbeknowNst

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

Noctis

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?

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

Rajaa Retired

If it doesn't feel like it's coming out correctly, then adjust the velocities.

unbeknowNst

Quote from: Noctis on August 02, 2009, 06:51:16 AM
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.

Noctis

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.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."

unbeknowNst

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.

Bastard Mami

gravity might be too high, try using a constant veladd instead.

unbeknowNst

forget it this shits too complicated. its not an ordinary projectile ill give you guys that

Rajaa Retired

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.

Bastard Mami

it's as complicated as coding a dp, or most likely less complicated.

unbeknowNst

Quote from: Girl on August 05, 2009, 01:26:28 PM
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.

Bastard Mami

that should have gotten it done then. You just need to tweak the velocities.

Byakko

#14
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.

unbeknowNst

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...

Moji

Quote from: unbeknownst(*´∀`) on August 10, 2009, 06:03:58 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.

Bastard Mami

code comes from orochi sakura.


;___________________________________________________
;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



the important bits:


[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


The default angle in teh anim is the projectile pointing forwards.

unbeknowNst

#18
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

[State 7400, ChangeState]
type = ChangeState
trigger1 = (Vel Y > 0) && (Pos Y <= 0)
value = 7401

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

Byakko

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.