Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Yes/No Alert
Kaboom!
Sony UK: a New Director Case Study by INM
QuickTime VR 2
Checking for an internet connection
KK
Frogger by J.R.D.R.
Get the computer name of user
DirectMedia Xtra 2
Billenium Transitions Xtra
 

 

 

Behavior DragNDrop Behaviour

Added on 1/21/2003

 

Compatibilities:
behavior D7 D8

This item has not yet been rated

Author: joy_cl

This is simple behaviour for drag n drop activity.

Download PC Source
--//script for Drag N Drop by Joy Chalissery //--
property Ncheck
property pcheck
property pspriteloc
property pspriteOfAnswer
property pspriteOfAnswer2
property pspriteOfAnswer3
property pspriteOfAnswer4
property pspriteOfAnswer5
property pspriteToIntersect
property pspriteToIntersect2
property pspriteToIntersect3
property pspriteToIntersect4
property pspriteToIntersect5


on beginsprite me
  pspriteloc = sprite(me.SpriteNum).loc  
end


on mouseEnter me
  cursor 280
  updateStage
end
on mouseLeave me
  cursor 0
  updateStage
end

on mouseDown me
  sprite(me.spriteNum).moveablesprite = TRUE
  pspriteloc = sprite(me.SpriteNum).loc
  updateStage
end


on mouseUp me
  NcheckOne  
  updateStage
end



---------------------------------------------------------------------------------------------------------


