Hi everybody,
My images can now be moved around and "second-button-clicked" with no problems. Thanks
to the help from you people!
But another small fenomenon has occured. After moving one image I (sometimes) have to
click twice on next image to make it respond to moving. It is as if I'm still stuck in
a script with the first image.
The image can be moved "directly" on the card but also "called" to move from a small
stack where it has been "carried around" or called to move from another image .
All of it works fine except for the dubble click which I don't understand.
Sorry if I have trouble expressing myself correct. And bare with me and my "sort of
programming". ;o) BTW, I miss Grant something terrible cause he was always
"defending" us "small programming people". And giving lots of encouragement. (sigh...)
------------------------------------------------
Here follows script from two images where this is happening.
==== Image 1, a bucket with oats.
on mouseEnter
lock cursor
set cursor to 1
end mouseEnter
on mouseLeave
unlock cursor
end mouseLeave
local lBuOa
on mouseDown
if not lBuOa then
put true into lBuOa
else
mouseUp
end if
end mouseDown
on mousemove
if lBuOa then
if the mouse is down then
grab me
end if
end if
end mouseMove
on mouseUp
if lBuOa then
global gBarrowLoc
put short name of me into tName
--- checking if it should be brought ------
if intersect (me, grc "Carry") then
if "water" is not in windows() then
hide me
set loc of me to 1000,1000
open inv stack "water" --- the stack carrying all buckets
set defaultstack to "water"
set the uwaName of stack "buckets" to tName --- stack where water buckets be
filled
set filename of image "waBu" to imagepath(Bu.gif)
set rect of image "WaBu" to 1,1,61,55
set the lockloc of image "WaBu" of stack "water" to true
set topleft of image "WaBu" to 1,1
set rect of stack "water" to the rect of image "WaBu"
put the screenloc into gwaterLoc
subtract 23 from item 1 of gwaterLoc
add 156 to item 2 of gwaterLoc
show stack "water" at gWaterLoc
palette "water"
show stack "water"
set the uCarrot of stack "Water" to Oats -- keeping track on what's in the
bucket
put false into lBuCa
exit mouseUp
else
play "harpsi" --- if a bucket is already being carried, warn
end if
end if
if intersect (me,grc "getOats") then ---empty the bucket
set the uSnd of stack "horses" to empty
play stop
play mediaPath(getOats)
show image "BuTo" at the loc of me
set the uCarrot of stack "Water" to empty
hide me
set loc of me to 1000,1000
put false into lBuCa
send "buDown" to image "BuTo" --- move the emptied bucket right away
exit mouseUp
end if
end if
----- if thrown out of game screen ---
if left of me <24 then
set left of me to 24
end if
if right of me > 485 then
set right of me to 485
end if
if top of me > 460 then set bottom of me to 340
put flushevents("mouseup")
put false into lBuOa
end mouseUp
--- called from another stack or image----
on BuDown
put true into lBuOa
set layer of me to 120
if lBuOa then
if the mouse is down then
set loc of me to the mouseloc
send "BuDown" to me in 5 milliseconds
else
mouseUp
end if
end if
end BuDown
=== image2, a scoop ===========
on mouseEnter
lock cursor
set cursor to 1
end mouseEnter
on mouseLeave
unlock cursor
end mouseLeave
local lSkopa
on mouseDown
if not lskopa then
put true into lSkopa
set layer of me to 90
else
mouseUp
end if
end mouseDown
on mouseMove
if lSkopa then
if the mouse is down then
grab me
end if
end if
end mouseMove
on mouseUp
---- filling the scoop ----
if lSkopa then
if intersect (me, grc "getOats") then
set the uSnd of this stack to empty
play stop
play mediaPath(getOats)
show image "SkOa" at the mouseLoc
hide me
put false into lSkopa
exit to metaCard
end if
if intersect (me, grc "getCarrot") then
set the uSnd of this stack to empty
play stop
play mediaPath(GetCarrot)
show image "SkCa" at the mouseLoc
hide me
put false into lSkopa
exit to metaCard
end if
--- checking if thrown off game screen ---
if left of me <24 then
set left of me to 24
end if
if right of me > 485 then
set right of me to 485
end if
if top of me > 460 then set bottom of me to 340
put flushevents("mouseup")
end if
put false into lSkopa
end mouseUp
-- called from other images ---
on SkopaDown
put true into lSkopa
set layer of me to 120
if lSkopa then
if the mouse is down then
set loc of me to the mouseloc
send "SkopaDown" to me in 5 milliseconds
else
mouseUp
end if
end if
end SkopaDown
---------------------
Regards,
Eva