1 Reply Latest reply on Jan 12, 2009 7:40 AM by clbeech

    collision detection minigame glitch

    shintashi Level 1
      I've attached the relevant code below.

      for a basic top down RPG, I made a small attacking avatar (a smiley) with interchangeable weapons. In unarmed mode, the avatar can attack via spacebar and collision detection. Everything works until unarmed attacks are used on the black slimes (as opposed to red or green). The black slimes represent "acid" so It seemed appropriate that touching them unarmed would do damage to the avatar hp pool. Instead of doing 2-3 damage per frame like others, the character faces sudden death, and I have no idea why.

      below are the basic combat codes for black blobs/slimes and a sample of red blobs for comparison.

        • 1. Re: collision detection minigame glitch
          clbeech Level 3
          hey shin - the problem here is that you're running within the loop - so that when the character comes in contact with the acid, it 'repeatedly' performs the test and finds it to be true, almost instantly until death. what you need to do here is, once the hitTest is true for the acid, 'move' the character outside the bounds of the acid instance, so that the 'second' test isn't true and is damage is only accrued 'once' ( unless the player is stupid enough to continue walking into it ... LOL!!!!!!! :D )