YesNoOk
avatar

Reset camera to 0 (original position) (Read 3290 times)

Started by supercain, September 30, 2020, 09:00:35 pm
Share this topic:
Reset camera to 0 (original position)
#1  September 30, 2020, 09:00:35 pm
  • avatar
  • **
    • Germany
Hi,

Is it possible to reset the camera back to its original position? I tried many things but dont quite work. This is an approach:

Code:
[State 90, d1]
type = width
trigger1 = camerapos x < 0
edge = 0,440

it does nothing I dont understand why.

Thank you.
Re: Reset camera to 0 (original position)
#2  October 04, 2020, 01:22:52 am
  • *****
  • Shame on you!
    • USA
vVv Ryuko718 Updated 10/31/22 vVv
Re: Reset camera to 0 (original position)
#3  October 04, 2020, 01:31:07 am
  • avatar
  • **
    • Germany
Thanks. I just need to reset the camera back to 0 because otherwise the stage will look weird for a certain custom state.

This is what I did and kinda worked but its hard to get the exact value:

Code:
[State 4420.2, center camera]
type = posadd
triggerall = time > 0
trigger1 = pos x != ifelse(root,var(32) < 0,(1.01509*abs(root,var(32)))+233,-(1.01509*abs(root,var(32)))-233)
x = ifelse(root,var(32) < 0 && facing > 0,1,ifelse(root,var(32) < 0 && facing < 0,-1,ifelse(root,var(32) > 0 && facing > 0,-1,1)))

where var(32) equals camerapos x (I only need to adjust the X axis).
Last Edit: October 04, 2020, 01:36:01 am by supercain
Re: Reset camera to 0 (original position)
#4  October 04, 2020, 06:59:27 am
  • *****
  • Shame on you!
    • USA
#1, this is a mess. Why do you have this?
trigger1 = pos x != ifelse(root,var(32) < 0,(1.01509*abs(root,var(32)))+233,-(1.01509*abs(root,var(32)))-233)
99.9999999999999999999999999999999999999999% of the time, the camera pos wont be 0. So there's no real need for this giant check.
#2, there's no real way to get the camera to fly back to the original spot. Your best bet would be to move the characters to their original screen positions, then move them outward, then to the location of the custom state. So do that. Make two helpers in statedef 5900 that spawn at p1 and p2's feet and dont move. Then use their locations for the custom state.

^^^If you get that working, you should use the playerpush activated in them so they can go off screen. Then once the move is activated, bring P1 and P2 back to the center of the stage and move the helpers outward. I think that would be the smoothest way to go.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Reset camera to 0 (original position)
#5  October 04, 2020, 09:23:30 am
  • ****
I don't understand what you want to achieve?


Re: Reset camera to 0 (original position)
#6  October 04, 2020, 06:37:48 pm
  • avatar
  • **
    • Germany
#1is no mess. This is necessary because that will add the right amount of pixels to move the helper in order to have the camera back at 0.

It pretty much says: if camerapos x is -180 then move the helper 404 pixels to the right (or left depending on facing), else if camerapos x is 40 then add 270 pixels and so on. This makes the camera go back to camerapos x = 0.

#2 this method actually works you only need to run a few tests in order to get the sample values. In this case 40 pixels for a camerapos x = -180 and 270 pixels for 40.

beterhans, as I said. I want to move the camera back to its original position in the X axis. I need it like this because the stage is made in a way that it would look weird when certain states are triggered.
Re: Reset camera to 0 (original position)
#7  October 05, 2020, 12:57:20 am
  • *****
  • Shame on you!
    • USA
#1is no mess. This is necessary because that will add the right amount of pixels to move the helper in order to have the camera back at 0. 
It's a trigger. It doesn't do anything in this case. the x = does the magic.
It pretty much says: if camerapos x is -180 then move the helper 404 pixels to the right (or left depending on facing), else if camerapos x is 40 then add 270 pixels and so on. This makes the camera go back to camerapos x = 0.
yes, in the x=. The trigger doesn't affect anything without something like Var(718):= in it.
#2 this method actually works you only need to run a few tests in order to get the sample values. In this case 40 pixels for a camerapos x = -180 and 270 pixels for 40.
So is the topic solved?

Also, look into using || in your triggers. If you're trying to say, make this happen if pos x >120 OR if pos x < -120, you can use ||.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Reset camera to 0 (original position)
#8  October 05, 2020, 05:40:21 pm
  • avatar
  • **
    • Germany
Kinda solved, I was wondering if there is a more conventional way to do it. I am surprised there is no controller that allows you to move the camera to the position you want.
Re: Reset camera to 0 (original position)
#9  October 05, 2020, 05:57:57 pm
  • ****
Re: Reset camera to 0 (original position)
#10  October 05, 2020, 07:54:51 pm
  • avatar
  • **
    • Germany
Thats interesting. I guess it might be an alternative.