Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

TGF2 more than 32 directions


Recommended Posts

If you're saying you need a picture with 64 lines or something like that, make an object that is a line, and then rotate that around pasting the image rather than moving a small object in a line (at least that's what I'm guessing you're doing; your explanation is rather vague).

If you absolutely need to move the object in more than 32 directions, just use some trig movement. Use two alterable values for the X and Y position of the object (for decimal purposes). Then, add a speed to the position using trig:

posX = posX + speedX * cos( Angle )

posY = posY - speedY * sin( Angle )

After changing the position values, set the object's actual X and Y position to the values so you can see the movement in-game.

Link to comment
Share on other sites

The x and y speed is whatever speeds you use for the object... oh whoops I did it wrong; sorry!

posX = posX + Velocity * cos( Angle )

posY = posY - Velocity * sin( Angle )

The speed for both is the same value, as you are moving only 1 speed in 1 direction, and the trig functions split the velocity into X and Y counterparts that add (or subtract for the Y) to the object's position. The Velocity is whatever speed your object is moving at, so if you have a bullet that you want to move at 10 pixels per frame, you'd set Velocity to 10. I'd recommend having Velocity be an alterable value, but it's of course unnecessary.

Link to comment
Share on other sites

So lets say I just created an active object.

and its conditions are:

Always: Set angle to 45(quality=1)

Set xpos to X("Active")

Set ypos to Y("Active")

Set xpos to xpos + Speed("Active") * Cos(Angle("Active"))

Set ypos to ypos - Speed("Active") * Sin(Angle("Active"))

Set X("Active") to xpos

Set Y("Active") to ypos

it yields my sprite, rotated by 45 degrees, Standing where I placed it, NOT where xpos and ypos specify, (Which is 0) leading me to believe that the active object is not in sync with xpos and ypos. Can't figure out what's wrong.

Link to comment
Share on other sites

If he's using a built-in movement and is trying to swap over, he can simply translate the built-in movement's speed to pixel speed; there's really no impossibility about it.

If you can't figure it out on your own Team Blackfox, feel free to send me a PM. Just a note though that you should not use the built-in speed as the speed variable I was referring to; this should be your own variable that you make up.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...