How do I make 0 degree point North and not Right.

Get help using Construct 2

Post » Fri Feb 17, 2017 7:58 am

Hi

I am building a ship game and for that it would be really useful if could make rotations point up, and not right, when at 0 degrees. Any suggestion? It driving me mad and I have been searching high and low, but cannot find any information on how to do that.

It goes for Wind direction and for Ships rotation. Need it all to give me true North. Read in tutorials for other engines that talks about "adding" -90 degrees to rotation output but completely lost in where and how to do that. I guess with a system expression or a function? And wouldnt that mess up the CustomMovement behavior I have added ?

Any suggestions would be much appreciated.

Regards
John
B
16
S
2
Posts: 12
Reputation: 731

Post » Fri Feb 17, 2017 9:30 am

If you rotate the boat sprite in the sprite editor so it points up there. Then it will point up at 0 degreees in game. Or are you looking for something else?

Image

Or if you are setting the ship rotation by a windDirection variable then you can simply add -90 to the action where you set the angle instead.

For example: every tick > set angle to > windDIrection-90
B
55
S
24
G
13
Posts: 767
Reputation: 12,575

Post » Fri Feb 17, 2017 10:56 am

Would setting the layout or later rotation to -90 at the start of the layout work? You may need to make the layout scrolling unbounded.
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Fri Feb 17, 2017 12:31 pm

Thanks for the input so far, really appreciate it!

- Rotating the sprite wont work as I will put on a either a Bullet behavior or a customMovement (not decided yet) but it would make my ship go sideways.

- Not sure about using a variable to set the wind direction but will experiment with it.

- Tried rotating the layout at start of layout but didnt work, since the numbers are the same. I mean the wind direction was now correct but the ship is 180 degrees wrong. Wondering if i can make the bullet behavior work to go backwards etc. This migh actually work.

But after some thought, I will drop it since, its not really part of the core game play. But if I implement it later i will just do it in the Texture rather than by the numbers. But it still bothers me that I cant do it. At least for now.

But im still listening if anyone has a way, even if its complicated. Happy to learn.
B
16
S
2
Posts: 12
Reputation: 731

Post » Fri Feb 17, 2017 3:59 pm

Taking a step back you can convert between compass angles and c2 angles with:
Compass angle = (c2 angle +90)
C2 angle = (compass angle -90)

So if you just want to use compass angles with your events every time you just convert it.
Ex:
Instead of
Set angle to 0
Use
Set angle to (0-90)
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Sat Feb 18, 2017 8:21 pm

Just been playing around with that, and its probably the best compromise so far.

Thanks!
B
16
S
2
Posts: 12
Reputation: 731

Post » Sat Feb 18, 2017 8:41 pm

Only problem is when the ship is going right (0 degrees) and I turn left by one degree, the course will be 449. True north/Up is 360. But from Up to left it will go up to 449 before being 90 pointing left.
B
16
S
2
Posts: 12
Reputation: 731

Post » Sat Feb 18, 2017 8:56 pm

Your bullet angle and ship facing angle can be independent of each other.

You can set the ship to face the direction you want as Anonnymitet explained and set the bullet angle a different direction.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Sat Feb 18, 2017 9:45 pm

you can do this to put the number back into the 0 to 360 range.
(ang+360)%360
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Tue Feb 21, 2017 10:36 am

Holy crap, it works and my head just exploded!

So for anybody looking for this in the future, this is what made it work. The sprite does its thing pointing right, but in the output to the screen (Text object) I make an action like this: (Text Object) Set text to "Sailboat angle:" & (Player_Sailboat.Angle+90)%360

Didnt know that was what % does!? I consider this solved. How do I tag it solved btw?

Thanks a bunch for the help, really appreciate it. :)
B
16
S
2
Posts: 12
Reputation: 731

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, JackTYGA, jobel, Kin, worm1 and 28 guests