A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: items

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    10

    items

    i have looked on flash kit and found a tutorial on making an inventory system. that was a great help for me and making my game, however, i want to know how i use the items i pick up for a later use, for example i pick up a key and use it to unlock a door.
    can some one help me out with either there own knowledge or by linking a tutorial?
    --thanks

  2. #2
    Now tell me whos watchin...... samvillian's Avatar
    Join Date
    Feb 2007
    Location
    Where do you live?
    Posts
    539
    Which one is your question, how to go back to a recently picked up item, or using that item you picked up? Just go "if he pushes on the door AND he has the key, then open sesame" you can do that AND part one of two ways:

    if(blah && blahblah){
    }

    or
    if(blah){
    if(blahblah){
    }
    }
    If the only tool you have is a hammer, you tend to see every problem as a nail.

    Xbox 360 Modding Controller PS3 Mod Paint Spray LED Case

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Posts
    10
    i think you are stalking me haha, jk. i figured out the hit test problem i had btw.
    umm it would be on how to use it

  4. #4
    Junior Member
    Join Date
    Aug 2008
    Posts
    10
    i think you are stalking me haha, jk. i figured out the hit test problem i had btw.
    umm it would be on how to use it
    and by your example:

    if(blah && blahblah){
    }

    how would i do that for a a key actually opening a door?

    if (key && door) {
    waht goes here?
    }
    or is that totally wrong?

  5. #5
    Now tell me whos watchin...... samvillian's Avatar
    Join Date
    Feb 2007
    Location
    Where do you live?
    Posts
    539
    if (key && door) {
    waht goes here?
    }

    well sorry i wasnt specific enough and i think i am stalking you. didnt even notice it was you lol.

    k,

    if(item == "key" && doorClicked == true){
    // code goes here to make him go to next level.
    // if your next level is next frame then do a gotoAndStop("level2");
    }

    this assumes that the item variable is the current item he has and the name of thet key item is key. so if he was holding an orange (how useful is that) than it would be item == "orange".
    also you should add an else statement to it so you can say that YOU NEED THE KEY TO OPEN THE DOOR, JERK. like if he isnt holding a key and he tried to open the door, you would slap him in the head to tell him to find a key.

    that would be like so:

    if(item == "key" && doorClicked == true){
    // code goes here to make him go to next level.
    // if your next level is next frame then do a gotoAndStop("level2");
    }else{
    // somehow punish him for clicking on door without key
    trace("He clicked on the door without a key");
    }


    hope this helps.
    If the only tool you have is a hammer, you tend to see every problem as a nail.

    Xbox 360 Modding Controller PS3 Mod Paint Spray LED Case

  6. #6
    Junior Member
    Join Date
    Aug 2008
    Posts
    10
    yeah it does, and dude i looked on your profile we are the exact same age, born on the exact same day.

  7. #7
    Now tell me whos watchin...... samvillian's Avatar
    Join Date
    Feb 2007
    Location
    Where do you live?
    Posts
    539
    lol that is crazy.. is your name sam?
    If the only tool you have is a hammer, you tend to see every problem as a nail.

    Xbox 360 Modding Controller PS3 Mod Paint Spray LED Case

  8. #8
    Junior Member
    Join Date
    Aug 2008
    Posts
    10
    haha no its paul

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