display angle problem

For questions about using Classic.

Post » Thu Oct 30, 2008 11:44 am

I'd like to make screen rotate with player. I made like this:
1. I made layout 1 width and height to 2000
2. In the center od Iayout I made sprite and gave it 8 direction behavior and checked 'center view on me'.
3. I made some backgrounds around this sprite
4. EVENTS:
Always: sprite: Set angle towards (MouseX, MouseY)
Always: System: Set display angle to sprite.Angle

When I run the game screen goes crazy. Why it's happening, how can I fix that?
B
53
S
14
G
10
Posts: 282
Reputation: 7,578

Post » Thu Oct 30, 2008 1:30 pm

MouseX and MouseY return the mouse in layout coordinates taking in to account the display zoom and angle. So if you change the display angle you change the values MouseX and MouseY return which in turn changes the display angle... and you get a strange feedback loop that probably involves the screen spinning really fast.

To fix this add a new layer called "Coordinates" or something. Never scale or rotate this layer - it's just for getting coordinates. MouseX("Coordinates") and MouseY("Coordinates") will then return the unzoomed, unscaled mouse coordinates, and you can use these to set the display angle for other layers (not the whole display, otherwise it'll still affect the Coordinates layer). Hope that helps.

By the way, it often helps to have "Unbounded scrolling" enabled for rotating screens.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Fri Oct 31, 2008 8:50 am

Thanks, it helped with the "crazyness" of the screen.
But there is new problem. While turning around (layer is turning with sprite of courese) tiledBackgrounds disappears when layer is on different angles.
see image:
[url:25x8p4am]http://kowalski.website.pl/img/rot.png[/url:25x8p4am]
B
53
S
14
G
10
Posts: 282
Reputation: 7,578

Post » Mon Nov 03, 2008 3:21 pm

Any ideas? anybody? Is it a bug, or am I doing something wrong?
B
53
S
14
G
10
Posts: 282
Reputation: 7,578

Post » Mon Nov 03, 2008 3:24 pm

I'm not sure. Posting a .cap file might help.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Nov 04, 2008 9:58 am

B
53
S
14
G
10
Posts: 282
Reputation: 7,578

Post » Tue Nov 04, 2008 11:53 am

Hmm, looks like a bug... I guess you could work around it for now by using sprites - post it on the tracker and I'll get round to it soon.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests