Going to another frame after all items are in place


hello all!

 

i'm making simple drag'n'drop games , using code make work:

 

 

package  {     import flash.display.sprite;     import flash.events.mouseevent;      public class main extends sprite     {         var xpos:int;         var ypos:int;          public function main():void         {             addlisteners(s1, s2, s3, i1, i2, i3, n1, n2, n3, p1, p2, p3, b1, b2, b3, f1, f2, f3);         }          private function getposition(target:object):void         {             xpos = target.x;             ypos = target.y;         }          private function dragobject(e:mouseevent):void         {             getposition(e.target);              e.target.startdrag(true);         }          private function stopdragobject(e:mouseevent):void         {             if (e.target.hittestobject(getchildbyname(e.target.name + "target")))             {                 e.target.x = getchildbyname(e.target.name + "target").x;                 e.target.y = getchildbyname(e.target.name + "target").y;             }             else             {                 e.target.x = xpos;                 e.target.y = ypos;             }              e.target.stopdrag();         }          private function addlisteners(... objects):void         {             (var i:int = 0; < objects.length; i++)             {                 objects[i].addeventlistener(mouseevent.mouse_down, dragobject);                 objects[i].addeventlistener(mouseevent.mouse_up, stopdragobject);             }         }     } }    

 

s1, s2, s3, i1, i2, i3, n1, n2, n3, p1, p2, p3, b1, b2, b3, f1, f2, f3 objects need placed correctly win. when placed correctly, do make game recognize player did right? i'd game able take frame "win" graphic can seen.

 

any suggestions?

you need think of way of checking how many objects planted. 

 

you keeping count if make game such once object planted cannot replanted.  in conditional places object match target location increment count.  when count reaches total, that's when it's time move on.

 

another approach assign property each object indicate whether planted or not.  when object gets planted properly, set status true.  loop thru of objects , see if true.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account