Click to See Complete Forum and Search --> : moving elements
Jiblob
04-12-2003, 12:03 PM
ok,
Ive got a load of tile on this movie.
When you click on 1 of the squares. This Green dot goes to the x and y position of the square that you clicked on. but...
I want to make it so that when you click on one of the tile, the dot moves gradually to the new x and y positions.
So you can c it moving from 1 place to another.
Please have a look (Attatchment)
TAR!:D
carnwath
04-12-2003, 02:40 PM
I changed the logic in your movie to do what you want
It now calculates the offset and moves it closer by increments
if(dx==bx)
{}
else
dude.position.x = dx - ((dx-bx)/5)
dx=dude.position.x
}
if(dy==by)
{}
else
{
dude.position.y = dy - ((dy-by)/5)
dy=dude.position.y
}
Jiblob
04-12-2003, 04:06 PM
THANKX,
Ok, I don't have any knowledge of Javascript, but i intend to learn.
can you tell me what the script is all about, what all the stuff is that is in the script. If ya know what i mean.
What is DX? BX? DY? BX?
thankx again
carnwath
04-12-2003, 05:57 PM
If you look at the copy of your original, plus my changes in the mymove.zip which I uploaded in the previous posting ---
Note that each time a button is clicked, instead of making the dude.position.x = button.position.x I do this instead -
dx = dude,position.x
bx = button.position.x
dy = dude,position.y
by = button.position.y
and this code is in every one of the twelve buttons, making dx, dy a variable holding the current dude x and y cordinates and bx,by the position coordinates of the button.
Now I add an action 2 times/second to move the dude a small amount in the x and y direction and save it in dx and dy again
dude.position.x = dx - ((dx-bx)/5)
dx=dude.position.x
dude.position.y = dy - ((dy-by)/5)
dy=dude.position.y
This action repeats until dx==bx and dy==by by which time the dude is exactly over the square button.
I chose the timing of the action ntimes/sec and the change amount ((dy-by)/5) until I got a movement which lasted about a second. If you made it be ((dy-by)/10) it would take about two seconds to complete etc etc.
I hope you understand what this all means. The future of 3dfa is tightly linked to actionscript/javascripting for a couple of reasons and you should keep visiting this discussion group where I will be posting open-source examples in the next week or so.
The most important reason is that scripting is the best way to perform anything which is interactive and needs a calculated result.
In your example you want the dude to glide to the spot.
In my examples elsewhere I want the dude to navigate a maze under the users control while hunters find their own way around the maze (by programmatically testing where their next step will be)
3dfa without scripting is no better than Swish, but with scripting it is in my opinion better than Macromedia Flash, for one reason. 3dfa has created a simple interface to allow you to paint objects, add buttons and edit boxes and now since v3.72 the ability to do programming. In Macromedia Flash the integrated designer has grown enormous and so its complexity. True, it is the market leader and you can do very minute detailing, kerning etc etc on a level with Adobe, for truly commercial quality work, but the learning time, cost and personal commitment is huge.
3dfa can be learned fairly quickly and produces acceptable quality graphics though I wish there was a zoom capability for tiny detail movement. For cartoon style graphics its great.
I will post a demo shortly showing how to communicate between parent and child movies, something which is useful to allow gamers to make sprite (attacking force) movies within control (main) movies so that the enemy attackers can easily be changed in defferent games.
JSDvs9172
04-12-2003, 07:03 PM
I would agree with the zoom feature thing if there was an easy tool for doing it without using a screen magnifier or anything... and there already is, in v4 beta 2. At the very top just before the play movie button are the buttons that control the zoom. They are, from left to right:
1. Zoom in,
2. Zoom out,
3. Zoom to Window, and
4. No zoom.
Just to not be confusing to the location of the buttons, they are under the movie name in the property sheet, NOT on the toolbar.
carnwath
04-12-2003, 07:39 PM
Is this zoom while in say the Paint Image painter ?
I want to zoom in on a section to tweak a point position like in Swish.
JSDvs9172
04-12-2003, 07:49 PM
It's in the Movie properties window. And it affects the entire view - no zoom to location is available. But it should be enough - I suppose you will have to scroll to the position you want in the meantime if the zoom is larger than the window can display without enlarging your resolution.
carnwath
04-12-2003, 08:03 PM
Then if any 3dfa staff are reading, add that to the V5 wishlist
When moving point during morphing or tweaking a paint object it would be really nice to be able to zoom in like Swish to see a close-up area where you are working...
I know, if all the ideas were implemented it would become as busy, and monstrous as Macromedia and I dont want that at all.
JSDvs9172
04-12-2003, 08:09 PM
That's a good idea. Maybe you should mail that to support@3dfa.com as a feature request.
>>>Adding a little extra I just thought about<<<
While I'm at it, let me remind you that we're still on beta 2 of v4, so if they do another beta it may be possible to have it in that.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.