# Recent posts by pl0xz0rz on Kongregate

 You’re doing a dicrete collision check. Try using a raycast from last known good coordinates to current ones, and then it should work. It takes some math, but nothing difficult. EDIT; Or just icrease the height of the hitboxes I’m making a TD game in HTML5. For some reason, however, it bogs down when placing towers on the creeps path. From what I see on the profiler, the A* isn’t the problem. The problem is creating the navmesh. So far it’s a simple grid, with gcost computed by looking up the collision detection quadtree. The path also feels blocky. (I am also about to remove the quadtree and use prune and sweep with kd-trees). What I want to do is: 1. Create a vertex array of the graph by pushing vertices of the staticCollisionObject array (without redundant vertices). 2. Do rays between them. Bruteforcing, it’s O(n^3), extremely slow. However, I think there is some way of doig it in O(n^2) without cheating using some kind of tree structures Better, but still probably slow. (also pruning for head-on edges) 3. Perform A* for the resulting graph consisting of the vertex array and the edges. However, I feel that the step 2 will be too slow, so I will probably do some cheating. The question is, what kind of chating? Topic: Game Programming / AS2 Turret This is the code for rotating the cannon and firing a bullet ``` //This attempts to shoot at the point by normalizing the vector and firing a bullet function shoot(x,y){ if (this.reload > .99){ this.reload -= 1; x -= this.x; y -= this.y; var temp = 1 / Math.sqrt((x*x+y*y)/(this.cannon.x*this.cannon.x + this.cannon.y * this.cannon.y)); this.cannon.x = temp*x; this.cannon.y = temp*y; var l = new blackOrb(this.cannon.x + this.x,this.cannon.y + this.y,this.ammo.r,this.cannon.x*this.power,this.cannon.y*this.power,this.ammo.m); stuff.push(l); bullets.push(l); } } ``` But you also need this. ```//This happens to each tower on each frame, this is a naive method, there are better methods with better performance //but for a TD game where there aren't many creeps, this is close enough. function aim(id){ var bestTarget = null; var bestTargetValue = 0; switch (towerPatterns[towers[id].pattern].lineOfSightType){ //Selects the enemy to attack case 0: for (var i=0;i