Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

matchstick puzzle in ActionScript

New Here ,
Nov 24, 2017 Nov 24, 2017

I want to create a matchstick puzzle. But I'm struggling with it.

the puzzle is like this

التقاطه.PNG

the player will have to move only 6 matches to get 3 squares

their are two solution for this

first one:

1التقاطه.PNG

second:

2التقاطه.PNG

i actually do not know how to accomplish this. If anyone here can provide me any help i'll be thankful.

thank you in advance.

TOPICS
ActionScript
342
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 24, 2017 Nov 24, 2017

create a matchstick movieclip.

arrange your movieclips to form the initial layout and assign instance names to your matchstick movieclips.  add click event listeners to each one and on click move the clicked matchstick to a 'removal' pile.  (clicking on a removed matchstick should return it to its original position.)

you can decide how to end game.  eg, after 6 clicks, when the used clicks has a discard pile that contains one of the two groups etc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2017 Nov 25, 2017

i did that. i created the movie clips and added the instance name and added the event listener. and what you said is exactly what i want to do but i struggled with the coding. So if you have any idea of how to achieve this in action script i'll be thankful.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2017 Nov 25, 2017

how to achieve which suggestion?  i made two.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2017 Nov 25, 2017

the removal pile one

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2017 Nov 25, 2017
LATEST

var discardP:MovieClip=new MovieClip();

addChild(discardP);

discardP.x=?

discardP.y=?

var matchNum:int = 16;

for (var i:int=0;i<matchNum;i++){

this['match_'+i].addEventListener(MouseEvent.click,matchClickF):

}

function matchClickF(e:MouseEvent):void{

if(e.currentTarget.parent==discardP){

this.addChild(e.currentTarget);

} else{

discardP.addChild(e.currentTarget);

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines