Keeping ship at centre of screen

Get help using Construct 2

Post » Thu Oct 18, 2012 9:14 pm

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.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Fri Oct 19, 2012 2:31 am

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.

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

Hope that works for ya.
B
6
S
1
Posts: 37
Reputation: 774

Post » Fri Oct 19, 2012 4:28 am

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 :)
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sat Oct 20, 2012 8:58 am

[QUOTE=farflamex]
because when you reach the edge of the layout you start to move away from the centre
[/QUOTE]

Enabling "unbounded scrolling" in layout properties will help you there.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Oct 20, 2012 4:01 pm

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

Thanks.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 22 guests