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!

animation ? ?

Status
Not open for further replies.

leatherpuppetz

Technical User
May 18, 2001
7
US
heres what im trying to do... any help would be great

animate a simple object to go from starting on the left side of the stage to go to the right side of the stage, using only 1 sprite , with only a max of 8 lines of code, but im shootin for cutting it down to only the use of 2 lines of code....maybe 3.. can any 1 help me with the code to do this... i have to animate this using only Lingo and nothing else.... any1 have any ideas??
 
on the sprite
property spritenum

on exitframe
sprite(spritenum).loch = sprite(spritenum).loch + 1
end

on your frame script in frame 1
on exitframe
go to the frame
end

 
thankz for the reply but i still cant get it to werk... im kinda new to director....and im not sure on were exactly to put these codez.... can u please make a little tutorial for me if thats possible....heres what i did...i made an obect on the stage...pulled it to 1 sprite only... on my frame script i put

on exitframe
go to the frame
end

then on my object i put the script

on exitframe
sprite(spritenum).loch = sprite(spritenum).loch + 1
end

do i have to add anything else??? im kinda stuck here:)

thankz

 
ok i got it to werk :) but then animation goes off the stage and doesnt come back... i need it to reach the end of the stage....then animated back to where it started..and loop..... thanks for the help :)
 
the only bit you missed was the property definition on the object script. I put start and end code markers around the script so you can see the entire block.

-----start code --------------------
property spritenum

on exitframe
sprite(spritenum).loch = sprite(spritenum.loch + 1
end
-------end code-------------------------
or you could do something like

-----start code --------------------
on exitframe me
sprite(me.spritenum).loch = sprite(me.spritenum).loch + 1
end
-------end code-------------------------

the final way to do it, and this is the way most people do it when they start is

-----start code --------------------
on exitframe
sprite(1).loch = sprite(1).loch + 1
end if
-------end code-------------------------
This way works fine but doesn't allow you to move your sprites around because as soon as you put the sprite in channel 2 you have to edit the script.

Just realised that you may want to stop the object before it goes off the page, that will require some additional code

-----start code --------------------
on exitframe me
repeat while sprite(me.spritenum).loch < 500
sprite(me.spritenum).loch = sprite(me.spritenum) +1
update stage
end repeat
end
-------end code-------------------------


 
i tryed the last code but the < part of the code crashes my director application....i go t no idea y.....thanks anyways
 
oops, typo. the code did work, just VERY VERY fast(and after fixing the typo). I thought you were the person who didn't want to use any if statements otherwise I would have given you this code sooner. teach me to not read the first post again. and sorry about the typo, I generally don't double check things in forums.


on exitframe me
if sprite(me.spritenum).loch < 100 then
sprite(me.spritenum).loch = sprite(me.spritenum).loch +1
end if
end

change the 100 to whatever the width of your movie is


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top