Advertisement Jump to content
  • Advertisement

Scourge80

Member
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

102 Neutral

About Scourge80

  • Rank
    Newbie
  1. I was working on a basic algorithm for detecting collision between a creep and game entities (enemy towers, enemy walls, etc.). Now, this works perfect when tested offline, but when I uploaded it to my site, it seems to have issues; creeps continue to move even while colliding. This is a simple Tower Defense-type game. Collision update: function CpuUpdate() { //Update creeps for(var j = 0; j < CpuCreeps.length; j++) { //Check if we collide with an enemy tower if(CollidesWithTarget(CpuCreeps[j], P1Towers)) { //Move toward the target CpuCreeps[j].MoveToTarget(CpuCreeps[j].Target); //Attack the target if we are in melee range if(CpuCreeps[j].CollidesWith(CpuCreeps[j].Target)) CpuCreeps[j].Attack(CpuCreeps[j].Target); } //Check if we collide with a wall else if(CollidesWithTarget(CpuCreeps[j], P1Walls)) { //Move toward the target CpuCreeps[j].MoveToTarget(CpuCreeps[j].Target); //Attack the target if we are in melee range if(CpuCreeps[j].CollidesWith(CpuCreeps[j].Target)) CpuCreeps[j].Attack(CpuCreeps[j].Target); } //Move Creeps if we aren't colliding with enemies else { CpuCreeps[j].X--; } } }   CollidesWithTarget(creep, targetGroup) method: function CollidesWithTarget(creep, targetGroup) { for(var k = 0; k < targetGroup.length; k++) { if(creep.CollidesWith(targetGroup[k].View)) { //Set our target creep.Target = targetGroup[k]; //Return true and stop checking for other towers return true; break; } } return false; }   ? ?  To see the error:  http://dikaioti.byethost7.com/TowerDefense/   thank you for any feedback (By the way, new to GameDev, if I made a mistake concerning rules, let me know so I can fix it)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!