void Map::addCannon(int entityID, float x, float y, float angle, float xVel, float yVel, float size) {
	if (getCannon(entityID) == NULL) {
		Cannon* c = new Cannon(entityID, this, size);
		physicsEngine->makeBodyForCannon(c, x, y, angle, size);
		cannons.insert(std::pair<int,Cannon*>(entityID, c));
		//std::cout << "Vel " << xVel << " , " << yVel << std::endl;
		c->getPhysicsBody()->ApplyForce(b2Vec2(xVel,yVel), c->getPhysicsBody()->GetWorldCenter(), true);
	}
}
Example #2
0
Weapon::WeaponI* Weapon::Armory::requisition(std::string name, int code)
{
	//Messy, but functional :^)
	if (name == "pistol")			return getPistol(code);
	else if (name == "rifle")		return getRifle(code);
	else if (name == "cannon")		return getCannon(code);
	else if (name == "shotgun")		return getShotgun(code);
	else if (name == "werfer")		return getWerfer(code);
	else if (name == "coilgun")		return getCoilgun(code);
	else if (name == "railgun")		return getRailgun(code);
	else if (name == "thumper")		return getThumper(code);
	else if (name == "launcher")	return getLauncher(code);
	else if (name == "fungun")		return getFun(code);

	else return nullptr;
}