Posted By
|
Message
|
MBK
Registered 07/06/2007
Points 1578
|
31st March, 2010 at 03:56:34 -
What I'd like to do is to have my character's weapon swing and angle as he moves and when he jumps ... and for it to drag behind him (think of a caveman dragging a club behind him)
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
MBK
Registered 07/06/2007
Points 1578
|
6th April, 2010 at 01:21:07 -
Thanks for all those wonderful answers ...
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
|
6th April, 2010 at 04:35:14 -
I'm having a bit of a hard time visualizing what you're describing. Do you have an example video of it in another game? Or could you describe it with pictures perhaps?
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
6th April, 2010 at 12:14:50 -
Do you mean you want a separate arm that swings with physics?
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
6th April, 2010 at 16:05:23 -
You would need to get the angle between the characters current position and his last one, then use linear interpolation to swing the weapon smoothly from its current angle to the angle calculated.
So for the angle, assuming the player is named "Player" and "LastPlayerX" and "LastPlayerY" are alterable values:
ATan2( LastPlayerY - Y("Player"), X("Player") - LastPlayerX )
Should get you the angle pointing behind the players movement direction.
Then for linear interpolation, assuming the calculated angle from the equation above is "MoveAngle"
Set angle of object "weapon" to
angle("weapon")+((angle("weapon")-MoveAngle)*0.2)
This should work, but I haven't tried it yet so good luck!
n/a
|
aphant
Registered 18/05/2008
Points 1242
|
6th April, 2010 at 18:36:42 -
Have you considered simply animating it?
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
6th April, 2010 at 19:28:41 -
Wait! I just realized that the interpolation part won't work because the formula doesn't take into account the fact that an angle wraps at 360 degrees. If anyone knows a fix for this, post it because I'm curious too!
n/a
|
MBK
Registered 07/06/2007
Points 1578
|
7th April, 2010 at 03:49:39 -
Thanks for the responses.
The weapon should feel like it has weight to it and its angle should change when it collides with the ground.
I'm not one who understands all the extra computational explanations easily, but ..
.. there's no need for any thought on relative positions, it just has to ...
.. hmm .. yea .. it just has to add or subtract to the angle while the character's walking animation is playing and the weapon is overlapping a background ... that's it really, guess I sorta worked out part of the solution while trying to explain it ..
Ok, so I can do that by changing the direction of the weapon and by setting the weapon to the action spot on the characters hand, so I guess the new question would be smooth 360 degree rotation of the weapon instead of using the directions ... anyone have a nice simple method that works with TGF1?
(I still prefer to code everything in TGF1) (usually only use MMF2 to help others/compile for contests/etc)
@OMC: that's a good description of it if the word arm is replaced with the word weapon, basically everything would be normally animated except the weapon which would instead use rag-doll physics. That's what I'd prefer, fully operational physics for the weapon.
@everyone: I prefer answers that work with TGF1, BUT a MMF2 answer will still help me, please don't misunderstand and think that if you only use MMF2 you can't answer for some odd reason, thanks guys!, looking forward to your responses.
Edited by MBK
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
7th April, 2010 at 14:01:18 -
Just convert the 360 degree angle into 32 directions and use that to set the weapons direction. It won't be "smooth" as you said though. There's a reason everyones switching to mmf2 you know.
n/a
|
MBK
Registered 07/06/2007
Points 1578
|
7th April, 2010 at 21:53:36 -
Originally Posted by UrbanMonk Just convert the 360 degree angle into 32 directions and use that to set the weapons direction. It won't be "smooth" as you said though. There's a reason everyones switching to mmf2 you know.
Yea ... this is the main problem I have now though ... there's many examples for 32 directions in TGF1, but it seems like there's no way to make it true 360° rotations, creating the different directions on its own without a directional reference. Is there no way to simply rotate the current sprite on the direction rather than switching to another sprite contained in a different direction?
CONSTRUCT seems to be able to do 360º almost automatically, it's quite nice for that, but lacks in alot of other areas that I often use.
Does MMF2 Developer have the ability to use 360 degrees in such a manner? .. If so, where are the settings? .. How do I make it happen?
I'll start using MMF2 and forget about TGF1 for any projects using 360º rotations if the functionality is there and easy to use.
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
7th April, 2010 at 22:13:05 -
Yup, it's under "scale/angle".
|
MBK
Registered 07/06/2007
Points 1578
|
7th April, 2010 at 23:09:21 -
Is that the one that distorts the picture when it rotates, cause if so that's not what I'm looking for. ?
I'm completely MMF2 Illiterate, I've been looking around and I can't even figure out how to add more directions to an active ... it's stuck on 4. ... heh.
Edit: I found how to add directions up to 32 now, seems odd to me that it's a scrollbar.
You know ... why don't they just make it go up to 360 directions? or 720? or 1480? ... seems like it could use the same code to calculate them for ya. I know 360 directions isn't exactly the same as 360º but it should be more than enough to look smooth.
Note: I still can't find a way to rotate the sprite itself without picture distortion in MMF2. Check out Construct and you'll see what I'm talking about.
Edited by MBK
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
7th April, 2010 at 23:23:38 -
Setting the scale can distort, but setting the angle shouldn't. Having 360 animation directions would be unnecessary and confusing. Having 360 pretend directions... is what setting the angle is.
Edited by OMC
|
MBK
Registered 07/06/2007
Points 1578
|
7th April, 2010 at 23:46:30 -
oh ok .. thanks OMC
There's a way to change the angle during runtime right?
I'm gonna look for that now.
Edit: Ok, that's neat ... thanks again OMC ... I'm very tempted to move the project to MMF2 now .. there wouldn't happen to be an angle setting extension for TGF1 would there?
Edit2: Crap! .. I'm stuck again! ... I can't find where it shows the size of the sprite or how to change it!
Edit3: Nevermind ... oddly it's in with the art tools ... you'd think with all that blank space they could just leave it displayed on the left.
Edited by MBK
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
8th April, 2010 at 00:20:13 -
I can't believe you've had mmf2 all this time and haven't started using it.
Good sir please spare yourself the heartache of using out of date tools
n/a
|
|
|