YesNoOk
avatar

Projectile questions (Read 3402 times)

Started by Tyrannosaurus rex, November 13, 2015, 06:07:48 pm
Share this topic:
Projectile questions
#1  November 13, 2015, 06:07:48 pm
  • **
  • I'm a llama!
Hey everyone,
                    I'm trying to improve an existing attack state that was coded a long time ago by Sugio and while functioning correctly,  feels outdated.  Its very impressively coded to control a projectile in 5 directions by the movement keys. 

Code:
;------------------------------------------
[Statedef 1001]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1000
ctrl = 0
sprpriority = 2

[State 1001, 3]
type = VarSet
trigger1 = Time = 0
v = 0
value = 0

[State 1001, 3]
type = VarAdd
triggerall = Var(0) > -2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
;trigger1 = Var(10) > 0
trigger1 = P2BodyDist X <= 75
trigger1 = P2BodyDist X >= 0
trigger1 = P2BodyDist Y <= -50
trigger1 = P2BodyDist Y >= -100
v = 0
value = -1

[State 1001, 3]
type = VarAdd
triggerall = Var(0) < 2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
;trigger1 = Var(10) > 0
trigger1 = P2BodyDist X <= 25
trigger1 = P2BodyDist X >= 0
trigger1 = P2BodyDist Y >= 0
v = 0
value = 1

[State 1001, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) = 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) = 0
value = 1003

[State 1001, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) < 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) < 0
value = 1001

[State 1001, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) > 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) > 0
value = 1002

[State 1001, 1]
type = PlaySnd
triggerall = anim != 1005
triggerall = Time > 12
triggerall = Time < 63
triggerall = Time%8 = 0
trigger1 = command = "holda"
trigger2 = Var(10) > 0
value = 1000, 0

[State 1001, proj3]
type = Projectile
triggerall = p2dist y < -116
triggerall = p2dist x < 57
trigger1 = anim != 1005
trigger1 = command = "holda" || command = "holdx"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1011
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = 56+random%4, -116
;velocity = 5,0
velocity = 0,8*((p2dist y + 116)/(abs(p2dist x - 56) + abs(p2dist y + 116) + 0.0000001))
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1001, proj2]
type = Projectile
triggerall = p2dist y > -116
triggerall = p2dist x < 57
trigger1 = anim != 1005
trigger1 = command = "holda" || command = "holdx"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1012
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = 56+random%4, -114
;velocity = 5,0
velocity = 0,8*((p2dist y + 116)/(abs(p2dist x - 56) + abs(p2dist y + 116) + 0.0000001))
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1001, proj1]
type = Projectile
triggerall = p2dist x > 56
trigger1 = command = "holda" || command = "holdx"
trigger1 = anim != 1005
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1010
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = 56+random%4, -116
;velocity = 5,0
velocity = 8*((p2dist x - 56)/(abs(p2dist x - 56) + abs(p2dist y + 116) + 0.0000001)),8*((p2dist y + 116)/(abs(p2dist x - 56) + abs(p2dist y + 116) + 0.0000001))
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1001, 7]
type = ChangeAnim
trigger1 = Time = 63
trigger2 = command != "holda"
trigger2 = Time > 12
trigger2 = anim != 1005
trigger2 = Var(10) = 0
value = 1005

[State 1001, 7]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = p2dist x < 0;
value = 0
ctrl = 1
;------------------------------------------
[Statedef 1000]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1000
ctrl = 0
sprpriority = 2

[State 1000, 3]
type = VarSet
trigger1 = Time = 0
v = 0
value = 0

[State 1000, 3]
type = VarAdd
triggerall = Var(0) > -2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
trigger1 = command = "holda"
trigger1 = command = "holdup"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 75
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y <= -50
trigger2 = P2BodyDist Y >= -100
v = 0
value = -1

[State 1000, 3]
type = VarAdd
triggerall = Var(0) < 2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
trigger1 = command = "holddown"
trigger1 = command = "holda"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 25
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y >= 0
v = 0
value = 1

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) = 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) = 0
value = 1003

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) < 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) < 0
value = 1001

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 12
triggerall = Time < 63
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Var(0) > 0
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Var(0) > 0
value = 1002

