Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Opyuse webforumsuser@macromedia.com #1
More Help needed with the randomly falling sprites
Eariler I asked for help with randomly falling sprites and I was given the code below. However now I'm getting the following error message when I try to use it,
Variable used before assigned a value
Case pMode of?
Please Can You tell me What to do to correct this.
Thank you
property pS, spriteNum, pInterval, pStartPause, pMode, pSpeed
on beginSprite me
pS = sprite (spriteNum)
pInterval = random (3) -- seconds
pStartPause = the ticks
pMode = #wait
pSpeed = random (20) + 5
pS.locV = - pS.height
pS.locH = random (the stageRight - the stageLeft)
end
on exitFrame me
case pMode of
#wait:
if the ticks > pStartPause + pInterval * 60 then
pMode = #falling
end if
#falling:
if pS.top < the stageBottom then
pS.locV = pS.locV + pSpeed
else
pMode = #reset
end if
#reset:
pS.locV = - pS.height
pS.locH = random (the stageRight - the stageLeft)
pMode = #wait
pStartPause = the ticks
end case
end
Opyuse webforumsuser@macromedia.com Guest
-
Legitimate mails falling into Junk folder of Hotmail
ASP generated e-mails are getting into junk folder of hotmail. I have checked everything on my end like SPF, Reverse DNS lookup, etc. I am not... -
Randomly select from xml
Please excuse my limited knowledge regarding dynamic html, I usually work with standalone flash apps. My situation is as follows; I have set up a... -
Randomly Ordered Recordset
Hello everyone, I'm using MX04, Access, VB Script. I need to select 10 unique records and randomly order them. I've done quite a bit of... -
Threads falling apart
Hi folks, recently my NR often fails to put news threads together. Is it just my NR or is there still something wrong with the News <-> Mail... -
Help creating randomly falling sprites with lingo
Attach the following behavior to each sprite that's to fall. Adjust the pSpeed parameter to make the objects fall faster or slower. Adjust the... -
David Downie #2
Re: More Help needed with the randomly falling sprites
Are you sure you've copied the code correctly, including the first line
below? It works fine on my machine. Do you have it in a behaviour attached
to the sprite that is moving? You've got to try a few things.
"Opyuse" <webforumsuser@macromedia.com> wrote in message
news:bh6at1$4mo$1@forums.macromedia.com...code below. However now I'm getting the following error message when I try> Eariler I asked for help with randomly falling sprites and I was given the
to use it,>
> Variable used before assigned a value
> Case pMode of?
>
> Please Can You tell me What to do to correct this.
> Thank you
>
>
> property pS, spriteNum, pInterval, pStartPause, pMode, pSpeed
>
> on beginSprite me
> pS = sprite (spriteNum)
> pInterval = random (3) -- seconds
> pStartPause = the ticks
> pMode = #wait
> pSpeed = random (20) + 5
> pS.locV = - pS.height
> pS.locH = random (the stageRight - the stageLeft)
> end
>
> on exitFrame me
> case pMode of
> #wait:
> if the ticks > pStartPause + pInterval * 60 then
> pMode = #falling
> end if
> #falling:
> if pS.top < the stageBottom then
> pS.locV = pS.locV + pSpeed
> else
> pMode = #reset
> end if
> #reset:
> pS.locV = - pS.height
> pS.locH = random (the stageRight - the stageLeft)
> pMode = #wait
> pStartPause = the ticks
> end case
> end
>
>
>
David Downie Guest
-
Word of Mouth Productions #3
Re: More Help needed with the randomly falling sprites
Your post should be part of the original thread.
--
Craig Wollman
Word of Mouth Productions
phone 212 724 8302
fax 212 724 8151
[url]www.wordofmouthpros.com[/url]
"Opyuse" <webforumsuser@macromedia.com> wrote in message
news:bh6at1$4mo$1@forums.macromedia.com...code below. However now I'm getting the following error message when I try> Eariler I asked for help with randomly falling sprites and I was given the
to use it,>
> Variable used before assigned a value
> Case pMode of?
>
> Please Can You tell me What to do to correct this.
> Thank you
>
>
> property pS, spriteNum, pInterval, pStartPause, pMode, pSpeed
>
> on beginSprite me
> pS = sprite (spriteNum)
> pInterval = random (3) -- seconds
> pStartPause = the ticks
> pMode = #wait
> pSpeed = random (20) + 5
> pS.locV = - pS.height
> pS.locH = random (the stageRight - the stageLeft)
> end
>
> on exitFrame me
> case pMode of
> #wait:
> if the ticks > pStartPause + pInterval * 60 then
> pMode = #falling
> end if
> #falling:
> if pS.top < the stageBottom then
> pS.locV = pS.locV + pSpeed
> else
> pMode = #reset
> end if
> #reset:
> pS.locV = - pS.height
> pS.locH = random (the stageRight - the stageLeft)
> pMode = #wait
> pStartPause = the ticks
> end case
> end
>
>
>
Word of Mouth Productions Guest
-
Roofy webforumsuser@macromedia.com #4
Re: More Help needed with the randomly falling sprites
you are actually going to have more than just the pMode error. After you fix that you the errors are going to acure.
#reset, and #wait should also cause some kind of error since these are not defined as well
reasons why...
pMode is still not set to a varible because your tring to change a predefined command the word wait with to a custom varible #wait so it would mean that #wait would not be defined. I would also suggest leaving alone any words that the text changes it color to anything else other then black. Meaning if the string of text that your going to use as a varible or custom handler is not black, then don't use it. Here are a couple of hints.
a. if you need a varible to rember itself throughout the behaviour script or movie script then the varible needs to be placed at the top of the script before any handlers are created and any varibles that need to be assigned to. These kind of varibles are called global varibles, and varibles that only need to be known inside a handler are called local varibles.
b. For global varibles that need to be remebered in a behaviour script then you can use property, and if it is a movie script then you use global. for example, for a behaviour script you would type in "property myVarible" without the quotes, and for a movie script you would type in "global myVarible" without the quotes.
c. When you define global varibles, I allways put a "p" or a "g" in front of the word to remind myself that this is a global varible, and it also gets rid of not worrying if I am using a predefined word that Director already uses. So you can use #pWait which reminds you that it is a global varible and still makes it understandable to what that varible stands for.
so in the case that you want to do a "case of situation", the varible cases need to be defined as global varibles as well before you can assign pMode. Meaning even though you set pMode in the global area you still cant say pMode = cat or what ever you want it to equal to without assigning that varible first. My sugestion would be to do it this way....
property pWait, pReset, pFalling
property pMode
on beginSprite
pWait = 1
pReset = 2
pFalling = 3
pMode = pWait
end beginSprite
then you can use these varibles in the case of situation you have.
I hope this makes things more clearer for you.
regaurds,
Bob
Roofy webforumsuser@macromedia.com Guest



Reply With Quote

