P1 appears in exact location from P2 regardless of screen pos

Started by JustNoPoint, August 25, 2016, 04:26:39 AM

Previous topic - Next topic

JustNoPoint

Here's the move.

P1 teleports X distance behind P2 and attacks

The issue is that X seems to change depending on where they are in regards to the movement of the screen. So if their back is near the edge of the screen or camera edge P1 appears right behind them. However if there is a lot of distance between the back of P2 and the edge then it teleports more accurately. The attack is supposed to travel some distance before it hits P2. Not appear right behind them.

Here's what I have right now

[State 0, PosSet]
type = PosSet
trigger1 = !Time
x = Cond(Facing = -1,(enemy, Pos X)-150,(enemy, Pos X)+150)

[State 0, Width]
type = Width
trigger1 = !Time
edge = -100,0
player = 100,0

[State 0, Turn]
type = Turn
trigger1 = AnimElem = 2

Vans

Calculate distance between p1 and p2 and use a posadd to move to where you want.

If you don't care about simul, you can just use "p2dist" + offset as the value.

JustNoPoint

I'd already tried P2Dist and P2BodyDist + offset and it didn't work right either. Many times P1 won't even go to the opposite side of P2. Using Pos was the only reliable way to get P1 to do so.

Just tried P2Dist with PosAdd instead of PosSet and got the same thing. I'll try to calculate instead.

Vans

Can I look at the way you did it with the posadd? Is the teleport at least accurate for the "y" axis?

What do you mean by "travel" some distance? Are you attempting to make the move look the same regardless of screen position?

I'm guessing you are using width to push P2 out of the corner so P1 can move behind them?

JustNoPoint

#4
Quote from: Vans on August 25, 2016, 05:06:11 AM
Can I look at the way you did it with the posadd?
I'd tried these 2 ways (2nd way commented out)

[State 0, PosSet]
type = PosAdd
trigger1 = !Time
x = P2Dist X +150;Cond(Facing = -1,(P2Dist X )-150,(P2Dist X )+150)

QuoteIs the teleport at least accurate for the "y" axis?
Yes P1 doesn't need to move from his initial Y axis

QuoteWhat do you mean by "travel" some distance?
When P2 appears he is charging toward P1

QuoteAre you attempting to make the move look the same regardless of screen position?
Yes

QuoteI'm guessing you are using width to push P2 out of the corner so P1 can move behind them?
Yep

Vans

Is player 2 a target?

If player 2 is not a target, one possibility I can think of is this:

1. If the teleport will go off-screen, calculate how far off-screen p1 will go, and adjust your posadd so they only move '1' pixel away from P2.
2. Use screenbound and playerpush to make sure P1 can go offscreen this 'magic' pixel.
3. Once they have moved the magic pixel assert playerpush so they move p2 back into the screen,
4. Assert width to push p2 to where you want them to be.

If player 2 is a target, then:

1. If the teleport will go off-screen, move p2 to the position of p1.
2. Use a targetbind to place them where you want.

altoiddealer

I don't think Width controller will push the enemy back, without a blue hitbox


JustNoPoint

Quote from: Vans on August 25, 2016, 05:17:50 AM
Is player 2 a target?
I didn't set P2 as a target. 1 second while I attempt to do this using altoiddealer's method

Quote from: altoiddealer on August 25, 2016, 05:20:55 AM
You might just need to Floor that value
Which value?

altoiddealer



Vans

If you're just testing vs a single player, ID checking will only complicate your code. "P2" type triggers automatically check for the closest player.

If your move is using a target, you should be using target triggers anyway.

altoiddealer

I think the issue is that your Width is lower priority to the PosSet, so in that instant P2 is getting snapped to your default width.

Try putting Width above PosSet


Vans

That's not correct. He wants to push p2 after he moves behind them.

altoiddealer

#12
Well try making it persistent?

By what Odb posted in Width topic (MUGEN Class), he made it sound like the effects of Widtth only trigger when blue CLSN boxes overlap - the players then snap to the edges of their width boxes.

Therefore I believe they are snapping to default width before their boxes touch again


Vans

"Persistent" makes no sense as he's triggering the controller for 1 tick.

Quote from: altoiddealer on August 25, 2016, 05:39:18 AM
Therefore I believe they are snapping to default width before their boxes touch again

Default width should be more than enough since both players will be (at most) 1 pixel away from each other in the corner scenario.

The problem is not the width controller.

JustNoPoint

I assume I can't have P1 appear outside of the playable screen. That's why I put the width parameter. When P1 appears behind P2 he pushes P2 away. Otherwise P2 has very little time to react to the attack.

And if I made it where P1 appeared off screen I have no idea what would happen if he somehow got hit while offscreen :P

I can also try applying the width for more than 1 tick. Let me test a few things

Vans

P1 can only appear offscreen if ScreenBound allows him to. As soon as you disable the flag, they are pushed back to the nearest corner.

That's why I suggested moving P1 offscreen 1 pixel (for one ghost frame!) so you could adjust distance the way you want.


JustNoPoint

Ugh it's still not working correctly.

Spoiler: code (click to show)
[State 0, PosAdd]
type = PosAdd
trigger1 = !Time
x = P2Dist X +250;Cond(Facing = -1,(enemy, Pos X)-150,(enemy, Pos X)+150)

[State 0, ScreenBound]
type = ScreenBound
trigger1 = !Time
value = 0

[State 0, Width]
type = Width
trigger1 = !Time
edge = 1,0
player = 150,0

[State 0, Turn]
type = Turn
trigger1 = AnimElem = 2

The issue isn't really the camera. P1 always appears at slightly different locations behind P2 depending on their location on the screen and the edge.

Examples

Do the move right after round 1 neither chars move from starting point. P1 appears right behind P2 because of the camera edge of screen.

P1 walks to left edge of screen back to the wall. P2 right in front of P1. Move appears far behind P2.

I think I need to resolve this before I can resolve the out of screen issue

Vans

That's actually the intended behavior! You are moving 250 pixels off, that's a huge amount.

If you look at it frame by frame, I am sure P1 is offscreen for 1 frame in the first scenario you mentioned.

In order to push p2 away (as altoiddealer said) you will need a big enough CLSN2 AND the width controller. You can use a pushing helper for this, all you need is an empty animation with big enough CLSN2 and a nothitby + playerpush asserted.

You're close.

JustNoPoint

But it shouldn't push P2 away if P2 is just at the edge of the camera and P2 has lots of screen left behind himself. It should only push P2 if he's on the corner of the screen.

See what I'm saying?

altoiddealer

[State 0, Screenbound]
type = Screenbound
trigger1 = !Time

[State 0, PosSet]
type = PosAdd
trigger1 = !Time
x = Cond(abs(PlayerID(var(59)),BackEdgeDist <= 0,P2Dist X + 1,P2Dist X + 150)
;using PlayerID

[State 0, Width]
type = Width
trigger1 = !Time
edge = -100,0
player = 100,0

[State 0, Turn]
type = Turn
trigger1 = AnimElem = 2