A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Clicking a movieclip - tilebased

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    Clicking a movieclip - tilebased

    Hey everyone

    Well I have entered the world of Tilebased games, Ive finally decided to learn it as it appears that everything is revolved around it. I took the time to read Tonypa's site about tile based system and done a few tutorials reverse engineering everything

    I know how everything works now ... for the most part

    Now my question (yes ... Im going to sound like an idiot asking this)




    Ok, Ive attached an .fla, when you run it, it basically randomizes 4 different coloured blocks, tile based of course in a grid. All I want to do for now is to trace the 2D array when you click one of the tiles so I know which block is clicked

    Thats all ...


    Haha , thanks everyone
    Last edited by Osteel; 05-01-2009 at 02:39 AM.

  2. #2
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    not sure if this is what you meant...
    Attached Files Attached Files

  3. #3
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha , I hate to break it to you, but I think you just resent my file back, because it doesnt do anything

    Thanks though haha

  4. #4
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    ...And worse still, I'd deleted it.
    Hang on I'll try again.

  5. #5
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    here it is
    Attached Files Attached Files

  6. #6
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha hey thanks, thats what I wanted, except I dont know if it worked or not...

    You put myX and myY, those are variables im guessing. You also made a function called clicked which has two parameters passed in which are the x and y values.

    The function is called in the other function build and passes in the x and y of the variable temp , which should be the tile you clicked ...

    But for some reason no matter where you click, the trace returns the value of
    "x : 11 , y : 10"


    Thanks for helping

  7. #7
    (...)
    Join Date
    Nov 2005
    Location
    Switzerland
    Posts
    102
    I just added my getTile function, it should work completly..
    It doesn't check every frame for the click, that's safing performance..

    Edit: didn't saw the other posts, sorry..
    Attached Files Attached Files
    Last edited by davenaegeli; 11-11-2005 at 12:30 PM.

  8. #8
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    yes, you caught me out I didn't check it.

    replace the onRelease with this...
    Code:
    temp.onRelease = function() {
    clicked(this.myX ,this.myY )
    }

  9. #9
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha why thank you both kindly I appreciate the help. Yup it works fine, now to continue on

    Thanks again

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center