Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Hardcore #1
Scrolling sprites in multiple channels
Hi there,
I have sprites in 3 channels that need to scroll together. I was hoping I could use the script I used below for a simple 1 channel scroll.
--------------------------------------------------------------------------------------------------------------------
on mouseWithin
if sprite(3).locV < 545 then -- constraint for sprite(7)
sprite(3).locV = sprite(3).locV + 6 -- sets speed for scrolling down
end if
updateStage -- redraws the Stage immediately showing the new location of sprites
end mouseWithin
--------------------------------------------------------------------------------------------------------------------
I need to know if its possible to define the 3 channels in a group somehow in the above script?
Please Please HELP! :)
Thanks
Hardcore Guest
-
Streaming multiple audio channels
Hello all. I am a software developer for a major metropolitan fire department and we are investigating adding streaming audio to our intranet site.... -
Please - need help using multiple sound channels
Hello Users. I am a complete newbie when it comes to Director. I want to create a simple project with sound. I have 3 small sound clips: tecno.wav,... -
Using Lingo to stop sprites from scrolling at a certain point.
Hi All, I have a project I'm working on. Basically, I have 10 sprites that move horizontally left or right when moused over. The problem I have... -
Merging Multiple Channels
I have received a file with 8 alpha channels. I need to convert this to a jpg. There is only 1 background layer. When I convert to cmyk or rgb, the... -
manipulating Flash in multiple channels
I feel a complete fool. This seems so simple. In channel 1, I have a .swf entitled "puzzle" In channel 2, I have a .swf entitled "menu-bar" ... -
Arturo Toledo #2
Re: Scrolling sprites in multiple channels
U cannot group objects in Lingo. That would be an awesome feature.
Are u trying to scroll a text member??? an image, a Flash object???
Arturo
"Hardcore" <insane@netactive.co.za> escribió en el mensaje
news:bqg5sk$gso$1@forums.macromedia.com...could use the script I used below for a simple 1 channel scroll.> Hi there,
>
> I have sprites in 3 channels that need to scroll together. I was hoping I------------------------------------------>
> --------------------------------------------------------------------------down> on mouseWithin
> if sprite(3).locV < 545 then -- constraint for sprite(7)
> sprite(3).locV = sprite(3).locV + 6 -- sets speed for scrollingsprites> end if
>
> updateStage -- redraws the Stage immediately showing the new location of------------------------------------------> end mouseWithin
> --------------------------------------------------------------------------in the above script?>
> I need to know if its possible to define the 3 channels in a group somehow>
> Please Please HELP! :)
>
> Thanks
>
>
Arturo Toledo Guest
-
Hardcore #3
Re: Scrolling sprites in multiple channels
Hi Arturo,
Thanks for the reply...
I guess we have another item to add to the next version wish list! :)
The sprites I want to move are images. I would have made them all one image, but I have 2 buttons that need to be active as well!
Any other ideas that may help me?
Thanks
M
Hardcore Guest
-
luk #4
Odp: Scrolling sprites in multiple channels
Instead of using groups... we can use the same script for all those sprites
and use me.SpriteNum
don't ya think ?
regards
lukpcn
Użytkownik Hardcore <insane@netactive.co.za> w wiadomooci do grup
dyskusyjnych napisał:bqhgsn$eg5$1@forums.macromedia.com...image, but I have 2 buttons that need to be active as well!> Hi Arturo,
>
> Thanks for the reply...
>
> I guess we have another item to add to the next version wish list! :)
>
> The sprites I want to move are images. I would have made them all one>
> Any other ideas that may help me?
>
> Thanks
> M
>
>
luk Guest
-
Rob Dillon #5
Re: Scrolling sprites in multiple channels
You have a number of options. You can just add the other two sprites to
the same function:
--------
on mouseWithin
if sprite(3).locV < 545 then -- constraint for sprite(7)
sprite(3).locV = sprite(3).locV + 6 -- sets speed for scrolling
down
sprite(X).locV = sprite(X).locV + 6
sprite(Y).locV = sprite(Y).locV + 6
end if
end mouseWithin
---------
You don't need to use updateStage with a mouseWithin function,
mouseWithin sends messages at the frame rate and so the state will be
updated at the frame rate in any case.
or:
---------
property spritesToMove
on beginSprite me
spritesToMove = [3,4,5]
end
on mouseWithin
if sprite(spritesToMove[1]).locV < 545 then
repeat with i in spritesToMove
sprite(i).locV = sprite(i).locV + 6
end repeat
end if
end
---------
I would do this sort of thing by creating a property to hold a boolean
value and then set that boolean value in a mouseEnter and mouseLeave
function. Then I would use a prepareFrame function to change the locV
of each of the sprites. Something like this:
---------
property thisSprite
property animateMe
property spritesToMove
property maxDistance
property eachStep
on getPropertyDescriptionList
myPropList = [:]
myPropList[#spritesToMove] = [#comment:"enter the sprite numbers to
be animated, separate with commas:",#format:#string,#default:"1,2,3"]
myPropList[#maxDistance] = [#comment:"enter the maximum distance for
sprite's locV:",#format:#integer,#default:545]
myPropList[#eachStep] = [#comment:"select a step distance to
move:",#range:[#min:1,#max:20],#format:#integer,#default:6]
return myPropList
end
on beginSprite me
thisSprite = me.spriteNum
animateMe = 0
spritesToMove = stringToList(spritesToMove)
end
on mouseEnter me
animateMe = 1
end
on mouseLeave me
animateMe = 0
end
on prepareFrame me
if animateMe then
if sprite(spritesToMove[1]).locV < maxDistance then
repeat with i in spritesToMove
sprite(i).locV = sprite(i).locV + eachStep
end repeat
end if
end if
end
on stringToList theString
tempList = []
oldDelim = the itemDelimiter
the itemDelimiter = ","
thisManyItems = theString.item.count
repeat with i = 1 to thisManyItems
tempList[i] = value(theString.item[i])
end repeat
the itemDelimiter = oldDelim
return tempList
end
-------
Now you can adjust every aspect of your animation: the sprites that are
moved, the distance and the starting point.
--
Rob
_______
Rob Dillon
Team Macromedia
[url]http://www.ddg-designs.com[/url]
412-243-9119
[url]http://www.macromedia.com/software/trial/[/url]
Rob Dillon Guest
-
Hardcore #6
Re: Scrolling sprites in multiple channels
Hey Rob,
Thanks... worked like a charm!
M
Hardcore Guest
-
Mark A. Boyd #7
Re: Scrolling sprites in multiple channels
On 01 Dec 2003, "Hardcore" <insane@netactive.co.za> wrote:
Just to add another solution, "Follow the leader", based on sprite.loc> I have sprites in 3 channels that need to scroll together. I was
> hoping I could use the script I used below for a simple 1 channel
> scroll.
positions.
Here's a behavior you can drop on as many "follower" sprites as you wish.
It's easiest if you select all those sprites in the score and drop this
behavior on them all at once. Just point it to the "Leader" sprite.
-- Follow the Leader behavior
property pLeadSprite
property pLeadLoc
property pOffSet
property pSprite
on beginSprite me
pSprite = sprite(me.spriteNum)
myLoc = pSprite.loc
pOffSet = myLoc - sprite(pLeadSprite).loc
pLeadLoc = sprite(pLeadSprite).loc
end
on prepareFrame me
if sprite(pLeadSprite).loc <> pLeadLoc then
pSprite.loc = sprite(pLeadSprite).loc + pOffSet
pLeadLoc = sprite(pLeadSprite).loc
end if
end
on getPropertyDescriptionList me
sprList = getSprites(me)
pList = [:]
pList[#pLeadSprite] = [#comment:"Which sprite do I follow?"]
pList[#pLeadSprite][#format] = #integer
pList[#pLeadSprite][#default] = 10
pList[#pLeadSprite][#range] = sprList
return pList
end
on getSprites me
sprList = []
repeat with i = 1 to the lastChannel
if sprite(i).member.type <> #EMPTY then
add (sprList, i)
end if
end repeat
return sprList
end
There have also been suggestions using sendSprite messages to inform any
"follower" sprites that it's time to move and where to move.
--
Mark A. Boyd
Keep-On-Learnin' :)
Mark A. Boyd Guest



Reply With Quote

