Stretch view to include LOS enemies

Get help using Construct 2

Post » Mon Jul 15, 2013 8:47 am

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.
B
28
S
8
G
5
Posts: 429
Reputation: 6,987

Post » Mon Jul 15, 2013 9:47 am

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:


Hope it helped a bit.cvp2013-07-15 10:32:07
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Jul 15, 2013 10:06 am

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 luckBlacksmith2013-07-15 10:07:18
B
33
S
6
G
7
Posts: 494
Reputation: 8,252

Post » Tue Jul 16, 2013 4:30 am

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!
B
28
S
8
G
5
Posts: 429
Reputation: 6,987

Post » Tue Jul 16, 2013 10:01 am

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.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451


Return to How do I....?

Who is online

Users browsing this forum: ankas, Baidu [Spider], iBarin, whitephon, WhosWho and 15 guests