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
Blend Images
Domicilia
AnyShape Xtra
Director 8 Demystified
ZGTSB-TextInteractivity
myDialog
Flip Image Algorithm - Imaging Lingo
Slider-Alphamania
Generic behavior to change System Cursors
Replace embedded fonts in text/field and button members
 

 

 

Behavior 27 Sum Game-Numbers

Added on 5/1/2000

 

Compatibilities:
behavior D7 D8 Mac PC

Rating:

Author: DejanCicic

Three behaviors from game "27 Sum" library. 27 Sum Game is the game where you need to put odd numbers from 1 to 17 in 3x3 game fields and get sum of 27 in each row, column and diagonal. See a working example and source code in the learning arcade. The full game requires all 3 behaviors.Numbers, Fields, and Score Field.

property TargetSprite1 --First target sprite for the dragged sprite
property TargetSprite2 --Last target sprite for the dragged sprite
property startPos -- starting poition of the dragged sprite

property Mymember
on beginSprite me
  myMember=the member of sprite (the spritenum of me)
end

on mousedown me
  -- get start point of dragged sprite
  set startpos = the loc of sprite (the spritenum of me)
  
  -- move the sprite with the mouse
  repeat while the stilldown = true
    set the loc of sprite (the spritenum of me) = point(the mouseh, the mousev)
    updatestage
  end repeat
end

on mouseup me  
-- check to see if the MOUSE is inside the target sprite
  -- when released
  repeat with i=targetsprite1 to targetsprite2
    if inside(point(the mouseh, the mousev), the rect of sprite (i)) then
      sendValue me,i
      -- send the dragged sprite off screen
      set the loc of sprite the spritenum of me = point(1000,1000)
      exit repeat
      --end if
      
-- sets the dragged sprite back to starting position
    else
      set the loc of sprite (the spritenum of me) = startpos
      --exit repeat
    end if
  end repeat
end


on SendValue me, i
  myText=the name of member myMember
  myvalue=char 2 to (length(myText)) of myText
  sendSprite(i,#updateValue,myValue)
end






on getBehaviorDescription
  return "Creates sprites that can be dropped on any other [user specified] sprite. "
end

on getPropertyDescriptionList
  if voidp(TargetSprite1) then set TargetSprite1 = 1
  if voidp(TargetSprite2) then set TargetSprite2 = 1
  set p_list = [#TargetSprite1: [ #default:1,#format:#integer, #comment:"First Target Sprite Number", #range:[#min:1,#Max:120]], #TargetSprite2: [ #default:2,#format:#integer, #comment:"Second Target Sprite Number", #range:[#min:1,#Max:120]]]
  return p_list
end

 


Contact

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

Send e-mail