Sin/Cos Movement Error

This forum is currently in read-only mode.
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Hi everyone, I tried to make a simple asteroids movement with friction and now my rocket is shaking weirdly

    First: is this sinus behaviour normal? When the angle is larger than 180? sin should become a negative number but instead it seems to become zero?

    Second: This is the problem-program, using arrow keys should move the 'rocket' but the movement angle seems 225? and the 'shaking' is weird .

    I used private variables in the sprite and in the 'Text' for movement calculation.

    Thank you. I'm still pretty noob with Construct

  • The first is going into the negatives for me. It may be going into scientific notation, but its running so fast you might not see the e.

    On the second I'm not sure, but setting the x/y speed in always may be interfering with your up key event.

    Also having the up key event as a sub event in always wont change anything.

  • To the First:

    That's odd, I get a -0 most of the time when using sinus on an angle between 180 and 360

    However using it in events seems to work... just displaying as negative number results in a -0 or when animated it flickers between -0 and some strange wrong number (up to -9,837485 something). Sometimes with e's like 0,34e2745598, most of the time just -0.

    To the Second:

    KeyDown was not the problem. When accelerating over a longer period the shaking stops until you release the upkey. The friction works wrong , I suspect the angle command in the beginning.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solved the Sinus Problem using "Format Decimal" in Text <img src="smileys/smiley2.gif" border="0" align="middle" />

    (Displays x numbers after the comma)

    For the movement I used a different approach, don't know why it didn't work <img src="smileys/smiley7.gif" border="0" align="middle" />

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