A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: hit test nig13

  1. #1
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404

    hit test nig13

    Alright so I tried the hit test and to organize all my folders abit to see what im doing wrong I still cant find it so try to see whats wrong heres the .fla.

    also the character stuff is located in the isometric-textures-items folder and in that folder theres a folder called iso package with the main character moveiclip. Thanks in advance.

    files to big add an attachment and I dont want to make everything red so here:

    (deleted)
    Last edited by AS3.0; 01-28-2012 at 12:25 PM.

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    a topic with my name in it? COOL

    dude, easy fix, you just forgot that your character movieclip is nested inside two other movieclips

    New code:

    Actionscript Code:
    on(release){
        if(_root.game.clip.char.hitTest(this)){
            this.gotoAndStop(2);
           
        }
       
    }

    Hope this helps

    btw, that game looks SWEET, can't wait to play it when you're done
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    wow man completely forgot about that. thanks

  4. #4
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    for the hit test to my attached trees im trying:
    on(release){
    if(_root.clip.tile.tree.hitTest(this)){
    this.gotoAndStop(2);

    }

    }

    do you know whats wrong there?

  5. #5
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Now I'm becoming a bit skeptic over the fact that you actually wrote the code yourself or not õ.Ô?

    Each tile has gotten its own unique instance name, t_0_0, t_0_1, t_0_2, etc. and only some, marked as 1 in your map array, will go to and stop on Frame 2, where the tree is, so in this case, you have to use a for loop to check for every single tile, which is on Frame 2 (meaning that there's a tree on that tile), and use hitTest on that tree, for instance:

    Actionscript Code:
    on(release){
        for(i=0;i<7;i++){
            for(a=0;a<7;a++){
                var name1 = "t_"+i+"_"+a;
                if (_root.game[name1].walkable) {
                    var clip1 = _root.game.clip.back;
                } else {
                    var clip1 = _root.game.clip;
                }
                if(clip1[name1]._currentframe == 2){
                    if(clip1[name1].tree.hitTest(this)){
                        gotoAndStop(2);
                    }
                }
            }
        }
    }

    This is based on one of the codes from your Full Code, because the not walkable tiles are stored one step behind the other tiles in terms of movieclip nesting, which are the ones containing the trees. Checking if the trees in only those tiles are hitting the desired target, will give you a positive response

    Hope this helps
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  6. #6
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    no its the isometric code from tonypa remember i mixed it with mine, and thanks!
    some parts of this look complicated though heh still need more learning
    Last edited by AS3.0; 01-28-2012 at 08:02 PM.

  7. #7
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    oh, I knew I had seen similar isometric coding somewhere before :P

    but you managed to manipulate it and implement it into your own game, props for that
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  8. #8
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    eh, thanks but more props to you for being my age yet having more knowledge in flash :P your a good help on this site and every time I need help you got the solutions. double props for that.

  9. #9
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    haha, no problem, I just had an earlier start than you, that's all
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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