Camera Control and Scene Wrap X/Y

Hey Folks -

I'm doing some R&D on a possible top-down space shooter game, similar to Asteroids or any of the equivalent top-down space fly & shoot types of games. The problem I'm running into is the Scene Wrap function - I have the camera constrained to the player-ship and the camera size reduced so that the ship always remains in the center of the screen and a larger scene that actually takes up more room than the game screen.

This works all fine and well until the ship nears a scene edge, in which the ship moves from the center of the screen to the edge of the device screen (iPad/iPhone), engages the scene-wrap function, and appears on the other edge of the device screen. It will stay there until the player moves the player-ship far enough from the scene edge to return the player-ship to the device screen center. I'd like the ship to remain in the center of the screen at all times, even when wrapping the scene X or Y edges. Is this possible?

Oddly enough, I've actually mused that to make this work, I shouldn't be moving the player-ship through out the world by player input but by making the world (BG art and objects) move while the player-ship remains stationary on screen (only rotating to reflect heading and movement). This seems oddly too difficult to provide the effect I'm looking for (and very Matrix-like - "There is no spoon...")


Thanks!!

- KS

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Wrap doesn't work well with constrain camera so you will have your work cut out but if you leave the camera as it is and don't constrain it this should result in the same asteroids as the original (you could fly out of the sides in the original).

    If you want to keep the ship centred you would need to manipulate the rocks when you rotate and speed up for eg which is possible but a lot more work.

    Darren.



  • KnightStarKnightStar Member Posts: 162
    After pulling my hair outta my head for a good 6 hours, I've changed the scope of this project and will go with a non-wrapping game scene. On the flipside, I'm doing some other nifty camera tricks to accommodate for the large sandbox the player will be able to play in - I'm R&Ding a zoom functionality in which the camera will zoom in and out, depending on the proximity the player is to enemies and hazards.

    The original intent was to try and build something like Star Control's Melee system..


    - KS
  • joshiwujoshiwu Member Posts: 207
    edited September 2013
    I loved that game! Might I suggest that you base the camera alititude on speed traveled.

    If linear vel x>300
    or
    linear vel x <-300
    or lin vel Y > 300
    or lin vel Y < -300
    or lin vel x+Y >400
    or lin vel x+y <-400
    (zoom altitutude 3)
    else if
    linear vel x <-150
    or lin vel Y > 150
    or lin vel Y < -150
    or lin vel x+Y >200
    or lin vel x+y <-200
    (zoom altitutude 2)
    Else
    (zoom altitude 1)

    then make corresponding code in your actors.

  • quantumsheepquantumsheep Member Posts: 8,188
    edited September 2013
    I never use scene wrap anymore. Instead, I set up invisible actors that act as walls.

    When the player hits the wall, you simply change their position to where you want them to go.

    For example, if you hit the actor at x -10 you'd end up at x480 - This would make you appear on the other side of the screen.

    Additionally you could build your level so that the edges of the screen are not the edge of the game level.

    For example, in a scene that's 9 across and 9 up, you could place your start position at screen 5 x 5.

    Then, in the screens around the edges have the walls I mentioned placed about half way into the screen. This would leave plenty of space (I'd imagine) to hit the wall and warp to the other side of the level while keeping your ship in the centre at all times.

    Just some random thoughts - hope they help!

    QS =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.