Rotating level



  • Hi,
    I am trying to figure out how I want my game to look like.
    The player will wander around, the view will be top-down, and I have to decide if the orientation will be fixed for the player or for the level: will the player rotate around its pivot or will the level will rotate around the player?
    Are there examples of the latter approach?

    About a scrolling level, do I have to take care of what parts/tiles of the level are visible and must be drawn or there is a premade function/library/something that does it for me already? If it exists, will it work for a rotating level too?

    Thanks



  • If not mistaken, you can do a FlxG.camera.angle, and rotate as you will. You will have to reverse your character movement and keys, as well.



  • @claudio-ficara yeah! Sounds exactly like what I need!



  • Hi,
    I have resumed the project and am experimenting, with small to no success.
    I have used the "Features FlxCamera" as a starting point, and I'd like to rotate the camera and to move the ball as a car/spaceship, that rotates with the camera and points always up, moving up and down. The player/ball in this example is a FlxNapeSprite, I can rotate it by applying an angular impulse or setting a rotation to the body, but don't know how to apply an impulse forward/backward in the current direction.

    Than I have a problem with camera:
    0_1564615882412_rot.png
    The camera rotates, but it keeps rotating the rectangular view as well.
    How can I fix it?

    And what's the difference between "this.body.rotation" and "this.angle"? They look independent.
    Thanks

    P.S.: I am sorry for the other topic I have opened (http://forum.haxeflixel.com/topic/930/rotating-level-by-rotating-camera), I think it is better to revive this old one.

    P.P.S.: maybe I should dig in the source of FlxTeroids for a player rotation example...



  • I had an idea while at the toilette, a classic! Just a guess: do I have to use an additional camera to trim a rectangle on the current rotating camera (that I will set as a bigger square)? I think it could be the correct way to make a topdown game with a rotating camera/level, unless Flixel already embeds a method to do it.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.