本文整理汇总了C++中Projectile类的典型用法代码示例。如果您正苦于以下问题:C++ Projectile类的具体用法?C++ Projectile怎么用?C++ Projectile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Projectile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Projectile
Projectile *Projectile::create(int projectileID, Projectile *model) {
Projectile *retVal = new Projectile();
if (retVal && retVal->initWithProjectileID(projectileID, model)) {
retVal->autorelease();
return retVal;
}
CC_SAFE_DELETE(retVal);
return NULL;
}
示例2: Projectile
void Application::InitProjectileList()
{
for (int i = 0; i < 100; ++i)
{
Projectile* p = new Projectile();
p->SetID(i);
projectileList.push_back(p);
}
}
示例3: serializeShot
/* playSound center_x center_y */
void MessageObjects::serializeShot(const Projectile &shot)
{
/* Write playSound */
_messageString += QString::number(shot.playSound() ? 1 : 0) + " ";
/* Write 2 points */
_messageString += QString::number((qint32)shot.center().x()) + " ";
_messageString += QString::number((qint32)shot.center().y()) + " ";
}
示例4: _delete_projectile
void _delete_projectile(void **projs, void *proj) {
Projectile *p = proj;
p->rule(p, EVENT_DEATH);
if(p->clr)
free(p->clr);
del_ref(proj);
delete_element(projs, proj);
}
示例5: projectileHit
void Client::projectileHit(GameObjId projectileId)
{
Projectile *projectile = (worldModel.getProjectiles())[projectileId];
worldRenderer.projectileHit(projectile,
projectile->getHitPos());
bool removed = worldModel.getProjectiles().remove(projectileId);
assert(removed);
//if (removed) std::cout << "projectile removed" << std::endl;
}
示例6: addCannonProjectiles
void addCannonProjectiles() {
for(int i = 0; i < 8; i++) {
Projectile * p = new Projectile(false, projectileMesh,
CANNON_PROJECTILE_SCALE);
parts.push_back(p->getPart());
p->getPart()->setMaterialGreenProjectile();
cannonProjectiles.push_back(p);
}
}
示例7: fire
void Attacker::fire() {
Projectile *p = new Projectile;
p->setLocation(this->rect.center());
p->setTarget(target);
p->launch();
projectiles.push_back(p);
}
示例8: Projectile
void Weapon::shoot(list<Entity*> *bullets){
Projectile *p = new Projectile( Vector3(0,0,-10) , parent->getParent());
p->setFrame(parent->getFrame()^getFrame());
ModelWeapon *lol = new ModelWeapon();
lol->setSkin(1);
//p->setModel(new ModelBullet());
p->setModel(lol);
bullets->push_back(p);
}
示例9: projectile
Projectile* FastMachineGunProjectile::projectile()
{
Projectile* projectile = Projectile::create();
projectile->projectileSprite = Sprite::create("Projectile.png");
projectile->addChild(projectile->projectileSprite);
// projectile->setScale(0.6);
projectile->projectileDamage = 0.8;
projectile->type = ProjectileType::FastMachineGunProjectile;
return projectile;
}
示例10: valid_to_use_projectile
bool Equipment::valid_to_use_projectile(const Projectile& proj) {
if (!proj.valid_projectile())
return false;
ProjectileEntry& pentry = proj.projectile_entry();
if (pentry.weapon_class == "unarmed")
return true;
if (pentry.weapon_class == weapon.weapon_entry().weapon_class)
return true;
return false;
}
示例11: Rocket
std::list<Projectile*> *RocketLauncher::fire (Rect pos, Direction h, dmg_chan type)
{
std::list<Projectile*> *proj_list = new std::list<Projectile*>();
Projectile * r = new Rocket (pos, h, (2 * h - 1) *PROJ_SPEED, 0, ROCKET_DAMAGE);
r->set_chan (type);
proj_list->push_back (r);
m_munitions--;
gSound->play_sound (FIRE_SOUNDS_R + "rocket.wav");
return proj_list;
}
示例12: ShortBeam
//spawn new projectile and add to list of projectiles
void Player::spawnShortBeam()
{
Projectile *shortBeam = new ShortBeam(minX, minY);
projMtx.lock();
shortBeam->render();
renderProjVector.push_back(shortBeam);
projMtx.unlock();
}
示例13: mouseVector
//Logica do movimento
void Player::update()
{
Point mousePos = input->getMousePos();
Vector mouseVector(mousePos.getX() - pos.getX() + Game::getCurrentLevel()->getMap()->getXOffs(), mousePos.getY() - pos.getY() + Game::getCurrentLevel()->getMap()->getYOffs());
mouseVector = mouseVector.getNormalized();
angleDirection = atan2(mouseVector.getY(),mouseVector.getX()) - atan2(-1,0);
if(input->isLeft())
{
if(!collision(pos.getX() - speed,pos.getY()))
{
pos.setX(pos.getX() - speed);
}
}
else if(input->isRight())
{
if(!collision(pos.getX() + speed,pos.getY()))
{
pos.setX(pos.getX() + speed);
}
}
if(input->isUp())
{
if(!collision(pos.getX(),pos.getY() - speed))
{
pos.setY(pos.getY() - speed);
}
}
else if(input->isDown())
{
if(!collision(pos.getX(),pos.getY() + speed))
{
pos.setY(pos.getY() + speed);
}
}
if(input->isMouseClicked() == 1 )
{
Projectile* p = new Projectile();
if(weapon->shoot(p))
{
int xx = pos.getX() + 20*sin(angleDirection);
int yy = pos.getY() + 20*-cos(angleDirection);
p->setOrigin(Point(xx,yy));
p->setAngle(angleDirection);
std::cout<<"Angle: "<<angleDirection<<std::endl;
Game::getCurrentLevel()->getProjectiles()->add(p);
}
}
}
示例14: drawProjectile
void SDLCanvas::drawProjectile(Projectile& pro, Color& c) {
if(!isDrawProjectilesEnabled())
return;
Vector2D trail = pro.loc_;
if(scale_ < 0.013)
trail += pro.getDirection() * -1500;
else
trail += pro.getDirection() * -500;
drawLine(trail.x_,trail.y_, pro.loc_.x_, pro.loc_.y_, c);
}
示例15: idle
void idle() {
for (unsigned int i=0; i<weapons.size(); i++) {
weapons.at(i).updateProjectiles(0.01f);
for (unsigned int j=0; j<weapons.at(i).projectile.size(); j++) {
Projectile p = weapons.at(i).projectile.at(j);
if (p.hitBoxTest(&targets.at(0).hitBox)) {
std::cout << "HIT" << std::endl;
}
}
}
glutPostRedisplay();
}