Stretch view to include LOS enemies

0 favourites
  • 5 posts
From the Asset Store
Top-down cars vector illustrations in 12 different colors.
  • Hey all,

    I want a game mechanic where when the player has LOS with an enemy, the view stretches out so that the enemy is included in the screen. I want it to stretch to include all enemies you have line of sight with while not stretching the view in a way that areas outside the layout are shown. Also it needs to shrink back when LOS is broken.

    Does anyone have any methods for this? I have a lot of experience with C2, but this is new territory for me and I just can't even seem to get close.

  • Hi Tobye

    Just made a quick example .capx

    This is basically how I would scale up and down.

    The thing you have to do on your project is to get the math right on the scale factor. It depends on the viewrange(in LOS) of your player and the original size of the view vindow(which is scale 1).

    I have tried to illustrate it:

    <img src="https://dl.dropboxusercontent.com/u/2560922/mobiledev/forum/lineOfSightScaleLayout.png" border="0">

    Hope it helped a bit.

  • Hey Tobye,

    Haven't had to do it myself (yet)! But I thought this might help you to create that scale up/down that you're after. vtrix has created a really smooth scale/zoom action on this example.

    Good luck

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys, but I'm not really any closer. I can smooth scroll and scale no problem, the main issue I have is getting it so all enemies in LOS are only just within the screen and the view constantly scales to accommodate. I'll keep at it!

  • As i said it should only be a question of math. if you look at my drawing again you just have to set the scale factor to just show the enemy who i furthest away.

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