Keeping ship at centre of screen

  • I feel this should be possible using the built-in behaviours, but not quite sure how to do it. Basically I want to build an overhead space-shooter where the player ship can rotate and always stays at the centre of the screen, always pointing upwards, meaning the background needs to rotate and move with the ship, as do the enemy ships. Also, I'd want the size to be effectively infinite, so I couldn't just do a huge layout and scroll across that.

    Using the built in 'Scroll To' behaviour only solves this partially, because when you reach the edge of the layout you start to move away from the centre, and warping back at the other side doesn't work either.

    I'm sure this is fairly straightforward but I'd appreciate some ideas on how to accomplish it in C2.

  • Now, I'm not sure if this is the best way to do this, but this is one way to accomplish this with 4 events and one family. The idea is to not move the ship at all, just correct it's angle north, and have everything else move around it. Here is a Capx.

    dl.dropbox.com/u/11063814/Rotating%20Space.capx

    Hope that works for ya.

  • Wow, that's really cool. Not just the capx, the fact that you sat down and wrote it and passed it on. What a nice forum :)

    It will prove very helpful and I hadn't even thought about rotating the entire layout. I knew I was missing something obvious. I think that's probably the way to go, so thanks :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • because when you reach the edge of the layout you start to move away from the centre

    Enabling "unbounded scrolling" in layout properties will help you there.

  • Ah yeah, there we go. C2 is so good, but it's taking me a while to learn what everything does :)

    Thanks.

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