Nuevamente GUSOR

Perdona si soy un poco antipesornal pero est pregunta ya la havian formulado: "Tengo que hacer un ejercicio para los niños, en el, aparecen nueve palabras y tres dibujos, tres palabras por dibujo, y el niño debe arrastrar las palabras al dibujo con el que se relacionan, si no coincide no se colocan en el dibujo, y si es correcto si, se colocan formando una columna encima de cada dibujo, se como hacer casi todo,o eso creo, menos lo de que se coloquen formando una columna encima del dibujo. No se si entiends lo que quiero explicar, si no lo entiendes no te preocupes, que ya me empiezo a sentir un poco pesado.
Te lo digo en serio, cuando me este pasando con las preguntas dimelo. Ya me has ayudado un monton.
Un saludo o abrazo grandisimo."
Me pudes ayudar al respecto
Nuevamente mil gracias
GUSOR

1 respuesta

Respuesta
1
Te pongo aqui un behaviour sencillo de gary Rosenzweig que te solucionará el problema:
Es para vincular a los miembros que mueves.
Property pDrag -- is the sprite currently being dragged
property pOffset -- the cursor offset used in the drag
property pOrigLoc -- the starting location of the sprite
property pLocked -- is the sprite locked in place
-- set all of the properties that need it
on beginSprite me
pOrigLoc = sprite(me.spriteNum).loc
pDrag = FALSE
pLocked = FALSE
end
on mouseDown me
-- don't allow to drag if already in place
if pLocked = TRUE then exit
-- set to drag
pDrag = TRUE
-- record offset between cursor and sprite
pOffset = sprite(me.spriteNum).loc - the mouseLoc
end
-- turn off dragging and check for correct placement
on mouseUp me
pDrag = FALSE
checkLock(me)
end
on mouseUpOutside me
pDrag = FALSE
checkLock(me)
end
-- reposition sprite if being dragged
on prepareFrame me
if pDrag then
sprite(me.spriteNum).loc = the mouseLoc + pOffset
end if
end
--check to see if there is a match
on checkLock me
-- determine match member's name
memName = sprite(me.spriteNum).member.name
memNum = memName.word[2]
matchName = "left"&&memNum
-- check all the sprites
repeat with i = 1 to the lastChannel
-- is it the matching sprite?
if sprite(i).member.name = matchName then
-- is it close enough to lock in place?
if closeEnough(me, sprite(i).loc,sprite(me.spriteNum).loc) then
-- place sprite in exact location
sprite(me.spriteNum).loc = sprite(i).loc
-- set lock
pLocked = TRUE
-- change colors
sprite(me.spriteNum).bgColor = rgb("#CCCCCC")
sprite(i).bgColor = rgb("#CCCCCC")
-- see if all are locked in place
checkForDone(me)
-- leave this hander
exit
end if
end if
end repeat
-- never found a matching member close enough
-- return to original position
sprite(me.spriteNum).loc = pOrigLoc
end
-- determine if two locations are close
on closeEnough me, loc1, loc2
maxdistance = 10 -- use 10 pixels as max distance
if abs(loc1.locH - loc2.locH) < maxdistance then
if abs(loc1.locV - loc2.locV) < maxdistance then
-- close enough, return TRUE
return TRUE
end if
end if
return FALSE
end
-- simply report on condition of pLocked
on amIDone me
return pLocked
end
-- Check all sprites to see if all are locked
on checkForDone me
repeat with i = 1 to the lastChannel
-- ask a sprite if it is done
done = sendSprite(sprite i,#amIDone)
-- sprite did not know about #amIDone
if voidP(done) then next repeat
-- sprite returned that it was not locked
if done = FALSE then exit
end repeat
-- if they got here, then all are done
-- go to another frame
go to frame "payoff"
end

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas