コード例 #1
0
bool gun_actor::call( monster &z ) const
{
    Creature *target;
    if( z.friendly != 0 ) {
        // Attacking monsters, not the player!
        int boo_hoo;
        target = z.auto_find_hostile_target( range, boo_hoo );
        if( target == nullptr ) {
            // Couldn't find any targets!
            if( boo_hoo > 0 && g->u.sees( z ) ) {
                // because that stupid oaf was in the way!
                add_msg( m_warning, ngettext( "Pointed in your direction, the %s emits an IFF warning beep.",
                                              "Pointed in your direction, the %s emits %d annoyed sounding beeps.",
                                              boo_hoo ),
                         z.name().c_str(), boo_hoo );
            }
            return false;
        }

        shoot( z, *target );
        return true;
    }

    // Not friendly; hence, firing at the player too
    target = z.attack_target();
    if( target == nullptr || rl_dist( z.pos(), target->pos() ) > range ||
        !z.sees( *target ) ) {
        return false;
    }

    shoot( z, *target );
    return true;
}
コード例 #2
0
void EnemyScout::doLogic(double delta)
{
    EnemyEntity::doLogic(delta);

    //shoot
    if(shotTicks > lastShot){
        lastShot = shotTicks;
        if(shotTicks % 50 == 45){
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
        }
        if(shotTicks % 50 == 46){
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
        }
        if(shotTicks % 50 == 47){
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
        }
        if(shotTicks % 50 == 48){
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
        }
        if(shotTicks % 50 == 49){
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
            shoot(200, targetPlayer,game->rand(-10,10)/10.0f);
        }
    }
}
コード例 #3
0
ファイル: main.c プロジェクト: abrochard/minesweeperAI
int main(int argc, char **argv)
{
	int x = MAX_X;
	int y = MAX_Y;
	int mines = MAX_MINES;
	// 	printf("%d %d %d\n\n", x, y, mines);
	if(argc==1) {

		struct Board *board = init_board(x, y, mines);
		init_AI(x, y, mines);
		int game=0;
		struct Point target;
		while (game >= 0) {
			print_board(board);
			printf("\n");
			print_AI_grid();
			printf("Target?");
			target = AI_get_target();
			printf("\nTargetting: %d %d\n", target.x, target.y);
			game = shoot(board, target.x, target.y);
			printf("Result: %d \n\n",game);
			AI_send_result(target.x, target.y, game);
		}
		printf("\n");
		if(game==-1)
			printf("LOST\n");
		else if(game==-2)
			printf("WON\n");
		free_board(board);
		free_AI();
	}
	else {
		int total=atoi(argv[1]);
		int i;
		int won=0;
		int last_percent=0, percent=0;
		for(i=0;i<total;i++) {
			struct Board *board = init_board(x, y, mines);
			init_AI(x, y, mines);
			int game=0;
			struct Point target;
			while (game >= 0) {
				target = AI_get_target();
				game = shoot(board, target.x, target.y);
				AI_send_result(target.x, target.y, game);
			}
			if(game==-2)
				won++;
			free_board(board);
			free_AI();
			percent = (int)((float)i/total*100);
			if(last_percent < percent) {
				printf("%d percent done, ratio: %f \n", percent, (float)won/(i+1));
				last_percent = percent;
			}
		}
		printf("Won %d out of %d\nRatio: %f \n", won, total, (float)won/total);
	}
	return 0;
}
コード例 #4
0
ファイル: D1Sprite.cpp プロジェクト: mriiiron/aero-engine-d3d
VOID D1PlayerFighter::update(AEHashedTable<AEPlatform>* platformTable) {
    
    if (!(isKeyPressed(D1Key::KEY_LEFT) && isKeyPressed(D1Key::KEY_RIGHT))) {
        FLOAT xSpeed = 0.0f;
        if (isKeyPressed(D1Key::KEY_LEFT)) {
            xSpeed = -1.0f;
        }
        else if (isKeyPressed(D1Key::KEY_RIGHT)) {
            xSpeed = 1.0f;
        }
        else {
            xSpeed = 0.0f;
        }
        setVx(xSpeed);
    }
    FLOAT ySpeed = (isKeyPressed(D1Key::KEY_UP) ? -1.0f : 0.0f) + (isKeyPressed(D1Key::KEY_DOWN) ? 1.0f : 0.0f);
    setVy(ySpeed);
    
    attackTimer--;
    if (attackTimer == 25 || attackTimer == 15 || attackTimer == 5) {
        shoot(8.0f);
        shoot(-8.0f);
    }

    if (hpValue <= 0 && action < D1PlayerFighter::ACTION_KILLED) {
        changeAction(D1PlayerFighter::ACTION_KILLED);
        AESpriteAttachment* attachedShadow = attachmentTable->getItem(0);
        if (attachedShadow) attachedShadow->getSprite()->remove();
    }
    
    D1Sprite::update(platformTable);

}
コード例 #5
0
ファイル: canned.c プロジェクト: jmwiseman/robottest
void fire(int n) {
	printf("fire\n\r\n\r");
	shoot(MAX_SPEED);
	delay(2000);
	load(CONVEYER_SPEED);
	delay(2000*n);
	load(0);
	shoot(0);
}
コード例 #6
0
ファイル: V3.5.c プロジェクト: cloud5678/cloud5678-2016
task autonomous()
{
	//Old Auton, Keep Until new one is Proven

	/*
	drive(127);
	wait1Msec(7000);//Test this
	motor[shooterL] = motor[shooterR] = 127;
	drive(0);
	wait1Msec(3000);
	motor[shooterL] = motor[shooterR] = 0;
	drive(0);
	*/
	//Adujust Times Below
	int speeder = 73;
	//Ball One

	shoot(speeder);
	wait1Msec(2000);
	intake(127);
	wait1Msec(400);
	intake(0);
	wait1Msec(750);

	//Ball Two

	shoot(speeder);
	wait1Msec(1000);
	intake(127);
	wait1Msec(650);
	intake(0);
	wait1Msec(750);

	//Ball Three

	shoot(speeder);
	wait1Msec(1000);
	intake(127);
	wait1Msec(650);
	intake(0);
	wait1Msec(750);

	//Ball Four

	shoot(speeder);
	wait1Msec(1000);
	intake(127);
	wait1Msec(650);
	intake(0);
	wait1Msec(750);

	//All Stop

	stopAll();

}
コード例 #7
0
ファイル: laby.c プロジェクト: hialmar/tyrann3
void forward(void)
{
	char b;
	// 600 IF F(1)>0 AND F(1)<7 THEN GOTO 660
	if (f[0]==1) {
		// 660 B=INT(RND(1)*3+1)
		// 670 SHOOT:PRINT SPC(5) TX$(B) :WAIT8*TI:SHOOT:CLS
		// 672 IF B=2 THEN ZAP:SHOOT:ZAP
		shoot();
		printf("     ");
		b = rand()%3;
		printf(message[b]);
		wait(360);
		shoot();
		cls();
		if (b==1) {
			zap();shoot();zap();
		}
	} else if(f[0]>1 && f[0]<7) {
		shoot();
		printf("Prenez la porte, mais pas comme ca !");
		wait(360);
		cls();
	} else {
		s_old = s;
		x_old = x;
		y_old = y;
		switch(s) {
			case 0:
				if(y>0)
					y--;
				break;
			case 1:
				if(x<XMAX)
					x++;
				break;
			case 2:
				if(y<XMAX)
					y++;
				break;
			case 3:
				if(x>0)
					x--;
				break;
			default:
				printf("erreur forward\n");
		}
	}
	// 330 CASE=C(X,Y)
	ca = c[x+y*XMAX];
	
	prep();
	drawLaby();
	manageCell();
}
コード例 #8
0
void TurretAIComponent::search() // Currently Only Shoots at the Player
{
	bool foundTarget = false;
	Position pos = curPosition_;
	Position tPos(0,0); // Target Position;

	pos = curPosition_;
	searchLine(pos, DIRECTION_UP, visionRange_, tPos, foundTarget);
	if (foundTarget == true)
	{
		targetPosition_ = tPos;
		shoot(DIRECTION_UP);
		targetFound_ = true;
		return;
	}

	pos = curPosition_;
	searchLine(pos, DIRECTION_DOWN, visionRange_, tPos, foundTarget);

	if (foundTarget == true)
	{
		targetPosition_ = tPos;
		shoot(DIRECTION_DOWN);
		targetFound_ = true;
		return;
	}

	pos = curPosition_;
	searchLine(pos, DIRECTION_LEFT, visionRange_, tPos, foundTarget);

	if (foundTarget == true)
	{
		targetPosition_ = tPos;
		shoot(DIRECTION_LEFT);
		targetFound_ = true;
		return;
	}

	pos = curPosition_;
	searchLine(pos, DIRECTION_RIGHT, visionRange_, tPos, foundTarget);

	if (foundTarget == true)
	{
		targetPosition_ = tPos;
		shoot(DIRECTION_RIGHT);
		targetFound_ = true;
		return;
	}
}
コード例 #9
0
void Player::processKeyPressed(cocos2d::EventKeyboard::KeyCode keyCode)
{
	switch (keyCode) 
	{
	case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
	case EventKeyboard::KeyCode::KEY_A:
		move(Vec2(-Player::MAX_SPEED, 0), MOVE_LEFT_ACTION_TAG);
		break;
	case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
	case EventKeyboard::KeyCode::KEY_D:
		move(Vec2(Player::MAX_SPEED, 0), MOVE_RIGHT_ACTION_TAG);
		break;
	case EventKeyboard::KeyCode::KEY_UP_ARROW:
	case EventKeyboard::KeyCode::KEY_W:
		move(Vec2(0, Player::MAX_SPEED), MOVE_UP_ACTION_TAG);
		break;
	case EventKeyboard::KeyCode::KEY_DOWN_ARROW:
	case EventKeyboard::KeyCode::KEY_S:
		move(Vec2(0, -Player::MAX_SPEED), MOVE_DOWN_ACTION_TAG);
		break;
	case EventKeyboard::KeyCode::KEY_SPACE:
		_isFiring = true;
		shoot();
		CCDirector::getInstance()->getScheduler()->schedule(schedule_selector(Player::shoot), this, FIRING_RATE, false);
		break;
	case EventKeyboard::KeyCode::KEY_P:
		if (_isFiring)
		{
			_isFiring = false;
			CCDirector::getInstance()->getScheduler()->unschedule(schedule_selector(Player::shoot), this);
		}
		this->stopAllActions();
		break;
	}
}
コード例 #10
0
bool MainApplication::keyReleased( const OIS::KeyEvent& arg )
{
    switch (arg.key)
    {
        case OIS::KC_UP:
        case OIS::KC_W:
            mDirection.y = 0;
            break;

        case OIS::KC_DOWN:
        case OIS::KC_S:
            mDirection.y = 0;
            break;

        case OIS::KC_LEFT:
        case OIS::KC_A:
            mDirection.x = 0;
            break;

        case OIS::KC_RIGHT:
        case OIS::KC_D:
            mDirection.x = 0;
            break;

        case OIS::KC_SPACE:
            shoot();
            break;

        default:
            break;
        }
        return true;
}
コード例 #11
0
ファイル: moc_cannon.cpp プロジェクト: satazor/univ-aca-mips
bool CannonField::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        setAngle((int)static_QUType_int.get(_o+1));
        break;
    case 1:
        setForce((int)static_QUType_int.get(_o+1));
        break;
    case 2:
        shoot();
        break;
    case 3:
        newTarget();
        break;
    case 4:
        setGameOver();
        break;
    case 5:
        restartGame();
        break;
    case 6:
        moveShot();
        break;
    default:
        return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
