How do I, keep two players on screen??

Get help using Construct 2

Post » Fri Jan 16, 2015 4:30 pm

I have two players and the layout is bigger of windows size.

I want to see always the two players.
How do I ?

I tested "scroll to" in a two players, but is not a good solution becouse the players get out the screen.
Maybe layout scale :?:
B
4
S
1
Posts: 34
Reputation: 418

Post » Fri Jan 16, 2015 5:13 pm

Well the first solution that comes to mind for me comes from old restro games like bobble bobble where IF the one player gets outside the layout the other spawns behind him.... now if the two players are not working together then I'll come back after I test a few things out....
Need Sprites For Your Next Project?
100% Vector Animated Sprites
B
8
S
2
Posts: 170
Reputation: 1,086

Post » Fri Jan 16, 2015 5:49 pm

Thanks, but the spawn the second player is not good for my game.

I test this:
Player1 Scroll to
Player 2 Scroll to
even- Player 1 is on screen"invert" -- sclae layout 0.5

Maybe it could work, but now,how ido scale 1.0 when player 1 and two are close
B
4
S
1
Posts: 34
Reputation: 418

Post » Fri Jan 16, 2015 5:57 pm

Scroll to the mid-point between the two players (+/- offset you want to make it easier to look ahead in one particular direction, for example), and then constrain the players to the visible area (simple rectangle clipping) so that they can't leave the screen

Basically, you don't scroll to a player in particular ; you compute the area you want to frame, based on the position of the 2 players, and you prevent the players from going beyond that area
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
23
S
9
Posts: 237
Reputation: 2,207

Post » Fri Jan 16, 2015 6:30 pm

Scroll to a middle point between both players.

Check the distance between players. If it's less than the screen width set the scale to 1. If it's greater than screen width scale it propportionaly (I wouldn't use a fixed 0.5).
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 428
Reputation: 2,337

Post » Fri Jan 16, 2015 6:43 pm

brunopalermo wrote:Scroll to a middle point between both players.

Check the distance between players. If it's less than the screen width set the scale to 1. If it's greater than screen width scale it propportionaly (I wouldn't use a fixed 0.5).


Thanks
Ok, but, how i do check distance betwen players?? :lol: :lol:
B
4
S
1
Posts: 34
Reputation: 418

Post » Fri Jan 16, 2015 7:17 pm

Event: System -> Compare Two Values Distance(p1.X,p1.Y,p2.X,p2.Y) <= WindowWidth
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Wed Feb 04, 2015 9:07 am

Here it is....
-system.. every tick
-----System compare to variables
-----------1000 / (distance (player1.X,player1.Y, player2.X,player2.Y)) > 1
--------------------System set layer scale to 1

-----System compare to variables
-----------1000 / (distance (player1.X,player1.Y, player2.X,player2.Y)) < or = 1
--------------------System set layer scale to 1000 / (distance (player1.X,player1.Y, player2.X,player2.Y))


Also set both all players to have the scroll to behavior.

You can make the 1000 any number you want as a min distance between players.

This will scale the layer that the players are on to a percentage relative to the distance between them. If the percentage is 100% or more of the minimum distance the the scale will be 100% or in this cause just 1.
B
5
S
1
Posts: 12
Reputation: 399


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, jorgmaquoi, kiki4construct and 22 guests