public Bullet(TankBase firer, Vector2 firedFrom, Bearing b, float bulletv) { position = new Vector2(firedFrom.X, firedFrom.Y); bearing = b; parentTank = firer; exploding = false; if (bearing == Bearing.NORTH) this.velocity = new Vector2(0, -bulletv); else if (bearing == Bearing.SOUTH) this.velocity = new Vector2(0, bulletv); else if (bearing == Bearing.EAST) this.velocity = new Vector2(bulletv,0); else if (bearing == Bearing.WEST) this.velocity = new Vector2(-bulletv,0); }
public void addTank(TankBase newTank) { newTank.set_texture(tanktexture); controlledTanks.Add(newTank); }
// GET any tank that collides with the given rectangle AND is not == self public bool tankCollisionWithTank(Rectangle collisionMask, TankBase self) { foreach (TankBase other in controlledTanks) { if (self == other) continue; if (other.spawnState != SpawnState.SPAWNED) continue; Rectangle otherMask = other.getCollisionMask(); if (collisionMask.Intersects(otherMask)) return true; } return false; }