Setting Camera Between two objects

0 favourites
  • 2 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.
  • Hey Forum Friends! Could you help me figure this out?

    I have two objects moving on the screen. I have a camera sprite that I want to position between the two sprites regardless of where the two sprites move. Theoretically, I want to zoom in and out depending on the distance between the two sprites. (I think I can figure that out, but the positioning of the camera is what I am stuck on.)

    I am guessing I will need a variable MidPoint with Distance(Sprite1.x, Sprite1.y, Sprite2.x, sprite2.y) / 2. But now how to I get the X and y? Using sin and cos? I am lost...

    Thanks in advance! <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Object1.X + (object2.X - Object1.X) * 0.5

    Object1.Y + (object2.Y - Object1.Y) * 0.5

    Here's an old cap I did with everything stripped away apart from this feature..

    object 2 is the mouse.

    Changing '0.5' to a variable means you can adjust the distance.. so holding down space changes the number to 0.5 from 0.3

    Oh and If you want a smoother scrolling, make a separate marker object and have it move at angle.. with the speed in accordance to the distance between itself and the position written above.

    I did do one for magnification also but I can't find it..

    But I do remember it was a bit of a pain to do mouselook with magnification, because zooming out would cause the mouse to be recognised even further away and it got really sensitive the further the mouse got.

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