Spawn explods based on P2 pos

Started by Drue, December 07, 2012, 08:41:55 AM

Previous topic - Next topic

Drue

Hello! I wonder if this is even possible, or if there's a way around the restrictions of the program, but I'm trying to create a character that will spawn an explod (say, a zombie) when P2 reaches a certain point on the screen. For example, P1 starts at pos 0,-70 and P2 starts at pos 0,70. With P1 standing still and P2 reaching pos 0,0, a zombie spawns behind them. That's the effect I'm after. Below is the cns. and cmd. code I wrote as an attempt to baby-step toward the goal, so bear in mind that I know it's not only very wrong, but very basic as well! I'm CERTAIN I'm going about this the wrong way, so any enlightenment would be greatly appreciated. Thanks!

Spoiler (click to show)

CNS.:
;---------------------------------------------------------------------------
;::::::P2 POS TEST STATE II
[Statedef 406]
type = S
ctrl = 0
anim = 406

[State 406, TESTING]
type = Explod
trigger1 = Time = 1
anim = 405
removetime = 100

[State 406, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------



CMD.:
;---------------------------------------------------------------------------
;::::::P2 POS TEST STATE
[State -1, TEST STATE]
type = ChangeState
value = 405
trigger1 = P2 = ScreenPos x = 0 ; fail
trigger1 = P2Dist x =70 ; fail
trigger1 = P2 = Pos x = 0 ; fail
trigger1 = P2BodyDist x = 0 ; fail
trigger1 = WTF, YOU F*CKIN' F*CK?!?!? = *A HUNDRED MILLION!!! ; fail
;---------------------------------------------------------------------------

Rajaa Retired

#1
The middle of the stage always stays the same; screenpos always stays the same (in terms of values relative to any given character's position).

Screenpos X: Left side of the screen is 0, right side of the screen is gamewidth.
Pos X: Left of the center of the stage is negative, right of the center of the stage is positive.



// Relative to the center of the stage:

cond(enemy,facing = 1, enemy,pos x > 0, enemy,pos x <= 0)

// Relative to the center of the screen:

cond(enemy,facing = 1, enemy,screenpos x > gamewidth * 0.5, enemy,screenpos x <= gamewidth * 0.5)


Drue

That points me in the EXACT correct direction! Thank you so much!