Ejemplo n.º 1
0
void AWeapon::Fire(AMainCharacter* pWeaponOwner)
{
	WeaponOwner = pWeaponOwner;

	if (Config.AmmoCostPerShot <= Config.CurrentMagazineAmmo && Config.CurrentMagazineAmmo > 0)
	{
		if (ProjectileType == EWeaponProjectile::EBullet)
		{
			FireProjectile();
			PlayWeaponSound(FireSound);
			Config.CurrentMagazineAmmo -= Config.AmmoCostPerShot;
		}
		if (ProjectileType == EWeaponProjectile::EShell)
		{
			for (int32 i = 0; i <= Config.SlugsPerShell; i++)
			{
				FireProjectile();
			}
			Config.CurrentMagazineAmmo -= Config.AmmoCostPerShot;
			PlayWeaponSound(FireSound);
		}
		if (ProjectileType == EWeaponProjectile::ERocket)
		{
		}
	}
}
Ejemplo n.º 2
0
/**
 * Handle all events that come from SDL.
 * These are timer or keyboard events.
 */
void SFApp::OnEvent(SFEvent& event) {
  SFEVENT the_event = event.GetCode();
  switch (the_event) {
  case SFEVENT_QUIT:
    is_running = false;
    break;
  case SFEVENT_UPDATE:
    OnUpdateWorld();
    OnRender();
    break;
  case SFEVENT_PLAYER_UP:
    player->GoNorth();
    break;
  case SFEVENT_PLAYER_DOWN:
    player->GoSouth();
    break;
  case SFEVENT_PLAYER_LEFT:
    player->GoWest();
    break;
  case SFEVENT_PLAYER_RIGHT:
    player->GoEast();
    break;
  case SFEVENT_FIRE:
    fire ++;
    FireProjectile();
    break;
  }
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFFlareGun::LaunchProjectile(void)
{
	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer(GetPlayerOwner());
	if (!pPlayer)
		return;

	CalcIsAttackCritical();

	SendWeaponAnim(ACT_VM_PRIMARYATTACK);

	pPlayer->SetAnimation(PLAYER_ATTACK1);
	pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);

	FireProjectile(pPlayer);

#if !defined( CLIENT_DLL ) 
	pPlayer->SpeakWeaponFire();
	CTF_GameStats.Event_PlayerFiredWeapon(pPlayer, IsCurrentAttackACrit());
#endif

	// Set next attack times.
	m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData(m_iWeaponMode).m_flTimeFireDelay;

	SetWeaponIdleTime(gpGlobals->curtime + SequenceDuration());

	// Check the reload mode and behave appropriately.
	if (m_bReloadsSingly)
	{
		m_iReloadMode.Set(TF_RELOAD_START);
	}
}
// ---------------------------------------------------------------------------- -
// Purpose: 
//-----------------------------------------------------------------------------
void CTFCompoundBow::FireArrow( void )
{
	// Get the player owning the weapon.
	CTFPlayer *pPlayer = GetTFPlayerOwner();
	if ( !pPlayer )
		return;

	CalcIsAttackCritical();

	SendWeaponAnim( ACT_VM_PRIMARYATTACK );

	pPlayer->SetAnimation( PLAYER_ATTACK1 );
	pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

	pPlayer->m_Shared.RemoveCond( TF_COND_AIMING );
	pPlayer->TeamFortress_SetSpeed();

	FireProjectile( pPlayer );

#if !defined( CLIENT_DLL ) 
	pPlayer->SpeakWeaponFire();
	CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif

	// Set next attack times.
	float flDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
	CALL_ATTRIB_HOOK_FLOAT( flDelay, mult_postfiredelay );
	m_flNextPrimaryAttack = gpGlobals->curtime + flDelay;

	SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );

	m_flChargeBeginTime = 0.0f;
}
Ejemplo n.º 5
0
void Plazma::Fire(Vec2 poz, Vec2 smjer, unsigned char** mapa, bool vlasnik)
{
	Weapon::Fire(poz,smjer,mapa,vlasnik);
	if(currentCharging==charging)
	{
		FireProjectile(new PlazmaProjektil());
		currentCharging=0;
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFPipebombLauncher::LaunchGrenade( void )
{
	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	CalcIsAttackCritical();

	SendWeaponAnim( ACT_VM_PRIMARYATTACK );

	pPlayer->SetAnimation( PLAYER_ATTACK1 );
	pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

	FireProjectile( pPlayer );

#if !defined( CLIENT_DLL ) 
	pPlayer->SpeakWeaponFire();
	CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif

	// Set next attack times.
	float flDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
	CALL_ATTRIB_HOOK_FLOAT( flDelay, mult_postfiredelay );
	m_flNextPrimaryAttack = gpGlobals->curtime + flDelay;

	m_flLastDenySoundTime = gpGlobals->curtime;

	SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );

	// Check the reload mode and behave appropriately.
	if ( m_bReloadsSingly )
	{
		m_iReloadMode.Set( TF_RELOAD_START );
	}

	m_flChargeBeginTime = 0;
}
Ejemplo n.º 7
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFWeaponBaseGun::PrimaryAttack( void )
{
	// Check for ammunition.
	if ( m_iClip1 <= 0 && m_iClip1 != -1 )
		return;

	// Are we capable of firing again?
	if ( m_flNextPrimaryAttack > gpGlobals->curtime )
		return;

	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	if ( !CanAttack() )
		return;

	CalcIsAttackCritical();

#ifndef CLIENT_DLL
	pPlayer->RemoveInvisibility();
	pPlayer->RemoveDisguise();

	// Minigun has custom handling
	if ( GetWeaponID() != TF_WEAPON_MINIGUN )
	{
		pPlayer->SpeakWeaponFire();
	}
	CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif

	// Set the weapon mode.
	m_iWeaponMode = TF_WEAPON_PRIMARY_MODE;

	SendWeaponAnim( ACT_VM_PRIMARYATTACK );

	pPlayer->SetAnimation( PLAYER_ATTACK1 );

	FireProjectile( pPlayer );

	m_flLastFireTime  = gpGlobals->curtime;

	// Set next attack times.
	m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;

	// Don't push out secondary attack, because our secondary fire
	// systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc)
	//m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;

	// Set the idle animation times based on the sequence duration, so that we play full fire animations
	// that last longer than the refire rate may allow.
	if ( Clip1() > 0 )
	{
		SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
	}
	else
	{
		SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
	}

	// Check the reload mode and behave appropriately.
	if ( m_bReloadsSingly )
	{
		m_iReloadMode.Set( TF_RELOAD_START );
	}
}	
Ejemplo n.º 8
0
void SFApp::OnUpdateWorld() {
  
  
  if(gameover){
  
  }else{
  // Handles Player movement
  if(up){
  if(ups < 5.0f){
   ups += 0.05;
  }else{ups = 5.0f;}
  }else if(ups > 0){
   ups -= 0.05;
  }else{ups = 0;}

  if(down){
   if(downs < 5.0f){
   downs += 0.05;
  }else{downs = 5.0f;}
  }else if(downs > 0){
   downs -= 0.05;
  }else{downs = 0;}

  if(left){
   if(lefts < 5.0f){
   lefts += 0.05;
  }else{lefts = 5.0f;}
  }else if(lefts > 0){
   lefts -= 0.05;
  }else{lefts = 0;}

  if(right){
   if(rights < 5.0f){
   rights += 0.05;
  }else{rights = 5.0f;}
  }else if(rights > 0){
   rights -= 0.05;
  }else{rights = 0;}

  player->GoNorth(ups);
  for(auto w: walls){
    if(w->CollidesWith(player)){
      player->GoSouth(ups);
      ups = 0;
    }
  }

  player->GoSouth(downs);
  for(auto w: walls){
    if(w->CollidesWith(player)){
      player->GoNorth(downs);
      downs = 0;
    }
  }

  player->GoWest(lefts);
  for(auto w: walls){
    if(w->CollidesWith(player)){
      player->GoEast(lefts);
      lefts = 0;
    }
  }

  player->GoEast(rights);
  for(auto w: walls){
    if(w->CollidesWith(player)){
      player->GoWest(rights);
      rights = 0;
    }
  }


  //Handles adding projectiles and moving them

  if(fired){
   if(fire % firespeed == 0){
   FireProjectile();
   }
  fire ++;
  }

  for(auto p: projectiles) {
    p->GoNorth(projectilespeed);
  }

  //collect coin pick ups
  for(auto c: coins) {
    if(c->CollidesWith(player)){
      c->HandleCollision();
      switch(c->getCode()){
      case FASTSHOOT:
       cout << "FAST SHOOT" << endl;
     // firespeed = 5;
     fastshoot = 300;
      break;
      case HEALTH:
       cout << "HEALTH" << endl;
        health += 10;
        if(health > 100){
        health = 100;
        }
        healthgreenpos.h = (444/100)*health;
        healthgreenpos.y = healthpos.y + 3 + (444-healthgreenpos.h);
      break;
      case SLOWALIENS:
      cout << "SLOW ALIENS" << endl;
      slowaliens = 300;
     // alienspeed /= 2;
      break;
      case CLEARALIENS:
      cout << "CLEAR ALIENS" << endl;
      for(auto a: aliens){
      a->HandleCollision();
      score ++;
        if(score % 100 == 0 && score > 0){
           maxAliens++;
           alienspeed += 0.01f;
         }
        if(score % 5 == 0 && score > 0){
        auto coin = make_shared<SFAsset>(SFASSET_COIN, sf_window);
  	auto pos  = a->GetPosition();
  	coin->SetPosition(pos);
  	coins.push_back(coin);
  	}
      }
      break;
      }
      
    }
  }


  if(fastshoot > 0){
  firespeed = 5;
  fastshoot --;
  }else{firespeed = 20;}
  
  if(slowaliens > 0){

  alienspeed = alientempspeed / 2;
  slowaliens --;
  }else{alienspeed = alientempspeed; alientempspeed = alienspeed;}
  
  //remove picked up coins
  list<shared_ptr<SFAsset>> tmp1;
  for(auto c : coins) {
    if(c->IsAlive()) {
      tmp1.push_back(c);
    }
  }
  coins.clear();
  coins = list<shared_ptr<SFAsset>>(tmp1);

  // Update enemy positions
  for(auto a : aliens) {
    a->GoSouth(alienspeed);
  }

  // Detect collisions
  
  for(auto a : aliens) {
    
    for(auto p : projectiles) {
      if(p->CollidesWith(a)) {
        p->HandleCollision();
        a->HandleCollision();
	score ++;
        if(score % 100 == 0 && score > 0){
           maxAliens++;
           alienspeed += 0.01f;
         }
        if(score % 5 == 0 && score > 0){
        auto coin = make_shared<SFAsset>(SFASSET_COIN, sf_window);
  	auto pos  = a->GetPosition();
  	coin->SetPosition(pos);
  	coins.push_back(coin);
  	}
      }
    }
    for(auto w: walls){
       if(w->CollidesWith(a)){
         a->HandleCollision();
         alienspeed += 0.01f;
	 score ++;
         if(score % 100 == 0 && score > 0){
           alienspeed += 0.01f;
           maxAliens++;
         }
       }
    }
    if(a->GetPosition().getY() < 0){
        health -= 10;
        healthgreenpos.h = (444/100)*health;
        healthgreenpos.y = healthpos.y + 3 + (444-healthgreenpos.h);
        a->HandleCollision();
      }
  }

  

  if(currentAliens < maxAliens){
    auto alien = make_shared<SFAsset>(SFASSET_ALIEN, sf_window);
    auto pos   = Point2(rand()% 640, 480 + (rand()%600));
    alien->SetPosition(pos);
    aliens.push_back(alien);
    currentAliens ++;
  }

  // remove dead aliens (the long way)
  list<shared_ptr<SFAsset>> tmp;
  for(auto a : aliens) {
    if(a->IsAlive()) {
      tmp.push_back(a);
    }else{
    auto explosion = make_shared<SFAsset>(SFASSET_EXPLOSION, sf_window);
    auto pos = a->GetPosition();
    explosion->SetPosition(pos);
    explosions.push_back(explosion);
    currentAliens--;}
  }
  aliens.clear();
  aliens = list<shared_ptr<SFAsset>>(tmp);

  //remove projectiles
   list<shared_ptr<SFAsset>> tmp2;
  for(auto p : projectiles) {
  if(p->GetPosition().getY() > 480){
    p->HandleCollision();
  }
    if(p->IsAlive()) {
      tmp2.push_back(p);
    }
  }
  projectiles.clear();
  projectiles = list<shared_ptr<SFAsset>>(tmp2);

  back.y +=8;
  back2.y +=8;

  if(back.y > 800){
   back.y = back2.y - 800;
  }
  
  if(back2.y > 800){
   back2.y = back.y - 800;
  }
  
  
  list<shared_ptr<SFAsset>> tmp3;
  for(auto e: explosions){
  e->addtoCounter();
  if(e->getCounter() > 20){
  e->HandleCollision();
  }
  if(e->IsAlive()){
  tmp3.push_back(e);
  }
  }
  explosions.clear();
  explosions = list<shared_ptr<SFAsset>>(tmp3);
  
  if(health <= 0){
  gameover = true;
  }
  
  }
}
Ejemplo n.º 9
0
void AWeapon::Fire()
{
	UCameraComponent* cameraComp = m_weaponCarrier->GetCameraComponent();
	// Shoot a projectile from the gun in the impact point's direction
	AMorphoProjectile* currentProjectile = FireProjectile(m_weaponOpening->GetComponentLocation(), cameraComp->GetForwardVector()) ;
}
Ejemplo n.º 10
0
void SFApp::OnUpdateWorld() {
  //Receive keyboard inputs simultaneously
  const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
  if(keyboardState[SDL_SCANCODE_DOWN]) {
    player->GoSouth();
  }
  if(keyboardState[SDL_SCANCODE_UP]) {
    player->GoNorth();
  }
  if(keyboardState[SDL_SCANCODE_LEFT]) {
    player->GoWest();
  }
  if(keyboardState[SDL_SCANCODE_RIGHT]) {
    player->GoEast();
  }
  if(keyboardState[SDL_SCANCODE_SPACE]) {
    FireProjectile();
  }
  // Update projectile positions
  for(auto p: projectiles) {
    p->BulletNorth();
  }

  for(auto c: coins) {
    c->WiggleTime();
  }

  // Update enemy positions
  for(auto a : aliens) {
    a->GoSouthSlow();
  }

  // Detect collisions
  for(auto p : projectiles) {
    for(auto a : aliens) {
      if(p->CollidesWith(a)) {
        a->HandleCollision();
	p->HandleCollision();
	cout << "Enemy down." << endl;// enemy planes destroy bullets
      }
    }
  }
  for(auto p : projectiles) {
    for(auto c : coins) {
      if(p->CollidesWith(c)) {
        c->HandleCollision();// pigeons don't destroy bullets
      }
    }
  }
  for(auto p : projectiles) {
    for(auto b : bars) {
      if(p->CollidesWith(b)) {
        p->HandleCollision();
      }
    }
  }
  for(auto a : aliens) {
    for(auto s : bases) {
      if(a->CollidesWith(s)) {
        cout << "An enemy plane reached your base! You lose." << endl;
	a->HandleCollision();
      }
    }
  }
    for(auto a : aliens) {
      if(player->CollidesWith(a)) {
	a->HandleCollision();
        cout << "Enemy crashed into you! You lose." << endl;
      }
  }
  
  // remove dead aliens (the long way)
  list<shared_ptr<SFAsset>> tmp;
  for(auto a : aliens) {
    if(a->IsAlive()) {
      tmp.push_back(a);
    }
  }
  aliens.clear();
  aliens = list<shared_ptr<SFAsset>>(tmp);
  // remove dead coins (pigeon)
  list<shared_ptr<SFAsset>> tmp2;
  for(auto c : coins) {
    if(c->IsAlive()) {
      tmp2.push_back(c);
    }
  }
  coins.clear();
  coins = list<shared_ptr<SFAsset>>(tmp2);
  // remove destroyed bullets
  list<shared_ptr<SFAsset>> tmp3;
  for(auto p : projectiles) {
    if(p->IsAlive()) {
      tmp3.push_back(p);
    }
  }
  projectiles.clear();
  projectiles = list<shared_ptr<SFAsset>>(tmp3);
}
Ejemplo n.º 11
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFWeaponBaseGun::PrimaryAttack( void )
{
	// Check for ammunition.
	if ( m_iClip1 <= 0 && UsesClipsForAmmo1() )
		return;

	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	if ( !CanAttack() )
		return;

	if ( m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize > 0 && m_iBurstSize == 0 )
	{
		// Start the burst.
		m_iBurstSize = m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize;
	}

	if ( m_iBurstSize > 0 )
	{
		m_iBurstSize--;
	}

	CalcIsAttackCritical();

#ifndef CLIENT_DLL
	pPlayer->RemoveInvisibility();
	pPlayer->RemoveDisguise();

	// Minigun has custom handling
	if ( GetWeaponID() != TF_WEAPON_MINIGUN )
	{
		pPlayer->SpeakWeaponFire();
	}
	CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif

	// Set the weapon mode.
	m_iWeaponMode = TF_WEAPON_PRIMARY_MODE;

	SendWeaponAnim( ACT_VM_PRIMARYATTACK );

	pPlayer->SetAnimation( PLAYER_ATTACK1 );

	FireProjectile( pPlayer );

	m_flLastFireTime = gpGlobals->curtime;

	// Set next attack times.
	float flFireDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
	CALL_ATTRIB_HOOK_FLOAT( flFireDelay, mult_postfiredelay );

	m_flNextPrimaryAttack = gpGlobals->curtime + flFireDelay;

	// Don't push out secondary attack, because our secondary fire
	// systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc)
	//m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;

	// Set the idle animation times based on the sequence duration, so that we play full fire animations
	// that last longer than the refire rate may allow.
	SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );

	AbortReload();
}	
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFPipebombLauncher::LaunchGrenade( void )
{
	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	StopSound("Weapon_StickyBombLauncher.ChargeUp");

	CalcIsAttackCritical();

	SendWeaponAnim( ACT_VM_PRIMARYATTACK );

	pPlayer->SetAnimation( PLAYER_ATTACK1 );
	pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

	CTFGrenadePipebombProjectile *pProjectile = static_cast<CTFGrenadePipebombProjectile*>( FireProjectile( pPlayer ) );
	if ( pProjectile )
	{
		// Save the charge time to scale the detonation timer.
		pProjectile->SetChargeTime( gpGlobals->curtime - m_flChargeBeginTime );
	}
#if !defined( CLIENT_DLL ) 
	pPlayer->SpeakWeaponFire();
	CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif

	// Set next attack times.
	m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
	m_flLastDenySoundTime = gpGlobals->curtime;

	SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );

	// Check the reload mode and behave appropriately.
	if ( m_bReloadsSingly )
	{
		m_iReloadMode.Set( TF_RELOAD_START );
	}

	m_flChargeBeginTime = 0;
}
Ejemplo n.º 13
0
/**
 * Handle all events that come from SDL.
 * These are timer or keyboard events.
 */
