GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Control Camera coordinates

Twayne2Twayne2 Posts: 351Member, PRO
edited July 2018 in Community Tutorials

This is an example of what I want. Any help would be nice. :smile: Assume my main player has the control camera behavior. I want to say that when my main player touches the finish sign, a ''you win'' actor pops up. I want the ''you win'' actor at the exact middle of the screen. But, the screen has been scrolling. And the player is not always at the middle of the screen. So how would I access the control camera's coordinates to manipulate where I want the ''you win'' actor?
Here is the actor:
:)
It runs across the level, with 0,0 tracking area.
:) :) :) :) And this is the finish sign: ^.
The control camera would stop at here: {} but the player here: :)^.
So the screen is offset, and I need the ''you win'' actor to appear, not above the player, but in the middle. Thanks.
P.S. I didn't realy feel like uploading any photos lol. :smiley:

Comments

  • mikejamesfishermikejamesfisher Posts: 58Member, BASIC

    One way is to use another layer that doesnt scroll and have the you win actor appear when finished in that layer. Another way is to have an attribute “finished”. When actor crosses finish line, change “finished” to true or 1 and then spawn you win actor with a rule to control camera. In the runner: create rule when “finished”= 0 or false, control camera. Does that help?

  • Twayne2Twayne2 Posts: 351Member, PRO
    edited July 2018

    Nice suggestions, but not what I need, I will post a picture in a little. Thanks for the reply.

  • Twayne2Twayne2 Posts: 351Member, PRO
    edited July 2018

    So look carefully at this: https://ibb.co/miaF3o
    Now, the yellow is about where the center of the camera control is. The problem is when the player touches lava, spike, etc., (or even a finish sign,) I want several actors to appear, such as, for example, ''you win'' or ''you lose'', level select, etc. Now, I want them at the center-ish of the screen, for example. The player can jump, but if the screen does not move up when he does, (if he does not jump far enough,) making the actors appear from the player doesn't work. And I don't know a way to constrain another actor the the control screen's position within another layer. That's the key I am looking for. :smile:

  • JapsterJapster Posts: 661Member
    edited July 2018

    Why not just have an invisible actor already placed on-screen, for the messages, and have it visible for X seconds, etc, when these conditions are met - i.e. "Watch out for lava", "You Win", etc? - you can then dynamically change it's image / Display text accordingly (although if using displaytext, you may have to adjust text location - I think it's affected by camera location still?), but if you originally create the actor on the GUI / None-Scrolling layer, it will stay put, always remaining where you placed it in the editor, in relation to the camera? - so you can just make it visible / invisible, after changing it's image, instead?

    Alternatively, maybe just constrain your spawned actor's X position (spawned on the scrollable layer(s)!) to camera's X+(camera or display width / 2)?

    BTW - I generally use an actor called Camera_Broadcaster etc, and all I do is unlock it, and constrain 2 game attributes to the camera X and Y positions. That way all other unlocked actors can read them... :smile: (Additionally, I can then also reset the camera if need be, using this 1 control)

  • Twayne2Twayne2 Posts: 351Member, PRO

    Still, the control camera behavior takes time until the player reaches the middle of it, it does not have its center as the player itself. How can I explain this. Hm.

  • Twayne2Twayne2 Posts: 351Member, PRO

    Perhaps another picture could help.

  • Twayne2Twayne2 Posts: 351Member, PRO
    edited July 2018

    This is the ideal position:
    https://ibb.co/dkSgR8
    This is what can happen, (the player got destroyed by the red lava),:
    https://ibb.co/dYRKDo
    The white block is a attempt at a solution, but a failure nevertheless. The gap of time when the player starts running takes, for example, a second. Then the camera stays hooked on the players x coordinates because of the behavior, but only after that second of running. And the players y has the same issue. And I don't want to change the game's fundamentals really of camera controlling. Hm.

  • Twayne2Twayne2 Posts: 351Member, PRO

    Well using another layer was a good enough solution. Thanks. :smile:

Sign In or Register to comment.