Game Development Community

Custom Linkpoint Editor

by Andre Lind · in Torque Game Builder · 06/11/2007 (12:01 pm) · 6 replies

Hi!

I'm continuing my work on an oldschool RPG (a la FF6 style, I promise to blog about it soon ;) ) but now I need to set custom linkpoints
The linkpoint editor that's built in works for most things but not this....

I have to be able to step through the animations and set different points on different frames
So for example on frame1 I want 2 points, right_hand_pos and _right_hand_vec, probably with a framenumber attached to the linkpoint too...
Anyone here who have any suggestions on how to change the tool so it just shows 1 frame?
Or at least so I can step through, the naming and "just show the points for this frame" is just a bonus ;)

I've begun to check out levelBuilderLinkPointTool in the engine, but I'm not too familiar with the code...
Is this a good place to start or could it be done easier in TorqueScript perhaps?
My best guess is to edit the onMouseDown etc methods, but it's the "show 1 frame at a time" I can't understand and how to add "step buttons" and perhaps custom linkpoint naming....

All answers is appreciated ;)

// Andr

#1
06/12/2007 (6:04 pm)
Do you want to set linkpoints for a particular t2dAnimatedSprite, or for all objects using that animation? If it's the latter, one way to do it would be create a template file - a level with all the frames of the animation laid out as separate objects, with the appropriate linkpoints on each. Then you could load that in through script, and adjust the linkpoints dynamically in the onFrameChange callback.
#2
06/12/2007 (7:13 pm)
Quote:I have to be able to step through the animations and set different points on different frames

Perhaps if you use an onTimer callback, you can check to see what animation frame is currently playing:

getAnimationFrame()

then setting the appropriate link point using the link point ID:

setLinkPoint(%id, %offsetX, %offsetY)

As far as setting names for linkpoints, you'd most likely be better off just using the given ID's and making a spreadsheet to keep them all straight.
#3
06/12/2007 (9:40 pm)
I've been investigating this some more, and I *might* be on the wrong track...
The thing I want to do is the following:

For our turnbased battles I want interchangeable weapons
So I thought about doing an editor a la the linkpointeditor to assign 1 position to mount the weapon on and 1 direction variable to get the dir (possibly use the length of the 2 to change the size of the weapon)

So when the animation changes frame, I would like to mount the weapon to the new mountpoint and set direction (really hoping its fast enough) via the callbacks...

Suggestions?
#4
06/13/2007 (7:45 am)
Or you could just just change the mount offset to move it so it looks right for the different weapons. Look at the parameters for the mount function.
#5
06/13/2007 (9:16 am)
Joe: That was what I was going to do with the different coordinates...
What I'm aiming for is a simple editor to set these points

I've begun to script a simple editor, although I'm not that strong in the GUI department...

Does anyone know if there is a way to get the current selected object in the LevelEditor?
#6
06/16/2007 (11:10 am)
Something like that! It's done (or at least working, ugly quick-code but its working...)

If anyone want to see a quick pic, you can get a peek here
www.frikkinsoft.eu/assets/001-00000.png
The "squares" are just t2dSceneobjects and debug rendering is turned on...
All I need is to see where they are :P