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

  • 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

  • In "System" events you can set the layout or layer angle manually. Try setting it to player object's angle maybe?

  • 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.

  • The problem isn't with rotating layers (and objets on those layers). The problem is to rotate them with mouse speed.

  • Anybody knows?

  • What do you mean by mouse speed tecbug?

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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