A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: health

  1. #1
    Member
    Join Date
    Apr 2003
    Posts
    42

    health

    I need help with this. The grey box's 'health' should only minus 1 'point' off the health when it collides with the red box. But instead, the health went all down.

    I need the 'health' to just stop minusing 1 health point and stop.
    Attached Files Attached Files
    stuff

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Use this:
    Code:
        if (this.hitTest(_root.enemy)) {
            if (hitting<>1) {
                hitting = 1;
                _root.health -= 1;
            }
        } else {
            hitting = 0;
        }
    It will only take 1 health. Move away from enemy and hit him again to reduce 1 point again.

  3. #3
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    ooh, what does that operator do <> ?

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    <> is same as not equal.
    Flash4 habbit of mine, not to worry, it still works

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