|
Click here to Download the Director File
Edit the Score Script with Lingo
Double click the first box in the score script. See the diagram below.
A script window will appear. Type the following behavior in the score script.
on exitFrame go to the frame sprite(1).destloc = the mouseLoc -- This makes the sprite follow the mouse. end
Add destLoc behavior to the image on the stage.
Select the image on the stage.
Bring up the Window->Inspectors->Property Inspector. Go to the second tab
Hold down the +, select New Behavior Name it destLoc Click the script button in the Property Inspector Type the following script:
on exitframe a = the currentSpriteNum sprite(a).locH = sprite(a).locH + 2 end
Hit the play arrow and run this, your image should be moving across the screen to the right.
Use destLoc change the location of the sprite with deceleration.
property destLoc
on beginsprite a = the currentspritenum destloc = sprite(a).loc end
on exitframe a = the currentspritenum --check where the mouse is dist = destloc.locH - sprite(a).locH sprite(a).locH = sprite(a).locH + dist / 10 dist = destloc.locV - sprite(a).locV sprite(a).locV = sprite(a).locV + dist / 10 end |