YesNoOk
avatar

Pikachu's helpers abruptly disappearing when stage is at max. zoom. (Read 50100 times)

Started by DNZRX768, May 21, 2023, 01:58:01 am
Share this topic:
Pikachu's helpers abruptly disappearing when stage is at max. zoom.
#1  May 21, 2023, 01:58:01 am
  • *****
  • Hug Pikachus!
    • USA
Per the readme from my latest version of New Pikachu that was released today:

There seems to be an issue that the helpers from Pikachus' Air Mail are disappearing prematurely when New Pikachu and the opponent are on the furthest possible opposite sides of a stage with zooming enabled. The helpers are supposed to disappear after moving off screen. Instead, they are disappearing while onscreen, making it all very unsightly.

See the video here:

https://files.catbox.moe/vh0t5i.mp4

This problem escaped my notice for so long due to myself not having MUGEN 1.1, nor any stages that has zoom enabled, for the longest time. This video is tested within the Ikemen_GO-v0.99.0-rc.1-windows program.

Here is the relevant coding:

Code:
;---------------------------------------------------------------------------
;=| Coding for New Pikachu's Air Mail Move by DNZRX |=======================
;---------------------------------------------------------------------------

;Start of the move itself
[Statedef 3030]
type=S
movetype=A
physics=S
poweradd=-1000 ;The Super Move costs 1000 energy
ctrl=0
velset=0
anim=1030
juggle = 15

[State 1040 , SuperPause]
type=SuperPause
trigger1=Time = 1
sound = 20, 0
pos=-8, -31
;Pause the game for a few moments to signal the start of the super move, complete with sounds and charging graphics effects.

[State 1040 , PlaySnd]
type=PlaySnd
trigger1=Time = 6
channel = 0
value = 0, 2
;"Pikachu!"

;--Create Pikachu mail helpers!--

[State 1040, Pikachu mail 1]
type = Helper
trigger1 = Time = 50 || Time = 56 || Time = 70 || Time = 86
ID = 1041
name = "mail pika 1"
StateNo = 9000
postype = back
pos = -45, 0
ownpal = 1
;4 Helpers with flight height of 0 pixels above ground

[State 1040, Pikachu mail 2]
type = Helper
trigger1 = Time = 50 || Time = 58 || Time = 73 || Time = 110
ID = 1042
name = "mail pika 2"
StateNo = 9001
postype = back
pos = -45, -10
ownpal = 1
;4 Helpers with flight height of 10 pixels above ground

[State 1040, Pikachu mail 3]
type = Helper
trigger1 = Time = 40 || Time = 50 || Time = 60 || Time = 70 || Time = 120
ID = 1043
name = "mail pika 3"
StateNo = 9002
postype = back
pos = -45, -20
ownpal = 1
;5 Helpers with flight height of 20 pixels above ground

[State 1040, Pikachu mail 4]
type = Helper
trigger1 = Time = 55 || Time = 65 || Time = 80 || Time = 95 || Time = 105
ID = 1044
name = "mail pika 4"
StateNo = 9003
postype = back
pos = -45, -30
ownpal = 1
;5 Helpers with flight height of 30 pixels above ground

[State 1040, Pikachu mail 5]
type = Helper
trigger1 = Time = 80 || Time = 100 || Time = 130
ID = 1045
name = "mail pika 5"
StateNo = 9004
postype = back
pos = -45, -40
ownpal = 1
;3 Helpers with flight height of 40 pixels above ground

[State 1040 , 10]
type=ChangeState
trigger1 = Time > 135
value=0
ctrl=1
;End the move.

;===Coding for the Pikachu mail helpers themselves!===

;pikachu helpers, 0 pixels above ground!
[Statedef 9000]
type = A
movetype = A
physics = n
anim = (1040+(random%10))
sprpriority = 3
velset = ((random%10)+4), 0
;The Helper will have a randomly-selected animation whose number is between 1040 and 1049. The x-axis velocity is set to anywhere between 4 and 13 units per tick.

;With regards to which animation number corresponds to which animation, refer to the following list:
;1040: Pikachu with Winged-Envelope Mail
;1041: Pikachu in a light-blue Mail Truck
;1042: Flying Pikachu with Wings
;1043: A Pikachu-Faced Cube, flying on Star Balloons
;1044: Pikachu in a purplish-blue-celestial-themed Hot Air Balloon
;1045: Pikachu in a midnight-blue-and-gold-striped jeep
;1046: Pikachu rolling and moving a Pokeball
;1047: Flying Pikachu with Ballons
;1048: Pikachu in a gradient-blue-and-thuderbolt jeep
;1049: A Golden-Shiny-and-Fancy Pikachu Car
;This list will need to be updated if the sprites gets modified