コード例 #12
0
void Tower::attack(Object *obj)
{
    if(dynamic_cast<Card *>(obj) != NULL)
        dynamic_cast<Card *>(obj)->damaged(this->damage);

    shoot(obj->pos().x(), obj->pos().y());
}
コード例 #13
0
ファイル: bossGun.cpp プロジェクト: Capeguy/GPAssignment2
void BossGun::update(float frametime, int orientation, float x, float y, Input * input, LevelController * lc, float destX, float destY, bool shouldShoot) {
    playerX = x;
    playerY = y;
    adjacent = destX - x;
    opposite = destY - y;
    angle = atan((opposite / adjacent));
    spriteData.angle = angle;
    if (adjacent < 0) { // Facing back
        setX(x);
        setY(y + 80);
        flipHorizontal(true);
    } else {
        setX(x + 50);
        setY(y + 80);
        flipHorizontal(false);
    }
    angle = atan((destY - getY()) / (destX - getX()));
    // Fire bullet
    if (shouldShoot) { // Cause AI calls this
        Projectile* p = shoot(lc, frametime);
        if (p != nullptr)
            p->setOwner(Projectile::NPC);
    } else {
        cooldownCurrent -= frametime;
    }
    Entity::update(frametime);
}
コード例 #14
0
ファイル: wump.c プロジェクト: alexandermerritt/dragonfly
int
take_action(void)
{
	/*
	 * Do the action specified by the player, either 'm'ove, 's'hoot
	 * or something exceptionally bizarre and strange!  Returns 1
	 * iff the player died during this turn, otherwise returns 0.
	 */
	switch (*answer) {
		case 'M':
		case 'm':			/* move */
			return(move_to(answer + 1));
		case 'S':
		case 's':			/* shoot */
			return(shoot(answer + 1));
		case 'Q':
		case 'q':
		case 'x':
			exit(0);
		case '\n':
			return(0);
		}
	if (random() % 15 == 1)
		(void)printf("Que pasa?\n");
	else
		(void)printf("I don't understand!\n");
	return(0);
}
コード例 #15
0
ファイル: EntityManager.hpp プロジェクト: lechevet/rtype
  int	updateEntities()
  {
    typename std::list<Type>::iterator	it;
    typename std::list<Type>::iterator	tmp;
    int	id;

    it = _list.begin();
    spawningEnemies();
    while (it != _list.end())
      {
	tmp = it;
	if (move(*it) == false)
	  tmp = _list.erase(it);
	else
	  {
	    shoot(*it);
	    collision(*it);
	    if ((*it)->checkDeath() == true)
	      {
		id = (*it)->getId();
		tmp = _list.erase(it);
		if ((*it)->getType() == SHIP)
		  return (id);
	      }
	  }
	if (tmp != it)
	  it = tmp;
	else
	  ++it;
      }
    return (-1);
  } 
