Note that there are some explanatory texts on larger screens.

plurals
  1. POFlash Professional CC Actionscript 3.0 HitTestpoint
    text
    copied!<p>I have been busy for the past week making a game, and I've run into a problem. What I am trying to make is a maze type game where you have to find your way out. There's going to be a dynamic light system added to this, but later. Right now, I am having an issue with the collision of my player and walls. Here is the coding:</p> <pre><code>if(back.hitTestPoint(plr.x + leftBumpPoint.x, plr.y + leftBumpPoint.y, true)){ leftBumping = true; } else { leftBumping = false; } if(back.hitTestPoint(plr.x + rightBumpPoint.x, plr.y + rightBumpPoint.y, true)){ rightBumping = true; } else { rightBumping = false; } if(back.hitTestPoint(plr.x + upBumpPoint.x, plr.y + upBumpPoint.y, true)){ upBumping = true; } else { upBumping = false; } if(back.hitTestPoint(plr.x + downBumpPoint.x, plr.y + downBumpPoint.y, true)){ downBumping = true; } else { downBumping = false; } if(leftBumping){ if(xSpeed &lt; 0){ xSpeed *= -0.5; } } if(rightBumping){ if(xSpeed &gt; 0){ xSpeed *= -0.5; } } if(upBumping){ if(ySpeed &lt; 0){ ySpeed *= -0.5; } } if(downBumping){ if(ySpeed &gt; 0){ ySpeed *= -0.5; } } if(Math.abs(xSpeed) &lt; 0.5){ xSpeed = 0; } if(xSpeed &gt; maxSpeedConstant){ xSpeed = maxSpeedConstant; } else if(xSpeed &lt; (maxSpeedConstant * -1)){ xSpeed = (maxSpeedConstant * -1); } </code></pre> <p>So, the issue I am having is that when my player collides with the walls, He doesn't stop. Instead, he just slows down to an extremely slow speed. I want the player to stop completely. Can anyone help me with this? PS. "back" is the instance name for the walls and "plr" is for the player.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload