YesNoOk
avatar

P1 appears in exact location from P2 regardless of screen pos (Read 5366 times)

Started by JustNoPoint, August 25, 2016, 04:26:39 am
Share this topic:
P1 appears in exact location from P2 regardless of screen pos
#1  August 25, 2016, 04:26:39 am
  • ******
    • www.justnopoint.com/
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
Re: P1 appears in exact location from P2 regardless of screen pos
#2  August 25, 2016, 04:57:19 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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.
Re: P1 appears in exact location from P2 regardless of screen pos
#3  August 25, 2016, 05:03:47 am
  • ******
    • www.justnopoint.com/
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.
Re: P1 appears in exact location from P2 regardless of screen pos
#4  August 25, 2016, 05:06:11 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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?
Re: P1 appears in exact location from P2 regardless of screen pos
#5  August 25, 2016, 05:15:55 am
  • ******
    • www.justnopoint.com/
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)

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

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

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

Quote
I'm guessing you are using width to push P2 out of the corner so P1 can move behind them?
Yep
Last Edit: August 25, 2016, 05:26:42 am by Just No Point
Re: P1 appears in exact location from P2 regardless of screen pos
#6  August 25, 2016, 05:17:50 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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.
Last Edit: August 25, 2016, 05:23:37 am by Vans
Re: P1 appears in exact location from P2 regardless of screen pos
#7  August 25, 2016, 05:20:55 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I don't think Width controller will push the enemy back, without a blue hitbox

Re: P1 appears in exact location from P2 regardless of screen pos
#8  August 25, 2016, 05:23:06 am
  • ******
    • www.justnopoint.com/
Re: P1 appears in exact location from P2 regardless of screen pos
#9  August 25, 2016, 05:24:05 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Yeah forget my floor comment heh :)

Re: P1 appears in exact location from P2 regardless of screen pos
#10  August 25, 2016, 05:26:34 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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.
Re: P1 appears in exact location from P2 regardless of screen pos
#11  August 25, 2016, 05:30:34 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
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

Re: P1 appears in exact location from P2 regardless of screen pos
#12  August 25, 2016, 05:33:24 am
  • ****
    • China
    • http://vans.trinitymugen.net/
That's not correct. He wants to push p2 after he moves behind them.
Re: P1 appears in exact location from P2 regardless of screen pos
#13  August 25, 2016, 05:39:18 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
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

Last Edit: August 25, 2016, 05:42:19 am by altoiddealer
Re: P1 appears in exact location from P2 regardless of screen pos
#14  August 25, 2016, 05:41:38 am
  • ****
    • China
    • http://vans.trinitymugen.net/
"Persistent" makes no sense as he's triggering the controller for 1 tick.

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.
Re: P1 appears in exact location from P2 regardless of screen pos
#15  August 25, 2016, 05:44:26 am
  • ******
    • www.justnopoint.com/
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
Re: P1 appears in exact location from P2 regardless of screen pos
#16  August 25, 2016, 05:47:20 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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.

Re: P1 appears in exact location from P2 regardless of screen pos
#17  August 25, 2016, 05:51:45 am
  • ******
    • www.justnopoint.com/
Ugh it's still not working correctly.

Spoiler: code (click to see content)

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
Re: P1 appears in exact location from P2 regardless of screen pos
#18  August 25, 2016, 05:57:53 am
  • ****
    • China
    • http://vans.trinitymugen.net/
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.
Re: P1 appears in exact location from P2 regardless of screen pos
#19  August 25, 2016, 06:02:09 am
  • ******
    • www.justnopoint.com/
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?
Re: P1 appears in exact location from P2 regardless of screen pos
#20  August 25, 2016, 06:02:52 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
[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