コード例 #16
0
ファイル: Enemy.cpp プロジェクト: aeron005/Diamond
void Enemy::step() {
	player_visible = !player->dead && world()->level->visible(shared_from_this(), std::static_pointer_cast<Entity>(player));
	player_distance = Game::distance(shared_from_this(), std::static_pointer_cast<Entity>(player));

	if(!attack) {
		scope();
		if(alert)
			hunt();
		else wander();
	}

	walking();
	worldCollision();

	dy += gravity;

	if(alert && frame==0) frame = 5;
	if(attack)
		shoot();

	processEntities();

	light->setPosition(sf::Vector2f(x,y));

	sprite.setPosition(round(x),round(y));
	sprite.setScale(facing_right?1.0:-1.0,1.0);
	sprite.setTextureRect(sf::IntRect(frame*24,0,24,24));
}
コード例 #17
0
void    Player::newInput(int const input) {
    switch (input) {
    case 97:
    case 100:
    case 115:
    case 119: {
        if (input == _direction) {
            _speed += calcSpeed(input, (15.0f - _speed) / 8.0f);
        } else if (_speed <= 0.5f) {
            switch (input) {
            case 119: _y -= 1.0f; break; // W (up)
            case 115: _y += 1.0f; break; // S (down)
            case 100: _x += 1.0f; break; // D (left)
            case 97:  _x -= 1.0f; break; // A
            }
            _speed = 0.0f;
        } else if ((input == 119 && _direction == 115)
                || (input == 115 && _direction == 119)
                || (input == 100 && _direction == 97)
                || (input == 97  && _direction == 100)) {
            _speed = 0.0f;
        } else if (_speed > 1.0f) {
            _speed -= calcSpeed(input, _speed - 1.0f) / 2.0f;
        }
        _direction = input;
        break;
    }
    default: shoot(); break;
    }
}
コード例 #18
0
ファイル: battle.c プロジェクト: scumola/GalaxyNG
void
attack(bprotocol *aProtocol,
       batstat *attackingSide, group *attackingGroup, int attackingShip,
       batstat *targetSide, group *targetGroup, int targetShip)
{

  if (shoot(attackingGroup, targetGroup)) {
    targetGroup->left--;
    (targetGroup->alive)[targetShip] = FALSE;
    if (targetGroup->type->weapons) {
      if ((targetGroup->canshoot)[targetShip]) {
        (targetGroup->canshoot)[targetShip] = FALSE;
        targetGroup->numberOfAttackersLeft--;
        targetSide->numberOfAttackersLeft--;
      }
    }
    addShot(aProtocol, attackingSide->who, attackingGroup->type,
            targetSide->who, targetGroup->type, 1);
    targetSide->numberOfTargets--;
    targetSide->who->masslost += typemass(targetGroup->type);
  }
  else {
    addShot(aProtocol, attackingSide->who, attackingGroup->type,
            targetSide->who, targetGroup->type, 0);
  }
}
コード例 #19
0
void CharacterUpdaterPlayer::shoot(CCObjectCollideable *enemy)
{
    if( enemy != NULL )
    {
        shoot( enemy->getPosition(), enemy );
    }
}
コード例 #20
0
ファイル: Player.cpp プロジェクト: akashdeepk/SFML-book
    Player::Player(World& world) : Entity(Configuration::Textures::Player,world)
                       ,ActionTarget(Configuration::player_inputs)
                       ,_is_moving(false)
                       ,_rotation(0)
    {
        bind(Configuration::PlayerInputs::Up,[this](const sf::Event&){
             _is_moving = true;
        });

        bind(Configuration::PlayerInputs::Left,[this](const sf::Event&){
             _rotation-= 1;
         });

        bind(Configuration::PlayerInputs::Right,[this](const sf::Event&){
             _rotation+= 1;
         });

        bind(Configuration::PlayerInputs::Shoot,[this](const sf::Event&){
             shoot();
         });

        bind(Configuration::PlayerInputs::Hyperspace,[this](const sf::Event&){
             goToHyperspace();
         });
    }