on getPropertyDescriptionList
  description = [:]
  addProp description,#pspriteToIntersect, [#default:0, #format:#integer, #comment: "Enter sprite number to intersect"]
  addProp description,#pspriteOfAnswer, [#default:0, #format:#integer, #comment: "Enter sprite number of answer sprite"]
  addProp description,#pcheck, [#default:1, #format:#integer, #comment:"Enter 'Zero' for wrong answer"]
  --  addProp description,#Ncheck, [#default:1, #format:#integer, #comment:"Enter Number of repeatation of Answer"]
  
  whenDefault = "at the beginning of the frame "
  whenRange = ["at the beginning of the frame ",
                 "at the end of the frame"]
  whenDefault = "1"
  whenRange = ["1",
                 "2",
                 "3",
                 "4",
                 "5"]
  description[#Ncheck] = [
     #comment: "How many times:",
     #format: #integer,
     #default: whenDefault,
     #range: whenRange]
  
  addProp description,#pspriteToIntersect2, [#default:0, #format:#integer,
#comment: "Enter 2nd sprite number to intersect"]
  addProp description,#pspriteOfAnswer2, [#default:0, #format:#integer,
#comment: "Enter sprite number of 2nd answer sprite"]
  
  addProp description,#pspriteToIntersect3, [#default:0, #format:#integer,
#comment: "Enter 3rd sprite number to intersect"]
  addProp description,#pspriteOfAnswer3, [#default:0, #format:#integer,
#comment: "Enter sprite number of 3rd answer sprite"]
  
  addProp description,#pspriteToIntersect4, [#default:0, #format:#integer,
#comment: "Enter 4th sprite number to intersect"]
  addProp description,#pspriteOfAnswer4, [#default:0, #format:#integer,
#comment: "Enter sprite number of 4th answer sprite"]
  
  addProp description,#pspriteToIntersect5, [#default:0, #format:#integer,
  #comment: "Enter 5th sprite number to intersect"]
  addProp description,#pspriteOfAnswer5, [#default:0, #format:#integer,
  #comment: "Enter sprite number of 5th answer sprite"]
  
  return description
end getPropertyDescriptionList



on getBehaviorTooltip (me)
  return
    "Script for Drag N drop Activity."
end getBehaviorTooltip
--  "You have to coppy two script cast members named Outloc and Drag N drop. Attach the Outloc behaviour into the answer sprite, it helps the sprite to initialise " & RETURN &  
on getBehaviorDescription (me)
  return
    "Drag N Drop" & RETURN & RETURN &
  "Drop this behavior onto a sprite, the Stage, or the Script channel of the Score to pause a sound based on the movement of the playback head or cursor." & RETURN & RETURN &
    "DEVELOPED: " & RETURN &
    "** Script for Drag N Drop by Joy Chalissery **"& RETURN &
   "** Bangalore **" & RETURN &
    "**For further details pls.free to contact joy_cl@hotmail.com**"  
end getBehaviorDescription

---------------------------------------------------------------------
on NcheckOne me
  outCheck = Ncheck
  if sprite(the currentspriteNum).intersects(pspriteToIntersect)then
    if sprite(pspriteOfAnswer).loc <> sprite(pspriteOfAnswer).pspriteloc then
      sprite(pspriteOfAnswer).loc = sprite(pspriteOfAnswer).pspriteloc
      --      sprite(pspriteToIntersect).loc = point(-900,-900)
      cursor 0
      if  Ncheck = 1 then--pcheck = 1 and
        sprite(the currentspriteNum).loc = point(-900,-900)
        sprite(pspriteToIntersect).loc = point(-900,-900)
      else if pcheck = 1 and Ncheck > 1 then
        sprite(the currentspriteNum).loc = pspriteloc
        if Ncheck <> 1 then Ncheck = Ncheck - 1
      end if      
    else  if sprite(pspriteOfAnswer).loc = sprite(pspriteOfAnswer).pspriteloc then
      sprite(the currentspriteNum).loc = pspriteloc
      updateStage
    end if
  else if sprite(the currentspriteNum).intersects(pspriteToIntersect2)then
    if sprite(pspriteOfAnswer2).loc <> sprite(pspriteOfAnswer2).pspriteloc then
      sprite(pspriteOfAnswer2).loc = sprite(pspriteOfAnswer2).pspriteloc
      --      sprite(pspriteToIntersect).loc = point(-900,-900)
      cursor 0
      if pcheck = 1 and Ncheck = 1 then
        sprite(pspriteToIntersect2).loc = point(-900,-900)
        sprite(the currentspriteNum).loc = point(-900,-900)
      else if pcheck = 1 and Ncheck > 1 then
        sprite(the currentspriteNum).loc = pspriteloc
        if Ncheck <> 1 then Ncheck = Ncheck - 1
      end if
    else  if sprite(pspriteOfAnswer2).loc = sprite(pspriteOfAnswer2).pspriteloc then
      sprite(the currentspriteNum).loc = pspriteloc
      updateStage
    end if
    
  else if sprite(the currentspriteNum).intersects(pspriteToIntersect3)then
    if sprite(pspriteOfAnswer3).loc <> sprite(pspriteOfAnswer3).pspriteloc then
      sprite(pspriteOfAnswer3).loc = sprite(pspriteOfAnswer3).pspriteloc
      cursor 0
      if pcheck = 1 and Ncheck = 1 then
        sprite(the currentspriteNum).loc = point(-900,-900)
      else if pcheck = 1 and Ncheck > 1 then
        sprite(the currentspriteNum).loc = pspriteloc
        if Ncheck <> 1 then Ncheck = Ncheck - 1
      end if
    else  if sprite(pspriteOfAnswer3).loc = sprite(pspriteOfAnswer3).pspriteloc then
      sprite(the currentspriteNum).loc = pspriteloc
      updateStage
    end if
    
  else if sprite(the currentspriteNum).intersects(pspriteToIntersect4)then
    if sprite(pspriteOfAnswer4).loc <> sprite(pspriteOfAnswer4).pspriteloc then
      sprite(pspriteOfAnswer4).loc = sprite(pspriteOfAnswer4).pspriteloc
      cursor 0
      if pcheck = 1 and Ncheck = 1 then
        sprite(the currentspriteNum).loc = point(-900,-900)
      else if pcheck = 1 and Ncheck > 1 then
        sprite(the currentspriteNum).loc = pspriteloc
        if Ncheck <> 1 then Ncheck = Ncheck - 1
      end if
    else  if sprite(pspriteOfAnswer4).loc = sprite(pspriteOfAnswer4).pspriteloc then
      sprite(the currentspriteNum).loc = pspriteloc
      updateStage
    end if
    
  else if sprite(the currentspriteNum).intersects(pspriteToIntersect5)then
    if sprite(pspriteOfAnswer5).loc <> sprite(pspriteOfAnswer5).pspriteloc then
      sprite(pspriteOfAnswer5).loc = sprite(pspriteOfAnswer5).pspriteloc
      cursor 0
      if pcheck = 1 and Ncheck = 1 then
        sprite(the currentspriteNum).loc = point(-900,-900)
      else if pcheck = 1 and Ncheck > 1 then
        sprite(the currentspriteNum).loc = pspriteloc
        if Ncheck <> 1 then Ncheck = Ncheck - 1
      end if
    else  if sprite(pspriteOfAnswer5).loc = sprite(pspriteOfAnswer5).pspriteloc then
      sprite(the currentspriteNum).loc = pspriteloc
      updateStage
    end if
    
  else
    sprite(the currentspriteNum).loc = pspriteloc
    updateStage
  end if
end NcheckOne  

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail