Stick

Hi see this game
http://www.tallhat.com/matches/

Now what they have used to check the ans is they had store the x(say x=200)and y(say y= 300) value of solutions to a variable and whenever it matches you win , the problem is that if you drag all these stick to some other places(then x and y values changes), and then chk you wont be havng right ans , now i want to have other logic to do this … any help

HI guys , i got stuck with the ans checking logic to this type of game…help me …

HI
i am having 88 grid and i am having a move clip, whenevr you release that movie clip it should attached itself to its nearby Grid(88)…any help

try

var g_gridSpacing:Number = 40;
_mc.onRelease = _mc.onReleaseOutside=function () {
 this.stopDrag();
 // Stop Dragging
 X = this._x;
 // Reference X Pos
 Y = this._y;
 // Reference Y Pos
 if (X<320 && Y<320) {
  this._x = Math.round(X/g_gridSpacing)*g_gridSpacing;
  // Round to nearest GridSpace 
  this._y = Math.round(Y/g_gridSpacing)*g_gridSpacing;
  // Round to nearest GridSpace 
 }
};

Thanks but i want something like this …see the fla…

[quote=neilmmm;2334908]try

var g_gridSpacing:Number = 40;
_mc.onRelease = _mc.onReleaseOutside=function () {
 this.stopDrag();
 // Stop Dragging
 X = this._x;
 // Reference X Pos
 Y = this._y;
 // Reference Y Pos
 if (X<320 && Y<320) {
  this._x = Math.round(X/g_gridSpacing)*g_gridSpacing;
  // Round to nearest GridSpace 
  this._y = Math.round(Y/g_gridSpacing)*g_gridSpacing;
  // Round to nearest GridSpace 
 }
};

[/quote]

you need to use hitTest

draw a copy of your grid

make each mtach stick position an mc and put a reference to each stick position in an array

then alpha copy grid to 0

when moving a matchstick, on release just do a hitTest to array of alpha out matchsticks in a for loop

the sticks do not have to snap to _x and _y but if you want them to they can match the _x and _y of the match with alpha O

this will also easily give you a match to see if the game is finished

hope this helps

[quote=neilmmm;2335609]you need to use hitTest

draw a copy of your grid

make each mtach stick position an mc and put a reference to each stick position in an array

then alpha copy grid to 0

when moving a matchstick, on release just do a hitTest to array of alpha out matchsticks in a for loop

the sticks do not have to snap to _x and _y but if you want them to they can match the _x and _y of the match with alpha O

this will also easily give you a match to see if the game is finished

hope this helps[/quote]

well if you can post a fla then i can have some idea…right now i am not able to make it