[State 9000, 2]
type = NotHitBy
trigger1 = 1
value = ,AT
;Helpers are not hit by any throws at all

[State 9000, 3]
type = HitOverride
trigger1 = Time >= 0
attr = SCA, NA, SA, HA, NP, SP, HP, AT
stateno = anim+10
time = -1
;If the helpers are hit and intercepted by anything else other than throws (attacks, projectiles, etc), the helpers will get sent flying off screen and be neutralized.
;The stateno part will send the helper to the appropiate state based on animation.

[State 9000, 6]
type = HitDef
trigger1 = time = 0
attr = A, HA
hitflag = MAFD
guardflag = MA
pausetime = 1, 11
priority = 7, Hit
animtype = Hard
damage = 10, 2
sparkno = 3
sparkxy = -5, -34
hitsound = 5, 3
guardsound = 6, 0
ground.type = high
ground.velocity = -1.5
air.type = low
air.velocity = -1.5
air.hittime = 20
down.velocity = -1.5
down.hittime = 20
guard.slidetime = 21
guard.hittime = 21
guard.velocity = -8
fall = 1
air.fall = 1
fall.recover = 0
givepower = 15
getpower = 0

[State 9000, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = Facing = 1
trigger1 = ScreenPos X >= 410
trigger2 = Facing = -1
trigger2 = ScreenPos X <= -90
;The Helper will go away and disappear after going offscreen for a bit.

;pikachu helpers, 10 pixels above ground!
[Statedef 9001]
type = A
movetype = A
physics = n
anim = (1040+(random%10))
sprpriority = 3
velset = ((random%10)+4), 0

;Most of the coding here is similar to State 9000's coding. Refer to State 9000's coding for notes, information, and comments.

[State 9001, 2]
type = NotHitBy
trigger1 = 1
value = ,AT

[State 9001, 3]
type = HitOverride
trigger1 = Time >= 0
attr = SCA, NA, SA, HA, NP, SP, HP, AT
stateno = anim+10
time = -1

[State 9001, 6]
type = HitDef
trigger1 = time = 0
attr = A, HA
hitflag = MAFD
guardflag = MA
pausetime = 1, 11
priority = 7, Hit
animtype = Hard
damage = 10, 2
sparkno = 3
sparkxy = -5, -34
hitsound = 5, 3
guardsound = 6, 0
ground.type = high
ground.velocity = -1.5
air.type = low
air.velocity = -1.5
air.hittime = 20
down.velocity = -1.5
down.hittime = 20
guard.slidetime = 21
guard.hittime = 21
guard.velocity = -8
fall = 1
air.fall = 1
fall.recover = 0
givepower = 15
getpower = 0

[State 9001, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = Facing = 1
trigger1 = ScreenPos X >= 410
trigger2 = Facing = -1
trigger2 = ScreenPos X <= -90
;The Helper will go away and disappear after going offscreen for a bit.

;pikachu helpers, 20 pixels above ground!
[Statedef 9002]
type = A
movetype = A
physics = n
anim = 1040
sprpriority = 3
velset = 7, 0
;Unlike States 9000 and 9001, the Helper will have a specific animation: 1040: Pikachu with Winged-Envelope Mail.
;The x-axis velocity is set to 7 units per tick without variation.

[State 9002, VelSet]
type = VelSet
trigger1 = (Time%15) = 0
y = 3*sin(Time)
;The y-axis velocity is set to that sine equation's solution. This will make the helper move up and down like a sine wave.

[State 9002, 2]
type = NotHitBy
trigger1 = 1
value = ,AT

[State 9002, 3]
type = HitOverride
trigger1 = Time >= 0
attr = SCA, NA, SA, HA, NP, SP, HP, AT
stateno = anim+10
time = -1
;The state that this helper will go to will always be 1050.

[State 9002, 6]
type = HitDef
trigger1 = time = 0
attr = A, HA
hitflag = MAFD
guardflag = MA
pausetime = 1, 11
priority = 7, Hit
animtype = Hard
damage = 10, 2
sparkno = 3
sparkxy = -5, -34
hitsound = 5, 3
guardsound = 6, 0
ground.type = high
ground.velocity = -1.5
air.type = low
air.velocity = -1.5
air.hittime = 20
down.velocity = -1.5
down.hittime = 20
guard.slidetime = 21
guard.hittime = 21
guard.velocity = -8
fall = 1
air.fall = 1
fall.recover = 0
givepower = 15
getpower = 0

[State 9002, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = Facing = 1
trigger1 = ScreenPos X >= 410
trigger2 = Facing = -1
trigger2 = ScreenPos X <= -90
;The Helper will go away and disappear after going offscreen for a bit.

;pikachu helpers, 30 pixels above ground!
[Statedef 9003]
type = A
movetype = A
physics = n
anim = 1040
sprpriority = 3
velset = 10, 0
;the Helper will have a specific animation: 1040: Pikachu with Winged-Envelope Mail.
;The x-axis velocity is set to 10 units per tick without variation.

[State 9003, 2]
type = NotHitBy
trigger1 = 1
value = ,AT

[State 9003, 3]
type = HitOverride
trigger1 = Time >= 0
attr = SCA, NA, SA, HA, NP, SP, HP, AT
stateno = anim+10
time = -1
;The state that this helper will go to will always be 1050.

[State 9003, 6]
type = HitDef
trigger1 = time = 0
attr = A, HA
hitflag = MAFD
guardflag = MA
pausetime = 1, 11
priority = 7, Hit
animtype = Hard
damage = 9, 9
sparkno = 3
sparkxy = -5, -34
hitsound = 5, 3
guardsound = 6, 0
ground.type = high
ground.velocity = -1.5
air.type = low
air.velocity = -1.5
air.hittime = 20
down.velocity = -1.5
down.hittime = 20
guard.slidetime = 21
guard.hittime = 21
guard.velocity = -8
fall = 1
air.fall = 1
fall.recover = 0
givepower = 15
getpower = 0

[State 9003, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = Facing = 1
trigger1 = ScreenPos X >= 410
trigger2 = Facing = -1
trigger2 = ScreenPos X <= -90
;The Helper will go away and disappear after going offscreen for a bit.

;pikachu helpers, 40 pixels above ground!
[Statedef 9004]
type = A
movetype = A
physics = n
anim = 1040
sprpriority = 3
velset = 12, 0
;the Helper will have a specific animation: 1040: Pikachu with Winged-Envelope Mail.
;The x-axis velocity is set to 12 units per tick without variation.

[State 9004, 2]
type = NotHitBy
trigger1 = 1
value = ,AT

[State 9004, 3]
type = HitOverride
trigger1 = Time >= 0
attr = SCA, NA, SA, HA, NP, SP, HP, AT
stateno = anim+10
time = -1
;The state that this helper will go to will always be 1050.

[State 9004, 6]
type = HitDef
trigger1 = time = 0
attr = A, HA
hitflag = MAFD
guardflag = MA
pausetime = 1, 11
priority = 7, Hit
animtype = Hard
damage = 10, 2
sparkno = 3
sparkxy = -5, -34
hitsound = 5, 3
guardsound = 6, 0
ground.type = high
ground.velocity = -1.5
air.type = low
air.velocity = -1.5
air.hittime = 20
down.velocity = -1.5
down.hittime = 20
guard.slidetime = 21
guard.hittime = 21
guard.velocity = -8
fall = 1
air.fall = 1
fall.recover = 0
givepower = 15
getpower = 0

[State 9004, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = Facing = 1
trigger1 = ScreenPos X >= 410
trigger2 = Facing = -1
trigger2 = ScreenPos X <= -90
;The Helper will go away and disappear after going offscreen for a bit.

Can anyone figure out the problem?

Hug the Pikachus!

Hug A Pikachu Today!
Re: Pikachu's helpers abruptly disappearing when stage is at max. zoom.
#2  May 21, 2023, 07:25:55 am
  • ****
  • it's me
  • Bat's a Wrap.
    • Chile
    • koakoa@jabber.org
    • Skype - koakumadevil69
I think the problem is that you're using screenpos, which returns the position of the character relative to the screen. However when the stage zooms out, it effectively increases the range of values screenpos can take from the screen's width to as long as the view is, potentially causing false positives. Screenpos can also give different results depending on whether you're playing on widescreen or 4:3.

When I found out about this, I switched all screenpos triggers to frontedgedist for when projectiles are going forwards (vel x >= 0) and backedgedist when projectiles are going backwards (vel x < 0). A typical calculation is frontedgedist < -(projectile_width + offscreen_leniency). And Looking at your screenpos triggers you could probably use frontedgedist < -90 and backedgedist < -90. In other words, I would rewrite your destroyself like so:
Code:
[State 9004, 9]
type = DestroySelf
triggerall = ishelper;
trigger1 = vel x >= 0
trigger1 = frontedgedist < -90
trigger2 = vel x < 0
trigger2 = backedgedist < -90
Yeaaaah im shootign ducks wiht the paino
Re: Pikachu's helpers abruptly disappearing when stage is at max. zoom.
#3  May 21, 2023, 03:46:29 pm
  • *****
  • Hug Pikachus!
    • USA
The solution worked. Thanks.
Hug the Pikachus!

Hug A Pikachu Today!