コード例 #21
0
ファイル: OBCTurret.hpp プロジェクト: SuperV1234/SSVBloodshed
        OBCTurret(Entity& mE, OBCPhys& mCPhys, OBCDraw& mCDraw,
            OBCKillable& mCKillable, Dir8 mDir, const OBWpnType& mWpn,
            float mShootDelay, float mPJDelay, int mShootCount) noexcept
            : OBCActor{mE, mCPhys, mCDraw},
              cKillable(mCKillable),
              direction{mDir},
              wpn{game, OBGroup::GFriendlyKillable, mWpn},
              shootDelay{mShootDelay},
              pjDelay{mPJDelay},
              shootCount{mShootCount}
        {
            cDraw.setRotation(getDegFromDir8(direction));

            getEntity().addGroups(OBGroup::GEnemy, OBGroup::GEnemyKillable);
            body.setResolve(false);
            body.addGroups(OBGroup::GSolidGround, OBGroup::GSolidAir,
                OBGroup::GEnemy, OBGroup::GKillable, OBGroup::GEnemyKillable);

            tckShoot.restart(shootDelay);
            repeat(tlShoot,
                [this]
                {
                    shoot();
                },
                shootCount, pjDelay);

            cKillable.onDeath += [this]
            {
                game.createEShard(5, cPhys.getPosI());
            };
        }