[State 1000, 1]
type = PlaySnd
triggerall = anim != 1005
triggerall = Time > 12
triggerall = Time < 63
triggerall = Time%8 = 0
trigger1 = command = "holda"
trigger2 = Var(10) > 0
value = 1000, 0

[State 1000, 10]
type = Projectile
triggerall = Var(0) = -2
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1011
;projhitanim = 1015
projremovetime = 15+Var(2)
;offset = 18+random%2, -66
offset = 36+random%4, -132
velocity = 5,-5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = -1
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1013
projremovetime = 15+Var(2)
;offset = 20+random%2, -66
offset = 40+random%4, -132
velocity = 6.1,-3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 0
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1010
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = 56+random%4, -116
velocity = 7.1,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 1
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1014
projremovetime = 15+Var(2)
;offset = 20+random%2, -50
offset = 40+random%4, -100
velocity = 6.1,3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 2
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1012
projremovetime = 15+Var(2)
;offset = 22+random%2, -48
offset = 44+random%4, -96
velocity = 5,5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 7]
type = ChangeAnim
trigger1 = Time = 63
trigger2 = command != "holda"
trigger2 = Time > 12
trigger2 = anim != 1005
trigger2 = Var(10) = 0
value = 1005

[State 1000, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;------------------------------------------
[Statedef 1050]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1050
ctrl = 0
sprpriority = 2

[State 1000, 3]
type = VarSet
trigger1 = Time = 0
v = 0
value = 0

[State 1000, 3]
type = VarAdd
triggerall = Var(0) > -2
triggerall = Time > 20
triggerall = Time < 121
triggerall = Time%4 = 0
trigger1 = command = "holdx"
trigger1 = command = "holdup"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 50
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y <= -50
trigger2 = P2BodyDist Y >= -100
v = 0
value = -1

[State 1000, 3]
type = VarAdd
triggerall = Var(0) < 2
triggerall = Time > 20
triggerall = Time < 121
triggerall = Time%4 = 0
trigger1 = command = "holdx"
trigger1 = command = "holddown"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 25
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y <= 0
v = 0
value = 1

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 20
triggerall = Time < 121
trigger1 = command = "holdx"
trigger1 = Var(0) = 0
trigger1 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Var(0) = 0
trigger2 = anim != 1006
value = 1003

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 20
triggerall = Time < 121
trigger1 = command = "holdx"
trigger1 = Var(0) < 0
trigger1 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Var(0) < 0
trigger2 = anim != 1006
value = 1001

[State 1000, 7]
type = ChangeAnim
triggerall = Time > 20
triggerall = Time < 121
trigger1 = command = "holdx"
trigger1 = Var(0) > 0
trigger1 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Var(0) > 0
trigger2 = anim != 1006
value = 1002

[State 1000, 1]
type = PlaySnd
triggerall = anim != 1006
triggerall = Time > 20
triggerall = Time < 121
triggerall = Time%8 = 0
trigger1 = command = "holdx"
trigger2 = Var(10) > 0
value = 1000, 0

[State 1000, 10]
type = Projectile
triggerall = Var(0) = -2
trigger1 = anim != 1006
trigger1 = command = "holdx"
trigger1 = Time > 20
trigger1 = Time < 121
trigger2 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Time > 20
trigger2 = Time < 121
projanim = 1011
;projhitanim = 1015
projremovetime = 15+Var(2)
;offset = 18+random%2, -66
offset = 36+random%4, -132
velocity = 5,-5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = -1
trigger1 = anim != 1006
trigger1 = command = "holdx"
trigger1 = Time > 20
trigger1 = Time < 121
trigger2 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Time > 20
trigger2 = Time < 121
projanim = 1013
projremovetime = 15+Var(2)
;offset = 20+random%2, -66
offset = 40+random%4, -132
velocity = 6.1,-3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 0
trigger1 = anim != 1006
trigger1 = command = "holdx"
trigger1 = Time > 20
trigger1 = Time < 121
trigger2 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Time > 20
trigger2 = Time < 121
projanim = 1010
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = 56+random%4, -116
velocity = 7.1,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 1
trigger1 = anim != 1006
trigger1 = command = "holdx"
trigger1 = Time > 20
trigger1 = Time < 121
trigger2 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Time > 20
trigger2 = Time < 121
projanim = 1014
projremovetime = 15+Var(2)
;offset = 20+random%2, -50
offset = 40+random%4, -100
velocity = 6.1,3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 2
trigger1 = anim != 1006
trigger1 = command = "holdx"
trigger1 = Time > 20
trigger1 = Time < 121
trigger2 = anim != 1006
trigger2 = Var(10) > 0
trigger2 = Time > 20
trigger2 = Time < 121
projanim = 1012
projremovetime = 15+Var(2)
;offset = 22+random%2, -48
offset = 44+random%4, -96
velocity = 5,5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,1
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAF
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 7]
type = ChangeAnim
trigger1 = Time = 121
trigger2 = command != "holdx"
trigger2 = Time > 20
trigger2 = anim != 1006
trigger2 = Var(10) = 0
value = 1006