void SFApp::OnEvent(SFEvent& event) {
  SFEVENT the_event = event.GetCode();
  switch (the_event) {
  case SFEVENT_QUIT:
    is_running = false;
    break;
  case SFEVENT_UPDATE:
    OnUpdateWorld();
    OnRender();
    break;

  case SFEVENT_PLAYER_UP:
    player->GoNorth();

    for(auto w : walls) {
      for(auto c : coins) {
	for(auto a : aliens) {

      if(player->CollidesWith(w)) {
	 player->GoSouth();
	} else if (player->CollidesWith(c)) {

	 std::wstring s1(L"You Win");
	 std::wcout << s1 << std::endl;

	is_running = false;
	} else if (player->CollidesWith(a)) {

	 std::wstring s2(L"You Lose");
	 std::wcout << s2 << std::endl;
	 is_running = false;
	}
	}
    }}
 
    break;
    
  case SFEVENT_PLAYER_DOWN:
    player->GoSouth();

    for(auto w : walls) {
      for(auto c : coins) {
	for(auto a : aliens) {

      if(player->CollidesWith(w)) {
	 player->GoNorth();
	} else if (player->CollidesWith(c)) {

	 std::wstring s1(L"You Win");
	 std::wcout << s1 << std::endl;

	is_running = false;
	} else if (player->CollidesWith(a)) {

	 std::wstring s2(L"You Lose");
	 std::wcout << s2 << std::endl;
	 is_running = false;
	}
	}
    }}
 
    break;
    
  case SFEVENT_PLAYER_LEFT:
    player->GoWest();

    for(auto w : walls) {
      for(auto c : coins) {
	for(auto a : aliens) {

      if(player->CollidesWith(w)) {
	 player->GoEast();
	} else if (player->CollidesWith(c)) {

	 std::wstring s1(L"You Win");
	 std::wcout << s1 << std::endl;

	is_running = false;
	} else if (player->CollidesWith(a)) {

	 std::wstring s2(L"You Lose");
	 std::wcout << s2 << std::endl;
	 is_running = false;
	}
	}
    }}
 
    break;
    
  case SFEVENT_PLAYER_RIGHT:
    player->GoEast();
    
      for(auto w : walls) {
      for(auto c : coins) {
	for(auto a : aliens) {

      if(player->CollidesWith(w)) {
	 player->GoWest();
	} else if (player->CollidesWith(c)) {

	 std::wstring s1(L"You Win");
	 std::wcout << s1 << std::endl;

	is_running = false;
	} else if (player->CollidesWith(a)) {

	 std::wstring s2(L"You Lose");
	 std::wcout << s2 << std::endl;
	 is_running = false;


	}
	}
    }}
 
    break;

// Win/Lose Message seems to be printed a large number of times, but not always the same amount
// I think this may have to do with the collision.
// I needed to abandon a score/points related victory as it seemed that the game was detecting
// multiple hits per projectile, 1 bullet was hitting 10+ times, as it passed through an object coin/alien
// this meant that my scoring threshold for victory was being met in 1-2 shots.
// as the number of times that each target was hit seemed to vary
// i could not use a work around of just increasing the score limit, as sometimes this limit would/would not
// be reached. As such, i opted to make the victory condition simply to collect a coin.
// it appears that the player is comming into contact with the victory coin, many times before the game closes.

   
  case SFEVENT_FIRE:
    fire ++;
    FireProjectile();
    break;

// Unable to figure this out I haven't left myself enough time to have a proper go at it.

/*  case SFEVENT_MOVE1:
  for(auto a : aliens) {
  a->Move1();
  break;
}
  case SFEVENT_MOVE2:
  for(auto a : aliens) { 
  a->Move2();
  break;
}

*/

  }
}