Team Blackfox Posted April 22, 2010 Report Share Posted April 22, 2010 I'm trying to make a system with more than the 32 directions that are standard in TGF2. I need to find a picture with lines and their slopes (at least 64 directions) Here's what I have so far: Link to comment Share on other sites More sharing options...
Asuma Posted April 22, 2010 Report Share Posted April 22, 2010 If TGF2 has it, use Angle. Link to comment Share on other sites More sharing options...
Team Blackfox Posted April 22, 2010 Author Report Share Posted April 22, 2010 Oh it HAS angle, it just can only MOVE in 32 directions. That's why I need a picture of lines and their slopes at least 64 directions. Link to comment Share on other sites More sharing options...
Asuma Posted April 23, 2010 Report Share Posted April 23, 2010 Angle can rotate 360 degrees. If you need 64 angles, divide 360 by 64. Link to comment Share on other sites More sharing options...
Team Blackfox Posted April 23, 2010 Author Report Share Posted April 23, 2010 No, I need an object to MOVE in more than 32 directions. I have angle, but it cannot move in the direction of an angle, which is why I'm moving the object by slope. Link to comment Share on other sites More sharing options...
LarkSS Posted April 23, 2010 Report Share Posted April 23, 2010 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 More sharing options...
Team Blackfox Posted April 23, 2010 Author Report Share Posted April 23, 2010 It's the second solution I was looking for, thank you! I could care less about rotating the sprite, I needed to move it, because there are blind spots with just 32 directions for say... a shot in a Shmup. Link to comment Share on other sites More sharing options...
Team Blackfox Posted April 23, 2010 Author Report Share Posted April 23, 2010 Wait, how do I find X speed and Y speed? Link to comment Share on other sites More sharing options...
LarkSS Posted April 23, 2010 Report Share Posted April 23, 2010 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 More sharing options...
Team Blackfox Posted April 23, 2010 Author Report Share Posted April 23, 2010 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 More sharing options...
DimensionWarped Posted April 23, 2010 Report Share Posted April 23, 2010 Are you using one of MMF's built in movement systems? It sounds like you are. If you don't have a speed variable that is being set, this is going to be useless. Link to comment Share on other sites More sharing options...
Asuma Posted April 23, 2010 Report Share Posted April 23, 2010 It's as DW. Says, if you're using the basic MMF/TGF built in movements, it won't work. You'll need to use a static engine. Link to comment Share on other sites More sharing options...
LarkSS Posted April 23, 2010 Report Share Posted April 23, 2010 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 More sharing options...
Recommended Posts