How do I make camera turn with caracter (as in FPS)

Get help using Construct 2

Post » Sun Nov 23, 2014 7:50 pm

Is it possible to make a game like this:
1. view from top (2D),
2. main character controlled by WASD (move) and mouse (turning),
3. camera rotates as the caracter turns (so he's always facing up)?

In short - shooter with controls like in FPS but with view from top.
Like in Steel Storm.

If yes, I'd be grateful for instructions :)
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Sun Nov 23, 2014 8:12 pm

In "System" events you can set the layout or layer angle manually. Try setting it to player object's angle maybe?
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sun Nov 23, 2014 8:44 pm

Hi @tecbug - you could try attaching the controls to the angle of the background image rather than the player. Of course if you have many other objects on screen you'd also need to do some math to reposition them dynamically too, but if you don't have many this shouldn't be a problem.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sun Nov 23, 2014 8:50 pm

The problem isn't with rotating layers (and objets on those layers). The problem is to rotate them with mouse speed.
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Tue Nov 25, 2014 8:46 pm

Anybody knows?
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Tue Nov 25, 2014 10:39 pm

What do you mean by mouse speed @tecbug?
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Tue Nov 25, 2014 11:01 pm

ok, so basically you calculate the angle between the player and mouse. So when the mouse is directly above the player your angle is 0. You probably want to have it so that to the left of the players its 0 to 180 and to the right of the player it is 0 to -180. You could then use this as a multiplier to rotate the world.

Rotating the world would be the most complicated aspect as I'm not sure there is an easy way to rotate layout or sprites around an offset (which would be the player position)

You could maybe stick every other object in a family. Then do some manual fancy rotate at offset stuff.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Fri Nov 28, 2014 10:00 pm

As I said, rotating layout isn't an issue. Please see attached CAPX (move with WAD).
My problem is to rotate this with a mouse.

And as mouse speed I meant the distance between mouse.x in this frame and mouse.x in previous frame. So if player moves mouse slowly to the right the distance would be for example 3. If the player moves mouse fast to the left the distance vould be -20.
You do not have the required permissions to view the files attached to this post.
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Sat Nov 29, 2014 1:08 pm

I'm also interested in a solution for this. Although i would like for the player to be able to rotate towards mouse position and for the map to angle accordingly too.
B
11
S
2
Posts: 100
Reputation: 1,150


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 59 guests