CS3 key and chest
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: key and chest

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    8

    key and chest

    I'm using CS4 and I am having trouble setting an event,
    I want the chest to open up only if the key is in the inventory after being picked up, but the chest opens any time even with out the key and I need to know how to fix this.
    I will replace the graphics later.


    http://www.kacieartist.freeiz.com/invenkey.zip

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    895
    Hi,

    If you select the keybronze movieclip and look at the code placed on it, you missed an = sign

    it should be
    PHP Code:
    if (this.hitTest(_root.hero.hit_area) && touched == false
    and not
    PHP Code:
    if (this.hitTest(_root.hero.hit_area) and touched false

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    8
    Thanks for the help but the chest still opens without the key.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    895
    Hi,

    As before you have missed an = sign on another clip code.

    on the chest clip, use
    PHP Code:
    if (_root.hero.hitTest(this) && (Key.isDown(Key.SPACE)) && (_global.slot_spot2 == "keybronze")) 
    instead of
    PHP Code:
    if (_root.hero.hitTest(this) && (Key.isDown(Key.SPACE)) && (_global.slot_spot2 "keybronze")) 

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    8
    I just worked it out I used the wrong _global thanks for your help though toward this thanks.

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

Poll by Flashkit.com