Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VectorMove

Status
Not open for further replies.

Legolas7

Programmer
Mar 17, 2002
9
DE
So here another Question:
How is it possible to move an Vector or object by lingo?
without making any keyframes! And the moving must be visual... okay thanks
 
Use locV and locH

for example,
sprite (x).locV=sprite (x).locV+1
x being the sprite number you want to move.
so on mouseDown the sprite x will move one pixel down.

you could use it on a prepareFrame handler(along with an exitframe handler and go to frame action to hold it on the current) or as some button interaction.
 
Thanks for this Answer, but i really dont know if you mentioned my problem with the "visual" move.

I know how to move a sprite with lingo but when i use this with the mouse coords i want to have a visual

animation from the origin point of the sprite to the mouse coord. I have found out this code at the

bottom, but it is too fast, so there is "maybe" a possibility to slow this move down?!

That would be fine...
PS: In C i would use a timer for the effect of an animation but here in Lingo?...

CODE:

on mouseDown
steps = 10
initialLoc = sprite(1).loc
delta = (the clickLoc - initialLoc) / steps

repeat with i = 1 to steps
sprite(1).loc = initialLoc + (i * delta)
updateStage
end repeat

end mouseDown
 

You should see the movement of an object visually if you use locV+1 or -1 and locH+1 or -1 because it is moving the object
incremently by pixel.
Put that above code in a prepareFrame handler
and in the exitframe handler put play the frame or go to frame, it will keep looping to the same frame and move the sprite accordingly.
Otherwise I do not know what you mean by a "visual" move.
 
Oh saw your earlier posting about moving a sprite to a mouse
click. i would not know how to do that. Though it might use
mouseLoc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top