void Player::Walk(Game_Manager * gm_) { if (walkcount > 0) { walkcount--; UnitMove(gm_, GetSpeed(goangle), goangle); } }
bool UnitCaC::Attack() { if(target != NULL){ if(target->IsDead()){ target = NULL; return false; } float distance = (Vector2D(x,y) - Vector2D(target->getX(),target->getY())).Length(); if(distance <= range){ attaqueEnCours=true; } if(attaqueEnCours) { Vector2D toFace = (target->GetPosition() - GetPosition()).Normalized(); facing = toFace; if(attackTimer < attackCD){ attackTimer++; return true; } else { target->CalculateDamage(damage); attackTimer = 0; attaqueEnCours=false; return true; } } else{ delete destination; destination = new Vector2D(target->getX(),target->getY()); UnitMove(); return false; } } return false; }