Results 1 to 6 of 6

Thread: stick

  1. #1

    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 ....
    Last edited by rahul_7star; May 31st, 2008 at 12:40 PM.

  2. #2
    HI
    i am having 8*8 grid and i am having a move clip, whenevr you release that movie clip it should attached itself to its nearby Grid(8*8)......any help

  3. #3
    try

    Code:
    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 
     }
    };
    Attached Files Attached Files

  4. #4
    Thanks but i want something like this ....see the fla..


    Quote Originally Posted by neilmmm View Post
    try

    Code:
    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 
     }
    };
    Attached Files Attached Files

  5. #5
    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

  6. #6
    Quote Originally Posted by neilmmm View Post
    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

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012