[State 1000, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;------------------------------------------
[Statedef 1100]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
;anim = 1100
ctrl = 0
sprpriority = 2

[State 1100, anim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim != 1100
value = 1100

[State 1100, superarmor]
type = HitOverRide
trigger1 = Alive = 1
trigger1 = animtime != 0
;trigger1 = Statetype = S
time = 1
attr = SCA,NA,NP,SA,SP
slot = 0
stateno = 1101

[State 1100, 1]
type = PlaySnd
trigger1 = AnimElem = 2
value = 3000, 0

[State 1100, 1]
type = PlaySnd
trigger1 = AnimElem = 14
trigger2 = AnimElem = 16
trigger3 = AnimElem = 18
value = 1100, 0

[State 1100, 10]
type = Projectile
trigger1 = AnimElem = 14
trigger2 = AnimElem = 16
trigger3 = AnimElem = 18
projanim = 1110
projhitanim = 1115
projID = 1000
offset = 80, -98
;offset = 40, -49
velocity = 3,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 20,1
animtype = Medium
pausetime = 0,7
sparkno = S4000
guard.sparkno = S4010
sparkxy = 10, 0
hitsound = S1100,1
guardflag = MA
guardsound = S1100,1
ground.type = High
ground.slidetime = 9
ground.hittime = 9
ground.velocity = -5,-2
air.velocity = -5,-2
palfx.time = 10
palfx.mul = 80, 80, 200

[State 1100, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;------------------------------------------
[Statedef 1150]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
;anim = 1150
ctrl = 0
sprpriority = 2

[State 1150, anim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim != 1150
value = 1150

[State 1150, superarmor]
type = HitOverRide
trigger1 = Alive = 1
trigger1 = animtime != 0
;trigger1 = Statetype = S
time = 1
attr = SCA,NA,NP,SA,SP
slot = 0
stateno = 1151

[State 1100, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = 3000, 0

[State 1100, 1]
type = PlaySnd
trigger1 = AnimElem = 18
trigger2 = AnimElem = 20
trigger3 = AnimElem = 22
trigger4 = AnimElem = 24
value = 1100, 0

[State 1150, 10]
type = Projectile
trigger1 = AnimElem = 18
trigger2 = AnimElem = 20
trigger3 = AnimElem = 22
projanim = 1111
projhitanim = 1115
projID = 1000
offset = 80, -98
;offset = 40, -49
velocity = 5,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 30,1
animtype = Medium
pausetime = 0,7
sparkno = S4000
guard.sparkno = S4010
sparkxy = 10, 0
hitsound = S1100,1
guardflag = MA
guardsound = S1100,1
ground.type = High
ground.slidetime = 9
ground.hittime = 9
ground.velocity = -5,-2
air.velocity = -5,-2
palfx.time = 10
palfx.mul = 80, 80, 200

[State 1150, 10]
type = Projectile
trigger1 = AnimElem = 24
projanim = 1111
projhitanim = 1115
projID = 1000
offset = 80, -98
;offset = 40, -49
velocity = 5,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 30,1
animtype = Medium
pausetime = 0,7
sparkno = S4000
guard.sparkno = S4010
sparkxy = 10, 0
hitsound = S1100,1
guardflag = MA
guardsound = S1100,1
ground.type = Trip
ground.slidetime = 9
ground.hittime = 9
ground.velocity = -5,-2
air.velocity = -5,-2
palfx.time = 10
palfx.mul = 80, 80, 200

[State 1100, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------

My questions:

Q1, Regarding after the projectile has reached its time duration or the player lets go of the attack button, How do I make it so that the projectiles created fades away with code? Or do I need to do this manually with sprites?

Q2, The projectile can be rotated in 5 directions. The bottom most being the ground. Just a basic question, but how do I set up a state for checking ground collision, which is coded exactly like colliding with a character, except it also leaves a burned decal on the ground?

Q3, How can I make the projectiles reach out longer across the screen? I'm basically asking what controls the distance covered by the projectile before its state ends?



   



Re: Projectile questions
#2  November 14, 2015, 12:57:04 am
  • *****
  • Shame on you!
    • USA
 Questions 1, 2, and 3 all involve the same thing; A changestate. With that, you'd want to make the projectile into a helper. Sounds hard, but because the projectile is already filled out, you just use all those values.

#1 you'd want to change the projectile to a helper so after a certain time or distance you could change it's state so it could fade away properly. You might be able to do this with the projectile also, but
#2 you'd want a changestate looking for the classic landing changestate

[State 699, ChangeState]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)

This will let the projectile/helper know it's below ground level and should become the spot on the ground state.

#3 You'd set up a changestate based off of time. So you'd have
[State 699, ChangeState]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
trigger2 = time >=150
or something very similar.

You may be able to make all of these effects using just the projectile, but I think helpers are the way to go.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Projectile questions
#3  November 14, 2015, 04:40:52 pm
  • **
  • I'm a llama!
Indeed Odb718, a helper replacement for the projectile would not only shorten most of the sloppy code but also make it more efficient. The issue is making the replacement.

As you can see, the player's own directional aiming code is already done in Sugio's code:

Its essentially this, but with "a" button, "x" button, and "a" || "x" button cases:

Code:
[State 1000, 7]
271.type = ChangeAnim
272.triggerall = Time > 12
273.triggerall = Time < 63
274.trigger1 = anim != 1005
275.trigger1 = command = "holda"
276.trigger1 = Var(0) = 0
277.trigger2 = anim != 1005
278.trigger2 = Var(10) > 0
279.trigger2 = Var(0) = 0
280.value = 1003
281.
282.[State 1000, 7]
283.type = ChangeAnim
284.triggerall = Time > 12
285.triggerall = Time < 63
286.trigger1 = anim != 1005
287.trigger1 = command = "holda"
288.trigger1 = Var(0) < 0
289.trigger2 = anim != 1005
290.trigger2 = Var(10) > 0
291.trigger2 = Var(0) < 0
292.value = 1001
293.
294.[State 1000, 7]
295.type = ChangeAnim
296.triggerall = Time > 12
297.triggerall = Time < 63
298.trigger1 = anim != 1005
299.trigger1 = command = "holda"
300.trigger1 = Var(0) > 0
301.trigger2 = anim != 1005
302.trigger2 = Var(10) > 0
303.trigger2 = Var(0) > 0
304.value = 1002

I'm trying to figure out how to make the following coding structure for the helper:

1, How to make the helper remain attached to the player's attack point for each direction based animation.

2, How to make the helper rotate according to the player's direction based animation.

Now I did some searching around for examples because do this by scratch is insanely difficult. All I need help is understanding how to integrate this into Surgio's code and replace the sloppy projectile based code.

I believe this would work for making the sprite of the helper change its angle according to the direction:

Code:
type = AngleDraw 
 trigger1 = 1
 value = ((atan(Vel Y / (Vel X + 0.00000000000001)) + (0)) * (-180 / Pi)) + ((vel x < 0) * 180)
 ignorehitpause = 1

and this is for movement:

Code:
[State x]
type = VarSet
trigger1 = !time
fvar(2) = parent,var(2) * 0.01745329
ignorehitpause = 1

[State x]
type = VelSet
trigger1 = !time
x = cos(fvar(2)) * 6
y = -(1.0 - abs(cos(fvar(2)))) * ifelse(parent,var(2) < 180, -1, 1) * 6
ignorehitpause = 1

This is the part of the code that consists of a simple counter that goes up and down to decide when and which direction to rotate the arm and shoot the helpers.

Code:
[State x]
type = null
trigger1 = var(2) > 360
trigger1 = 0 && var(2) := 0
trigger2 = var(2) < 0
trigger2 = 0 && var(2) := 360
trigger3 = time%192 < 96
trigger3 = 0 && var(2) := var(2) + 1
trigger4 = time%192 >= 96
trigger4 = 0 && var(2) := var(2) - 1
ignorehitpause = 1

[State x]
type = AngleDraw
trigger1 = 1
value = -55 - var(2)
ignorehitpause = 1


I'm really hoping you can help me figure out the other two matters and help me put this together. Coding helpers can be really challenging and I need your advice on this.












Re: Projectile questions
#4  November 15, 2015, 06:40:08 am
  • *****
  • Shame on you!
    • USA
If you want, my "heat-seeking" missiles in Samus might help you out a lot.
But instead of angle draw I'd say go a head and make the sprites you need, then switch to that sprite when needed.
 
Not knowing exactly what you mean for,
1, How to make the helper remain attached to the player's attack point for each direction based animation.
and
2, How to make the helper rotate according to the player's direction based animation.

I guess what ever is spawning the helper could either switch to a different, similar state, or animation depending on the input.
You could switch states during the spawn, or you could switch animations in the 1 and only state depending on button press.

If you do the animation route, you'll be using that value as a variable to monitor. Everything would check to see which image is being used.
If you do the states you'd make the first helper state work one way, copy/paste it, then edit it to work the second way, and paste/edit til everything works perfect.

If you can post images or a video so I can visualize whats going on, it may help a bit.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Projectile questions
#5  November 15, 2015, 05:49:19 pm
  • **
  • I'm a llama!
Quote
If you want, my "heat-seeking" missiles in Samus might help you out a lot.

Thanks, I'll look into it.

Quote
But instead of angle draw I'd say go a head and make the sprites you need, then switch to that sprite when needed.

Really? wouldn't it be more efficient to do this by code instead of excessive sprites? I mean I have them, but using draw angle may bring about some very smooth rotation animations.

Quote
1, How to make the helper remain attached to the player's attack point for each direction based animation.
and
2, How to make the helper rotate according to the player's direction based animation.

Did a bit more testing and realized that offsets control where the beam is created on the player's attack point. The second question actually brings about a fundamental issue I have with coding in Mugen.

Here are some cases of those issues:

1.

Code:
[State 1000, 3]

[State 1000, 3]
type = VarSet
trigger1 = Time = 0
v = 0
value = 0

type = VarAdd
triggerall = Var(0) > -2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
trigger1 = command = "holda"
trigger1 = command = "holdup"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 75
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y <= -50
trigger2 = P2BodyDist Y >= -100
v = 0
value = -1

[State 1000, 3]
type = VarAdd
triggerall = Var(0) < 2
triggerall = Time%4 = 0
triggerall = Time > 12
triggerall = Time < 63
trigger1 = command = "holddown"
trigger1 = command = "holda"
trigger2 = Var(10) > 0
trigger2 = P2BodyDist X <= 25
trigger2 = P2BodyDist X >= 0
trigger2 = P2BodyDist Y >= 0
v = 0
value = 1




First question is determining the main variable.  This is the code that controls how the player adjusts the vertical direction by holding the "a" button and holding either up or down. I don't know what P2BodyDistY and P2BodyDist X is suppose to do in this, nor do I know what v represents (is it referring to var(3) or var(10) or an unknown variable that I'm not aware of in the body of this code?

Second is how is this particular variable addressed on the projectile cases below:

Code:
[State 1000, 10]
type = Projectile
triggerall = Var(0) = -2
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1011
;projhitanim = 1015
projremovetime = 15+Var(2)
;offset = 18+random%2, -66
offset = ceil(18*const(size.xscale))+random%4,ceil(-66*const(size.yscale))
velocity = 5,-5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,3
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAFP
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = -1
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1013
projremovetime = 15+Var(2)
;offset = 20+random%2, -66
offset = ceil(20*const(size.xscale))+random%4,ceil(-66*const(size.yscale))
velocity = 6.1,-3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,3
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAFP
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,-1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 0
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1010
projremovetime = 15+Var(2)
;offset = 28+random%2, -58
offset = ceil(28*const(size.xscale))+random%4,ceil(-58*const(size.yscale))
velocity = 7.1,0
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,3
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAFP
guardflag = MA
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 1
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1014
projremovetime = 15+Var(2)
;offset = 20+random%2, -50
offset = ceil(20*const(size.xscale))+random%4,ceil(-50*const(size.yscale))
velocity = 6.1,3.5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,3
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAFP
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,1
palfx.time = 2
palfx.mul = 80, 80, 200

[State 1000, 10]
type = Projectile
triggerall = Var(0) = 2
trigger1 = anim != 1005
trigger1 = command = "holda"
trigger1 = Time > 12
trigger1 = Time < 63
trigger2 = anim != 1005
trigger2 = Var(10) > 0
trigger2 = Time > 12
trigger2 = Time < 63
projanim = 1012
projremovetime = 15+Var(2)
;offset = 22+random%2, -48
offset = ceil(22*const(size.xscale))+random%4,ceil(-48*const(size.yscale))
velocity = 5,5
getpower  = 0
givepower = 0
attr = S, SP
damage = 2,3
animtype = Light
pausetime = 0,0
sparkno = S1015
guard.sparkno = S4010
sparkxy = 0, 0
hitsound = S1100,1
guardsound = S100,1
hitflag = MAFP
guardflag = MA
ground.type = Low
ground.slidetime = 0
ground.hittime = 0
ground.velocity = -2
air.velocity = -2,2
palfx.time = 2
palfx.mul = 80, 80, 200

I can tell that each of these projectile cases are involving a different direction to which the beam goes. However, I'm not able to tell what makes the relationship between this projectile code and the variable setup code above.

Furthermore, I looked into Cybaster's Goku Z2, who utilized a helper for his Chou Kamehameha beam. It was quite complex with a lot of material I can't understand. Therefore, I opt to do this with projectiles.

More questions on projectiles:

Q1, How do I setup an Angledraw type property to the projectiles?


Q2, Based on the earlier code used for helpers here:


Code:
[State x]
2.type = VarSet
3.trigger1 = !time
4.fvar(2) = parent,var(2) * 0.01745329
5.ignorehitpause = 1
6.
7.[State x]
8.type = VelSet
9.trigger1 = !time
10.x = cos(fvar(2)) * 6
11.y = -(1.0 - abs(cos(fvar(2)))) * ifelse(parent,var(2) < 180, -1, 1) * 6
12.ignorehitpause = 1

I would wish to use those mathematical expressions on velset on the velocity property of the projectiles, but the fvar becomes an issue along with parent,var(2) which are variables pertaining to controlling directions on the states by keyboard presses for players and distance checking for A.I. 


Once again, the main problem can be boiled down to understanding the variables that control direction and how they can form relations with the projectiles.














Last Edit: November 15, 2015, 05:52:21 pm by Tyrannosaurus rex
Re: Projectile questions
#6  November 15, 2015, 09:53:13 pm
  • **
  • I'm a llama!
Scratch that, I have made a helper based projectile by following ynvaser's tutorial:
http://legendarysquad.smfforfree2.com/index.php?topic=18.0

Code:
;///// Helper tutorials

[State 420, Helper]         ;This summons helper
type = Helper
trigger1 = Time = 11        ;It summons when the state is at the 11th tick. Change as needed.
helpertype = normal         ;Normal, so not player XD
name = "Atomic beam" ;Give it a name, it's a good thing.
ID = 9001                   ;The indentification number of the helper
stateno = 9001              ;The helper's stateno. If you change it in the helper's state, change it here too.
pos = 50, -44               ;The position where the helper appears
postype = p1                ;It defines from where it counts the distance.
facing = 1                  ;1 is foward, -1 is backward. We want it foward.
keyctrl = 1                 ;Keep this at 1.
ownpal = 1                  ;This means that the parent's PalFX's won't affect the helper.


[State 1000, 3]
type = null
trigger1 = var(2) > 360
trigger1 = 0 && var(2) := 0
trigger2 = var(2) < 0
trigger2 = 0 && var(2) := 360
trigger3 = command = "holdx"
trigger3 = command = "holddown"
trigger3 = 0 && var(2) := var(2) + 1
trigger4 = command = "holdx"
trigger4 = command = "holdup"
trigger4 = 0 && var(2) := var(2) - 1

 
[State 1000, 3]
type = AngleDraw
trigger1 = 1
value = -55 - var(2)


;-Renzoku Projectile   ;I like to give them names
;(Used in StateNo 420) ;This is good to keep your helpers organized
[Statedef 9001]        ;Change the value to fit your needs
type = A
movetype = A
physics = N
anim = 9014            ;Change the anim to your projectile's anim. It must contain at least 1 clsn1 box.
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 10            ;Change this to fit your char
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 3       ;Adjust it, if you want the proj to be behind or in front of everyone.


[State 9001, PlayerPush] ;This disables the clsn2's pushing effect.
type = PlayerPush
trigger1 = 1
value = 0

[State 9005, Hitoverride];This will change your projectile into a specific state when getting hit
type = HitOverride
trigger1 = 1
attr = SCA, AA,AP,AT
time = -1
stateno = 9000;The number of your projectile's hitstate


[State 1000, SpriteAngle]
type = AngleDraw
trigger1 = 1
value = ((atan(Vel Y / (Vel X + 0.00000000000001)) + (0)) * (-180 / Pi)) + ((vel x < 0) * 180)


[State 1000, Movement1]
type = VarSet
trigger1 = !time
fvar(2) = parent,var(2) * 0.01745329

[State 1000, Movement2]
type = VelSet
trigger1 = !time
x = cos(fvar(2)) * 6
y = -(1.0 - abs(cos(fvar(2)))) * ifelse(parent,var(2) < 180, -1, 1) * 6


[State 9001, HitDef]
type = HitDef       
trigger1 = 1
attr = S, NA
hitflag   = MAFDP
guardflag = MA
animtype = Hard
priority = 7, Hit
damage = 10,5
pausetime = 5,5
guard.pausetime   = 15,20
sparkno   = S6150
guard.sparkno = S6150
sparkxy   = 0,40
hitsound = S1,12
guardsound = S1,12
ground.type = High
air.type = Trip
ground.slidetime = 25
ground.hittime = 25
air.hittime   = 25
ground.velocity   = -8
guard.velocity = -8
air.velocity = -8,-3.5
airguard.velocity = -8,-3.5
ground.cornerpush.veloff = 0
fall.xvelocity = -1
fall.yvelocity = -3
fall.recover = 0
air.fall = 1
down.velocity = -1,-2
down.bounce   = 1
id = 9001
getpower = 0
givepower = 25
palfx.time = 12
palfx.mul = 256,256,256
palfx.add = 200,50,10
palfx.sinadd = 175,25,5,4
envshake.time = 12
envshake.freq = 120
envshake.ampl = -4
persistent = 0

[State 9001, DestroySelf]              ;The finale. It destroys the helper in specific circumstances
type = DestroySelf
trigger1 = MoveContact             ;First condition. It destroys when the projectile hits.
trigger2 = FrontEdgeBodyDist < -30 ;Second condition. It destroys when the x distance from the front*
ignorehitpause = 1                       ;*vertical wall is smaller than -30 (so when the distance is -31 or smaller)


[State 9000, DestroySelf];Destroys the helper instantly
type = DestroySelf
trigger1 = Time = 0
ignorehitpause = 1


I have made changes to it like setting keyctrl = 1, because I want to be able to rotate the helper with my directional key presses. As of now, I'm not unsure about a few things regarding it:

1. How the state numbers are labelled. I'm not sure I understand how the states are meant to be labelled in a helper given how Mugen reads them.
2. Is the null type on the very top correctly in place? or does it go in the player's state?
3. Any other corrections would be greatly appreciated.

I'm still new to helpers.








Re: Projectile questions
#7  November 16, 2015, 05:47:03 am
  • *****
  • Shame on you!
    • USA
the "V" you didnt know, it's actually naming the variable to change.
V = 3 would be var(3)
V = 37 would be var(37)

type = null actually comments out the entire chunk of code. The triggers will still activate, but what it's original purpose was wont activate.
Try commenting out all of the null like
;[State 1000, 3]
;type = null
;trigger1 = var(2) > 360
;trigger1 = 0 && var(2) := 0
;trigger2 = var(2) < 0
;trigger2 = 0 && var(2) := 360
;trigger3 = command = "holdx"
;trigger3 = command = "holddown"
;trigger3 = 0 && var(2) := var(2) + 1
;trigger4 = command = "holdx"
;trigger4 = command = "holdup"
;trigger4 = 0 && var(2) := var(2) - 1

and see if anything changes. The := may have an affect but I'm not certain.

Helpers get a regular statedef just like a regular action would. You can send a helper into any statedef P1 can go into. The numbering doesnt really matter at all. It's just whatever's easier for you to work with. Say statedef 1300 calls for a helper. Some people would make it statedef 1301, some might want it to be statedef 11300. Some might use 2534. It wont matter in the long run.

I said to use the sprite method because it's easier for me to code. I'd watch what animation was currently being used and watch it like a variable. If you can use angledraw and keep everything lined up, you'll get a better animation like you said.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Projectile questions
#8  November 16, 2015, 06:40:42 pm
  • **
  • I'm a llama!
I think I'm close to resolving the issue with making the helper rotate by the action of the keyboard.

Code:
[State 3000 , 40-chama flames]
type = Helper
blah
blah
blah

[State 3000, 42-chama sobe ou desce]
type = varadd
trigger1 = command="holdup" ^^ command="holddown"
var(7) = (command="holdup")-(command="holddown")

[State 3000, 44-limita o angulo em 45 graus]
type = varset
trigger1 = abs(var(7)) > 45
var(7) = 45 * (var(7)/abs(var(7)))

[Statedef 1101]   ;beam itself
type    = S
movetype= A
physics = N
juggle  = 2
velset = 0,0
anim = 1102
ctrl = 0
sprpriority = 2

[State 3030 , 7-Facing]
type = AngleSet
trigger1 = time=0
value = 0

[State 3030 , 6]
type = Angleset
trigger1 = 1
value = parent,var(7)
 
[State 3030 , 5]
type = AngleDraw
trigger1 = 1

It does the angle adjustment by keypressing "up" or "down" correctly. However, I have two issues with this:

1, If the projectile is fired once and its direction is changed by pressing the up/down keys, the second time we use the projectile, its direction is automatically facing the previous projectile's direction instead of being straight. 

2, I'm wondering how I can setup a velocity state in which the x and y values are formulated with the correct angle.



Re: Projectile questions
#9  November 16, 2015, 08:43:01 pm
  • *****
  • Shame on you!
    • USA
With the angle being the last angle, just set all your variables back to 0 at time = 0. You have to reset the state.

with the proper speed vs angle you could probably do something like
y = floor(10 - (vel x) )
so that the total speed would never exceed 10.
On my missile I never bothered with trying to figure that out, I only limited the vel y within a certain range.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Projectile questions
#10  November 17, 2015, 07:48:06 pm
  • **
  • I'm a llama!
Quote
with the proper speed vs angle you could probably do something like
y = floor(10 - (vel x) )
so that the total speed would never exceed 10.
On my missile I never bothered with trying to figure that out, I only limited the vel y within a certain range.

Not what I had in mind but thanks for the input. What I meant to say was that since its depending on var(7) to record it, I'm wondering how I can use something like tan(var) to know the X multiplier, and 1/(tan(var)) for Y multiplier. There is the parent,var(7) confusion in this as well.

Recall, that var(7) is setup like this:

Code:
[State 3000, 42-chama sobe ou desce]
type = varadd
trigger1 = command="holdup" ^^ command="holddown"
var(7) = (command="holdup")-(command="holddown")
 
[State 3000, 44-limita o angulo em 45 graus]
type = varset
trigger1 = abs(var(7)) > 45
var(7) = 45 * (var(7)/abs(var(7)))