YesNoOk
avatar

Falling projectile problem (Read 1133 times)

Started by Creamy_Goodness, September 10, 2024, 07:53:45 am
Share this topic:
Falling projectile problem
#1  September 10, 2024, 07:53:45 am
  • ***
    • USA
    • creamyg.jdluke.com/

> It's been quite a while since I posted last. I'm working on a new character, and I'm almost done with it, but I'm having trouble with one of the super attacks. A projectile drops from the sky and is supposed to land on the ground, then disappear after a second. However, the projectile instead disappears just before hitting the ground. Here's the code for the Projectile state controller...

[State 3100, Projectile]
type = Projectile
trigger1 = AnimElem = 8 ;kicks in when animation reaches its eighth frame
attr = S, HP ;Attributes (Standing, Super Projectile)
damage = 180, 18 ;Damage points to deal
getpower = 0, 0
givepower = 180, 18
guardflag = MA ;Can be blocked by standing or aerial opponent
ground.type = High ;opponent goes into hit high animation
animtype = Hard ;opponent goes into hit hard animation
ground.hittime = 10 ;opponent recovery time
ground.velocity = 0 ;how fast grounded opponent slides back
ground.slidetime = 1 ;how long opponent slides back
air.velocity = 0, 5 ;how fast aerial opponent slides back
fall = 1 ;knocks down opponent
sparkno = -1 ;displays no spark
palfx.add = 250, 0, 0 ;opponent turns red
palfx.sinadd = 120, 60, 60, 10 ;opponent's flashing effect
palfx.time = 30 ;opponent's color change effect lasts for 30 ticks
hitsound = S0, 7 ;plays Slam - Normal (sound effect)
guardsound = S0, 10 ;plays Hard hit - Blocked (sound effect)
ProjID = 3161 ;ID number of projectile
projanim = 3161 ;projectile animation (sprites)
;projhitanim = 3271 ;projectile spark (sprites)
projremove = 0 ;does not self destruct after hit
projremovetime = 60 ;projectile self destructs automatically after 60 ticks
velocity = 0, 5 ;how fast projectile moves
;remvelocity = 0, 0 ;how fast spark moves while it self destructs
accel = 0, 1 ;changes velocity of projectile
projhits = -1 ;number of times projectile hits before it self destructs
postype = p2
offset = 0, -500 ;adjusts the projectile's origin 500 pixels directly above opponent
afterimage.length = 10 ;after image lags 50 ticks above anvil
afterimage.time = 20 ;after image lasts for 20 ticks

> Any suggestions?
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/
Last Edit: September 12, 2024, 08:53:45 am by Creamy_Goodness
Re: Falling projectile problem
#2  September 10, 2024, 12:42:01 pm
  • ******
    • Portugal
    • network.mugenguild.com/pots/
Try using projheightbound instead of removetime.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: Falling projectile problem
#3  September 11, 2024, 05:02:52 am
  • ***
    • USA
    • creamyg.jdluke.com/

> Thanks for the advice, Phantom. I replaced "projremovetime = 60" with "projheightbound = -100, 100", and now the projectile simply passes through the ground instead of just disappearing in mid-air. Now, I just have to figure out how to get it to stop when it hits the ground, then disappear after a second. Is this something that can be done with a projectile, or do I need to use a helper for that?
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/
Last Edit: September 11, 2024, 08:35:02 am by Creamy_Goodness
Re: Falling projectile problem
#4  September 11, 2024, 03:20:55 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Quote
do I need to use a helper for that?
Yes
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Falling projectile problem
#5  September 11, 2024, 06:47:49 pm
  • ******
    • Portugal
    • network.mugenguild.com/pots/
I think your settings of -100, 100 will make it disappear 100 pixels below the ground, which is why you wouldn't see it. But yeah if you want a very specific behavior for it you may need a helper.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: Falling projectile problem
#6  September 12, 2024, 08:52:05 am
  • ***
    • USA
    • creamyg.jdluke.com/

> OK, I fixed the problem. All I had to do was switch from using a projectile to using a helper instead. I replaced the projectile code with this...

[State 3100, Helper]
type = Helper ;type of state: Helper
trigger1 = AnimElem = 8 ;kicks in when animation reaches its eighth frame
PosType = p2
Pos = 0, -500 ;adjusts the projectile's origin 500 pixels directly above opponent
StateNo = 3161 ;projectile's custom state


> And then used the following code for the helper...

; Anvil Gag - Projectile

[Statedef 3161]
physics = N ;switches to neutral physics
movetype = A ;activates red hitboxes
juggle = 4 ;attack costs 4 juggle points
anim = 3161 ;helper appears as Anvil Gag - Projectile (sprites)
velset = 0, 5 ;how fast projectile moves

[State 3161, Velocity Multiply]
type = VelMul
trigger1 = Time = 0 ;kicks in immediately
y = 5 ;Projectile accelerates downward

[State 3161, After Image]
type = AfterImage
trigger1 = AnimElem = 1 ;kicks in when animation reaches its first frame
length = 10 ;after images lags 10 ticks behind projectile
time = 20 ;after images last for 20 ticks

[State 3161, HitDef]
type = HitDef
trigger1 = Time = 0 ;kicks in immediately
attr = S, HP ;Attributes (Standing, Super Projectile)
damage = 180, 18 ;Damage points to deal
getpower = 0, 0
givepower = 180, 18
hitflag = MAFD ;Can hit standing, aireal, falling, and lying down opponent
guardflag = MA ;Can be blocked by standing or aerial opponent
ground.type = High ;opponent goes into hit high animation
animtype = Hard ;opponent goes into hit hard animation
ground.hittime = 10 ;opponent recovery time
ground.velocity = 0 ;how fast grounded opponent slides back
ground.slidetime = 1 ;how long opponent slides back
air.velocity = 0, 5 ;how fast aerial opponent slides back
fall = 1 ;knocks down opponent
sparkno = -1 ;displays no spark
hitsound = S0, 8 ;plays Slam - Super (sound effect)
guardsound = S0, 10 ;plays Hard hit - Blocked (sound effect)

[State 3161, Velocity Set]
type = VelSet
trigger1 = Pos Y >= -5
;^kicks in if projectile is 5 pixels above the ground or lower^
x = 0 ;Projectile does not move horizontally
y = 0 ;Projectile does not move vertically

[State 3161, Play Sound]
type = Playsnd ;type of state: Play Sound
trigger1 = Pos Y >= -25
;^kicks in if projectile is 25 pixels above the ground or lower^
trigger1 = Vel Y > 0 ;kicks in if projectile is not falling
trigger1 = P2MoveType != H
value = S0, 8 ;plays Slam - Super (sound effect)

[State 3161, Environment Shake]
type = EnvShake ;Shakes the screen
trigger1 = Pos Y >= -25
;^kicks in if projectile is 25 pixels above the ground or lower^
trigger1 = Vel Y > 0 ;kicks in if projectile is not falling
Time = 30 ;Screen shakes for 30 ticks
Ampl = -5 ;How far up & down the screen shakes
Freq = 100 ;How fast the screen shakes

[State 3161, Destroy Self]
type = DestroySelf ;type of state: Destroy Self
trigger1 = Time = 80 ;kicks in after 80 ticks into the animation


> The attack does everything I want it to do, except for two things. One, I couldn't get the PalFX to work, but there's a chance I'll try again later. And two, I need a whistle sound, but I'll probably include one in the second version of the character. Thanks for all your help, and I can now mark this topic as Solved.
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/