YesNoOk
avatar

[SOLVED] Moving a helper to the center of the screen. (Read 211 times)

Started by KojiroBADNESS, May 30, 2011, 07:29:59 am
Share this topic:
[SOLVED] Moving a helper to the center of the screen.
New #1  May 30, 2011, 07:29:59 am
  • ***
    • Canada
I GOT A LOT OF ISSUES LATELY. DEAL WITH IT.

But no, all foolishness aside, I need a little assistance again. How would I go about moving a helper to the middle of the screen without it teleporting there?
I tried Screenpos x and Screenpos y with PosAdd, VelAdd, etc. But I usually either get the same results, it just instantly moves to it's position, or nothing happens. I just don't know what else to do at this point. Any ideas?
Last Edit: June 01, 2011, 04:18:22 am by KojiroBADNESS
Re: Moving a helper to the center of the screen.
#2  May 30, 2011, 12:13:34 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
What you would need to do is calculate:
1. The exact point of the screen you want your helper to go to; its destination.
2. The exact position of the helper's starting point.
3. The amount of pixels between the helper's destination and the helper's starting point.
4. The amount of time you want it to take for the helper to reach its destination.

[mcode][state 123, Go]
Type = Velset
Trigger1 = Time = (value)
X = (A - ScreenPos X)*Facing/B
Y = (A - ScreenPos Y)/B

[state 123, Stop]
Type = Velset
Trigger1 = Time = (value+B)
X = 0.0
Y = 0.0[/mcode]

A = The position of the screen you want to go to. You can use displaytoclipboard to see what position is what. I know the middle for The X axis is 160 and the middle for the Y axis is 120.

B = The amount of ticks it should take to get to A.

The multiplying by facing is self explanatory.

Modification:
If you go left, you decrease the Screenpos X; if you go up, you decrease the Screenpos Y. I remember it changing in 1.0, so if that's not what you're using, then use displaytoclipboard. Use displaytoclipboard, anyway. =p I hope that helps.
Last Edit: May 30, 2011, 12:51:19 pm by Assman
Re: Moving a helper to the center of the screen.
#3  May 30, 2011, 09:40:49 pm
  • ***
    • Canada
Snap. That worked perfectly. I didn't think VelAdd/Set would do the trick. I just gotta mess around with the values a bit more, but the idea is there.

Thanks! ;D