How do I scroll to SOFTLY ?

Get help using Construct 2

Post » Fri Sep 12, 2014 12:49 pm

Hi guys...I made 2 players ...if U press "1" it scrolls to player 1 if U press 2 it scrolls to player 2...but only "instantly"...can i make a soft camera "scrolling" from one player to another one ??? something not to complicated..I am new here.. ????


thanks guys....
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Fri Sep 12, 2014 1:09 pm

Make a global variable name it for example :Camera
Make a invisible sprite and add a scroll to behavior to it.

Make events:
When N pressed - set Camera to 0
When M pressed - set Camera to 1

Camera = 0 - Set Sprite X to : lerp(self.X,Player1.X,1*dt)
------------------Set Sprite Y to : lerp(self.X,Player1.Y,1*dt)

Camera = 1 - Set Sprite X to : lerp(self.X,Player2.X,1*dt)
------------------Set Sprite Y to : lerp(self.X,Player2.Y,1*dt)
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Fri Sep 12, 2014 1:19 pm

thanks ...I will try :) very kind :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Fri Sep 12, 2014 1:30 pm

If you don't want to use cods add MoveTo behavior to the camera sprite and when :

Global variable = 0 ---- Camera move to player 1
Global variable = 1 ---- Camera move to player 2

You can download the MoveTo behavior in the plugins section.
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Fri Sep 12, 2014 6:25 pm

is this plugin accepted in all browsers or any kind of stores ? I heard a few plugins are creating errors or problems...

thanks 4 ur help :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Fri Sep 12, 2014 6:52 pm

I think this is what you're looking for?

Camera Object Switch (1).capx


I added a smooth scaling by using LightTween, you can remove it by deleting "Sprite3"

Credits to @zatyka for his Camera Focus tutorial
You do not have the required permissions to view the files attached to this post.
B
21
S
6
Posts: 244
Reputation: 2,655

Post » Fri Sep 12, 2014 7:30 pm

thank U :)
which is the difference between this and the one of A0Nasser ?
Camera = 0 - Set Sprite X to : lerp(self.X,Player1.X,1*dt)
------------------Set Sprite Y to : lerp(self.X,Player1.Y,1*dt)

which is better ? or are they similar ?

thanks guys !!!!
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Fri Sep 12, 2014 7:44 pm

They both use "lerp" so they're pretty much the same.. but i think A0Nasser's is a little bit less complicated? it's up to you.
B
21
S
6
Posts: 244
Reputation: 2,655

Post » Sat Sep 13, 2014 4:37 am

ok thanks :) a lot !
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Sat Sep 13, 2014 11:31 pm

Sorry for the late replay, Problem with the site.
The MoveTo behavior always updated by the developer so don't worry.
The best thing using the MoveTo that you can control the speed as you like.
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Next

Return to How do I....?

Who is online

Users browsing this forum: apalm1341, blissfulwizard, Malhog and 16 guests