Camera movement within restricted values in layout

1 favourites
  • 6 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • I have a big layout and i want to restrict the camera within this layout. So what i do is I have a camera object that follows the player on X (due to the way the game is structured) and that works well.

    so at the oment i have a trigger in my level that, once the camera touches it, stops the camera from following the player. the result is that the player moves within that camera zone that does not move.

    that also works as it should.

    now, sometimes i want the camera to stop at a certain point and then later move again at a certain point. i do that with triggers and that works well BUT there is now a jump in X positions in the camera. and here i figured to avoid that, wouldn't it be possible to tell the camera to automatically stop moving when the edge of a area is reached, kinda like when it stops scrolling once the edge of the layout is reached.

    i am not sure i am explaining this correctly, though. technically speaking, everything works as it should, it's just not pretty, is all.

    so yeah, is there a way to define an area within a layout and bind the camera to that area?

  • I don't know if this is what you want but I have a sort of flip-screen camera set up that scrolls smoothly when the player hits a certain part of the screen. Basically if the player is within a certain x/y range the camera will move smoothly to the center of that particular screen and stay there until the player exits that boundary, whereby it will then float (using lerp) over to the next designated 'center of the screen'. I've attached a screenshot of my workings - It's probably a horribly inefficient way to do things, but it actually works very well for my purposes. The downsides to this method is it's locked in to a particular resolution (1366 x 768 in this case) and all the values are hard coded and probably getting triggered per tick. If I knew what I was doing I could probably set them up in an array or work out a formula etc, but for now it's doing the trick for me.[attachment=0:3ofrias3][/attachment:3ofrias3]

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My system is similar, really but I don't use lerp. perhaps i should try lerp, whatever that is, as i have read already in some tutorial to use it, not sure what that was though^^

  • Try to add MoveTo behavior to the camera it's better than lerp you can change the speed any time you want.

    you can find the behavior in the plugins section.

  • THanks! This is EXATLY what I need

    THANKS!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)