Rotate Layer

Get help using Construct 2

Post » Wed Jan 11, 2012 7:52 pm

I'm building a top-down style helicopter game where the Up/Down arrows control the sprite, up and down. Left and right arrows rotate the BG clockwise and counterclockwise. There are three layers (Background, Main and UI).

My question is how can I spawn bullets from my helicopter on the main layer towards destructable buildings on the Background layer? Impossible?

The two methods I tried:

Spawning the bullets on the background layer. I couldn't get the angle of trejectory to match the helicopter angle. Rather than shoot at the angle of my helicopter (on a different layer) the angle would be inverted.

Then I tried putting the buildings on the main layer with the helicopter. When on screen, the buildings would rotate around their set postion. I couldn't get the sprites to mimic the rotation of my background layer.

.capx- http://c2.originalspaces.net/apache.capx

Buildings at y-axis 3400 (fly north). The two event sheets "Apache Controls" and "Game Events" contain the relevant actions.

Controls: Up, Down, Left, Right, Ctrl, SpaceDominic2012-03-15 20:30:21
B
25
S
5
G
6
Posts: 18
Reputation: 5,154

Post » Wed Jan 11, 2012 8:10 pm

I changed one of the bullets to spawn on the backgroudn an it seems to work as expected....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Jan 11, 2012 8:28 pm

Event 24 of "Apache Controls" - If I change that to spawn on layer 0 the bullets always go up or -90 degrees on the background. They don't spawn from the angle that the helicopter is facing.Dominic2012-03-15 20:30:34
B
25
S
5
G
6
Posts: 18
Reputation: 5,154

Post » Wed Jan 11, 2012 8:47 pm

Or don't use layer rotation, just rotate the helico and make the layout angle follow the helico angle (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Jan 11, 2012 9:02 pm

This problem has similiraties with the one evoked in this topic.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Jan 12, 2012 12:30 am

Thanks for pointing that out along with the example Kyatric. I had stumbled upon that topic before but didn't realize how closely it related to the issue I'm having.

I tried implementing your workaround in my situation (spawning collision masks on the main layer over the buildings in the background). However the collision masks aren't tracking with the background rotation correctly. I can't find the CM's now but did catch a glimpse of one flying past my helicopter.

Updated .capx- http://c2.originalspaces.net/apache.capx

Refer to "Game Events"Dominic2012-03-15 20:30:48
B
25
S
5
G
6
Posts: 18
Reputation: 5,154

Post » Thu Jan 12, 2012 1:52 am

I was re-reading the info here and I think Yann had the right idea. That's my next best bet at least.Dominic2012-03-15 20:30:56
B
25
S
5
G
6
Posts: 18
Reputation: 5,154


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 33 guests