Ask a Question related to Macromedia Director Lingo, Design and Development.
-
ieraks webforumsuser@macromedia.com #1
help me please i'm desperate
This is a script tha i can drag a sprite and release is somewhere and check if it is correct
how can i force it to be unmoveable the next time i'll try to move it , if it is correct or second wrong
Help me please i am desperate
************************************************** *******************************
property pPressed, pClickDiff, pLockToSprite, pOrigLoc, pLockDist, pSnapBack,try,
global points
on getPropertyDescriptionList me
list = [:]
addProp list, #pLockToSprite, [#comment: "Lock To Sprite",\
#format: #integer, #default: 0]
addProp list, #pLockDist, [#comment: "Maximum Lock Distance",\
#format: #integer, #default: 25]
addProp list, #pSnapBack, [#comment: "Snap Back If Not Locked",\
#format: #boolean, #default: TRUE]
return list
end
on beginSprite me
pPressed = FALSE
pOrigLoc = sprite(me.spriteNum).loc
try=0
end
on mouseDown me
pPressed = TRUE
pClickDiff = sprite(me.spriteNum).loc - the clickLoc
end
on mouseUp me
release(me)
end
on mouseUpOutside me
release(me)
end
on exitFrame me
if pPressed then
sprite(me.spriteNum).loc = the mouseLoc + pClickDiff
end if
end
on release me
pPressed = FALSE
try=try+1
if distance(me,sprite(me.spriteNum).loc,sprite(pLockT oSprite).loc)\
< pLockDist then
sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
member("lef").text="Well Done"
sound(1).play(member("correct sound 1"))
points=points+10
member("pointss").text=string(points)
else if pSnapBack then
if try=1 then
member("lef").text="Sorry! Wrong answer. Study the words and try again."
sprite(me.spriteNum).loc =pOrigLoc
sound(1).play(member("wrong sound 1"))
else
sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
member("lef").text="Sorry! Wrong answer again. I'll show you the correct answer."
sound(1).play(member("wrong sound 2"))
end if
end if
end
ieraks webforumsuser@macromedia.com Guest
-
Desperate !
Using demo version of Contribute4 on a Mac10.4.8, .Mac server and demo of Sandvox authoring for website. Everything was working fine, cleaned out... -
Also Desperate
Thank you so much David for all your assitance, but I am still having problems; now different ones. I went through your tutorial and tried again to... -
HELP! I'm Desperate...
Hi, I'm going off to school and won't have computer access for like 9 months... :-\ .. and I need someone with a couple of hours every week to... -
I'm DESPERATE...
I need a hit counter for Dreamweaver version 4. Where do I go to GET a hit counter. Is there a free one from Macromedia that I can download for... -
Please help, am desperate
Hi All. I'm looking for a file, ActiveSM.ocx. I've been spending all day combing the internet for it and can't find it. Can anyone please email... -
Dave Mennenoh #2
Re: help me please i'm desperate
All you need to do is add a property to your script - a flag.
property doneMoving
then within beginSprite:
doneMoving = False
now, in mouseDown before you set pPressed do a check:
if not(doneMoving) then
pPressed = True
Finally, in the spot where you determine if it is in the right spot, and
increment the points, set doneMoving to true
--
Dave
[url]http://www.blurredistinction.com/director[/url]
Dave Mennenoh Guest
-
johnAq webforumsuser@macromedia.com #3
Re: help me please i'm desperate
property pPressed, pClickDiff, pLockToSprite, pOrigLoc, pLockDist, pSnapBack,try,
property pEnabled
global points
on getPropertyDescriptionList me
list = [:]
addProp list, #pLockToSprite, [#comment: "Lock To Sprite",\
#format: #integer, #default: 0]
addProp list, #pLockDist, [#comment: "Maximum Lock Distance",\
#format: #integer, #default: 25]
addProp list, #pSnapBack, [#comment: "Snap Back If Not Locked",\
#format: #boolean, #default: TRUE]
return list
end
on beginSprite me
pPressed = FALSE
pEnabled = TRUE
pOrigLoc = sprite(me.spriteNum).loc
try=0
end
on mouseDown me
if pEnabled = TRUE then
pPressed = TRUE
end if
pClickDiff = sprite(me.spriteNum).loc - the clickLoc
end
on mouseUp me
release(me)
end
on mouseUpOutside me
release(me)
end
on exitFrame me
if pPressed then
sprite(me.spriteNum).loc = the mouseLoc + pClickDiff
end if
end
on release me
pPressed = FALSE
pEnabled = FALSE
try=try+1
if distance(me,sprite(me.spriteNum).loc,sprite(pLockT oSprite).loc)\
< pLockDist then
sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
member("lef").text="Well Done"
sound(1).play(member("correct sound 1"))
points=points+10
member("pointss").text=string(points)
else if pSnapBack then
if try=1 then
member("lef").text="Sorry! Wrong answer. Study the words and try again."
pEnabled = TRUE
sprite(me.spriteNum).loc =pOrigLoc
sound(1).play(member("wrong sound 1"))
else
sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
member("lef").text="Sorry! Wrong answer again. I'll show you the correct answer."
sound(1).play(member("wrong sound 2"))
end if
end if
end
johnAq webforumsuser@macromedia.com Guest
-
johnAq webforumsuser@macromedia.com #4
Re: help me please i'm desperate
Sorry - I hit Send too early
I've hilited my (untested) additions to the code in bold.
If it doesn't work, it should be fairly simple to see what is going on, basically I've introduced the property pEnabled which is just a boolean flag which must be TRUE for dragging to commence
hth
johnAq
johnAq webforumsuser@macromedia.com Guest
-
Word of Mouth Productions #5
Re: help me please i'm desperate
Add a pUsed property, initialize it as FALSE in your beginsprite handler
then add a conditional statement to your mouseDown handler that checks for
pUsed to be FALSE. Inside that conditional statement add pUsed = TRUE.
This way the mouseDown handler won't execute any of it's code inside the
conditional statement after one click.
You could also create a switch handler that would reset the property if you
want to control if you're going to give the user a second chance at some
point.
--
Craig Wollman
Word of Mouth Productions
phone 212 724 8302
fax 212 724 8151
[url]www.wordofmouthpros.com[/url]
"ieraks" <webforumsuser@macromedia.com> wrote in message
news:br74il$lnc$1@forums.macromedia.com...check if it is correct> This is a script tha i can drag a sprite and release is somewhere andif it is correct or second wrong> how can i force it to be unmoveable the next time i'll try to move it ,************************************************** **************************> Help me please i am desperate
>
>
*****pSnapBack,try,> property pPressed, pClickDiff, pLockToSprite, pOrigLoc, pLockDist,again."> global points
>
> on getPropertyDescriptionList me
> list = [:]
> addProp list, #pLockToSprite, [#comment: "Lock To Sprite",\
> #format: #integer, #default: 0]
> addProp list, #pLockDist, [#comment: "Maximum Lock Distance",\
> #format: #integer, #default: 25]
> addProp list, #pSnapBack, [#comment: "Snap Back If Not Locked",\
> #format: #boolean, #default: TRUE]
> return list
> end
>
>
>
> on beginSprite me
> pPressed = FALSE
> pOrigLoc = sprite(me.spriteNum).loc
> try=0
>
>
> end
>
> on mouseDown me
> pPressed = TRUE
> pClickDiff = sprite(me.spriteNum).loc - the clickLoc
> end
>
>
> on mouseUp me
> release(me)
> end
>
> on mouseUpOutside me
> release(me)
> end
>
> on exitFrame me
> if pPressed then
> sprite(me.spriteNum).loc = the mouseLoc + pClickDiff
> end if
> end
>
>
> on release me
> pPressed = FALSE
> try=try+1
> if distance(me,sprite(me.spriteNum).loc,sprite(pLockT oSprite).loc)\
> < pLockDist then
> sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
> member("lef").text="Well Done"
> sound(1).play(member("correct sound 1"))
> points=points+10
> member("pointss").text=string(points)
> else if pSnapBack then
> if try=1 then
> member("lef").text="Sorry! Wrong answer. Study the words and trycorrect answer."> sprite(me.spriteNum).loc =pOrigLoc
> sound(1).play(member("wrong sound 1"))
> else
> sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
> member("lef").text="Sorry! Wrong answer again. I'll show you the> sound(1).play(member("wrong sound 2"))
> end if
> end if
>
> end
>
>
>
Word of Mouth Productions Guest
-
Word of Mouth Productions #6
Re: help me please i'm desperate
Oops, I didn't see Dave's response. Sorry for the redundancy.
--
Craig Wollman
Word of Mouth Productions
phone 212 724 8302
fax 212 724 8151
[url]www.wordofmouthpros.com[/url]
"ieraks" <webforumsuser@macromedia.com> wrote in message
news:br74il$lnc$1@forums.macromedia.com...check if it is correct> This is a script tha i can drag a sprite and release is somewhere andif it is correct or second wrong> how can i force it to be unmoveable the next time i'll try to move it ,************************************************** **************************> Help me please i am desperate
>
>
*****pSnapBack,try,> property pPressed, pClickDiff, pLockToSprite, pOrigLoc, pLockDist,again."> global points
>
> on getPropertyDescriptionList me
> list = [:]
> addProp list, #pLockToSprite, [#comment: "Lock To Sprite",\
> #format: #integer, #default: 0]
> addProp list, #pLockDist, [#comment: "Maximum Lock Distance",\
> #format: #integer, #default: 25]
> addProp list, #pSnapBack, [#comment: "Snap Back If Not Locked",\
> #format: #boolean, #default: TRUE]
> return list
> end
>
>
>
> on beginSprite me
> pPressed = FALSE
> pOrigLoc = sprite(me.spriteNum).loc
> try=0
>
>
> end
>
> on mouseDown me
> pPressed = TRUE
> pClickDiff = sprite(me.spriteNum).loc - the clickLoc
> end
>
>
> on mouseUp me
> release(me)
> end
>
> on mouseUpOutside me
> release(me)
> end
>
> on exitFrame me
> if pPressed then
> sprite(me.spriteNum).loc = the mouseLoc + pClickDiff
> end if
> end
>
>
> on release me
> pPressed = FALSE
> try=try+1
> if distance(me,sprite(me.spriteNum).loc,sprite(pLockT oSprite).loc)\
> < pLockDist then
> sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
> member("lef").text="Well Done"
> sound(1).play(member("correct sound 1"))
> points=points+10
> member("pointss").text=string(points)
> else if pSnapBack then
> if try=1 then
> member("lef").text="Sorry! Wrong answer. Study the words and trycorrect answer."> sprite(me.spriteNum).loc =pOrigLoc
> sound(1).play(member("wrong sound 1"))
> else
> sprite(me.spriteNum).loc = sprite(pLockToSprite).loc
> member("lef").text="Sorry! Wrong answer again. I'll show you the> sound(1).play(member("wrong sound 2"))
> end if
> end if
>
> end
>
>
>
Word of Mouth Productions Guest
-
ieraks webforumsuser@macromedia.com #7
Re: help me please i'm desperate
thanks for your help
thanks a lot but
the points of this script are still working .
if i"ll try to drag it , the sprite is unmoveable and this is ok, but
the points are still going up
ieraks webforumsuser@macromedia.com Guest
-
Dave Mennenoh #8
Re: help me please i'm desperate
Well, add the check into your mouseUp then as well so you don't call
release...
--
Dave
[url]http://www.blurredistinction.com/director[/url]
Dave Mennenoh Guest
-
ieraks webforumsuser@macromedia.com #9
Re: help me please i'm desperate
i cant understand you because i am stupid
can you help me more?
ieraks webforumsuser@macromedia.com Guest



Reply With Quote