コード例 #22
0
ファイル: line.c プロジェクト: A-renderer/kapaltembak
int main() {
    init();
    clearscreen();
	isShoot = 0;
    pthread_t plane;
    pthread_create(&plane,NULL,threadHandler,NULL);
	degree = 0;
	int c;
	while(1){
		key = kbhit();
		if (!key){
		
		}
		else {
			c = getchar();
			if(c == 'd') {
				if (degree <= 87)
					degree +=1;
				target(degree);
			}
			else if(c == 'a') {
				if (degree >= 1)
					degree -=1;
				target(degree);
			}
			else if(c == '\n'){
				isShoot = shoot();
			}
				key = 0;
		}
	}
    munmap(fbp, screensize);
    close(fbfd);
    return 0;
}
コード例 #23
0
int main()
{
  printf("%s\n","BattleShip!");
  player_score=0;
  computer_score=0;
  srand(time(0));
  inut_hitmap();
  inut_map();
  inut_buffer(); 
  place_ships();
  
   while(1)
   {
     show_map();
     shoot();//defult shooting algerithm just shoots at random coordnets; really sucks as a player
     gethit();
     
     if(win()>1 || ships_left()<=0)
        break;
   }

   if(computer_score>player_score)
       printf("%s\n","computer wins");
   else if(computer_score<player_score)
       printf("%s\n","player wins");
   else if(computer_score==player_score)
       printf("%s\n","tie, howd that happen");  

}
コード例 #24
0
void AIController::run(int frameRate) {
    Controller::run(frameRate);
    coord[pos][0] = shipCoord().getX();
    coord[pos][1] = shipCoord().getY();
    pos++;
    it++;
    pos %= LOG_SIZE;
    if (it >= 5) {
        if (coord[pos][0] < coord[(pos + 1) % LOG_SIZE][0] && shipCoord().getX() < 0 && shipCoord().getZ() < 0 &&
            !rotated) {
//            std::cout << "*";
            if (getYaw() <= MAX_ROTATE_POWER) {
                plusYaw();
            }
        } else {
            rotateX();
            moveX();
            rotateY();
            moveY();
            moveForward();
            shoot();
        }
    }
//    std::cout << "coord: " << shipCoord().getX() << " " << shipCoord().getY() << " " << shipCoord().getZ() << " ";
//    std::cout << "speed: " << radar->targetSpeed().getX() << " " << radar->targetSpeed().getY() << " " <<
//    radar->targetSpeed().getZ() << " ";
//    std::cout << "angular: " << m_object->angularVelocity().getX() << " " << m_object->angularVelocity().getY() << " ";
//    std::cout << "thrust: " << thrust << " " << thrustY << " ";
//    std::cout << "power: " << power << " ";
//    std::cout << "premtion: " << preemption().getX() << " " << preemption().getY() << " " << preemption().getZ() << " ";
//    std::cout << "\n";
    m_object->run(frameRate);
}
コード例 #25
0
ファイル: BaseMageTower.cpp プロジェクト: KrisLee/KingdomRush
void BaseMageTower::shoot(float dt)
{
	auto instance = GameManager::getInstance();
	checkNearestMonster();
	if(nearestMonster!=NULL && nearestMonster->getCurrHp() > 0)
    {
		auto currBullet = MageTowerBullet();
		SoundManager::playMageTowerShot();
		Point shootVector = nearestMonster->baseSprite->getPosition() - this->getParent()->getPosition();
		
		auto position=currBullet->getPosition()-shootVector;
		auto rotation=atan2(position.y,position.x);
		float angleDegrees = CC_RADIANS_TO_DEGREES(rotation);
		currBullet->setRotation(180.0f-angleDegrees);

		towerBase->runAction(Animate::create(AnimationCache::getInstance()->getAnimation(String::createWithFormat("level%d_mage_shine",level)->getCString())));


		if(shootVector.y>0){
			shooter->runAction(Animate::create(AnimationCache::getInstance()->getAnimation("mage_shoot_up")));
		}else{
			shooter->runAction(Animate::create(AnimationCache::getInstance()->getAnimation("mage_shoot_down")));
		}

		auto actionMove=MoveTo::create(0.25f,shootVector);
		auto action=Spawn::create(actionMove,NULL);

		currBullet->setBulletAction(action);
		currBullet->shoot();
		currBullet = NULL;
	}
}
コード例 #26
0
ファイル: timer.cpp プロジェクト: tickmo/desktop
void Timer::run()
{
    running = true;
    increaseInterval();
    shoot();
    status_changed();
}
コード例 #27
0
void repat ()
{
	shoot (70);
	wait1Msec(2000);
	intaked(65);
	wait1Msec(ballWait);
}
コード例 #28
0
ファイル: StrongEnemy.cpp プロジェクト: ThisisJaws/Pi
void StrongEnemy::combatStageC(irr::f32 deltaTime) {
    if(shotsFired != MAX_SHOT_COUNT) {
        if(shoot(irr::core::vector3df(0, 0, moveDir), TYPE_SHIP_PLAYER, cannonPositions)) {
            shotsFired++;
        }
    } else {
        if(currentLoop < COMBAT_LOOP_COUNT) {
            //Moves to the bottom of the screen
            if(getPosition().Y > -45) {
                moveVertical(turnSpeed, -1, deltaTime);
            } else {
                if(currentLoop != COMBAT_LOOP_COUNT) {
                    //Reset shout count, increment loop count and reset stage
                    shotsFired = 0;
                    currentLoop++;
                    currentStage = stageA;
                }
            }
        } else {
            //If the loop count is reached then leave the area
            if(timeElapsed > 1) {
                moveSpeed /= 2;
                currentStage = stageEnd;
            } else {
                timeElapsed += deltaTime;
            }
        }
    }
}
コード例 #29
0
ファイル: gameplay.c プロジェクト: pseudogames/hardheaded
void playerAttack(App *app, Player *player){
	int i;
	Body *body = &player->body;
	Body *head_body = &app->game.head.body;

	if(body->action == ACTION_DEATH) return;
	if(player->grabbing){
		head_body->action = ACTION_MOVE;
		player->grabbing = 0;
		return;
	}

	if(player->special_attack >= 100) {
		player->power_body.action = ACTION_ATTACK;
		player->power_body.damage = PLAYER_DAMAGE;
		playSpecialAttack();
	}else{
		playAttack();
	}

	body->action = ACTION_ATTACK;
	body->frame = 0;

	for(i=0; i< 360; i+=10) {
		float range = (i > 180 ? i-180 : 180-i) / 180. * tileSize*1.2;
		shoot(app, &player->body, 20, i, range);
	}

	player->special_attack = 0;
}
コード例 #30
0
ファイル: BubbleScene.cpp プロジェクト: uvbs/GameProject
	void Scene::fireAction( ActionTrigger& trigger )
	{
		if ( !trigger.haveUpdateFrame() )
			return;

		float const angle = DEG2RAD(3);
		float const mouseAngle = - 0.01f; 

		int offset = 0;

		if ( trigger.detect( ACT_BB_SHOOT ) )
			shoot();

		if ( trigger.detect( ACT_BB_ROTATE_LEFT ) )
		{
			roteRight( angle );
		}
		else if ( trigger.detect( ACT_BB_ROTATE_RIGHT ) )
		{
			roteRight( -angle );
		}
		else if ( trigger.detect( ACT_BB_MOUSE_ROTATE , &offset ) )
		{
			roteRight( mouseAngle * offset );
		}
	}