Arrow Shooting / Sticking

190
191
2
3

Move the Mouse to aim, Left Click to shoot Arrows. Arrows should stick in whatever they hit.


Hold Right Click or Tap anywhere to move the Player around (WSAD, Arrow Keys, and/or Spacebar work as well). If a yellow Character sees the player, it will start to follow and move around and jump to get to the Player.


This is just a little demo of some super simplified "pathfinding"---it doesn't use any optimization methods (such as A*); instead the Player lays the path (mapped by the Waypoints). This version has extra checks in the Waypoints to make sure they account for jump height. Note that this method can considerably affect game performance when used on a large scale.


The Characters have a 120 degree field of view, and once the Player passes through it, the Characters will start to follow the Player.


The code here may not be the easiest to understand, though I've tried to make it as simplified as possible. There are a few bugs still, for instance occasionally a Character will see the Player through a wall and will get stuck. I'm still working on finding the cause, so let me know if you have an idea on why that happens. Also, sometimes you get a super jump, and that along with jumping off of a Character's head can sometimes disrupt the Waypoint logic. (So this isn't perfect, but for the most part it works.)

Editor