| using System;
using System.Collections.Generic;
 using System.Linq;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Audio;
 using Microsoft.Xna.Framework.Content;
 using Microsoft.Xna.Framework.GamerServices;
 using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Media;
 using Microsoft.Xna.Framework.Net;
 using Microsoft.Xna.Framework.Storage;
 
 namespace Civilian_Killer
 {
 
 public class Game1 : Microsoft.Xna.Framework.Game
 {
 GraphicsDeviceManager graphics;
 SpriteBatch spriteBatch;
 
 public Game1()
 {
 graphics = new GraphicsDeviceManager(this);
 Content.RootDirectory = "Content";
 }
 //game variables go here *****************************************************************************************
 int i = 0;
 Vector2 moveStick = new Vector2(1, 1);
 Vector2 cross= new Vector2(1,1);
 int sensitivity = 5;
 int shot = 0;
 Vector2 crossor = new Vector2(25, 25);
 Vector2 Bullet = new Vector2(750, 600);
 int ammo = 6;
 int reloadWait = 0;
 int maxammo = 6;
 float zoom = 10;
 int screenx = 0;
 int screeny = 0;
 int delay = 0;
 
 // here are the civilian variables {lots eh}
 int civilians = 10;
 int[] num = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 int[] count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 int[] health = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 Color color = Color.White;
 Vector2 origin1 = new Vector2(30, 25);
 float[] x = { 100, 200, 300, 400, 500, 176, 234, 543, 423, 532 };
 float[] y = { 100, 200, 300, 400, 500, 54, 432, 325, 287, 196 };
 float[] xvel = { -10, -12, -14, -16, -18, 10, 12, 14, 16, 18 };
 float[] yvel = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 string[] dir = { "left", "left", "left", "left", "left", "right", "right", "right", "right", "right" };
 SpriteEffects spriteEffect = SpriteEffects.None;
 //end of game variables *******************************************************************************************
 //alright now the functions for the game
 private void UpdateCivilians(){
 for (i = 0; i < civilians; i++)
 {
 count[i]++;
 if (count[i] == 10)
 {
 num[i]++;
 count[i] = 1;
 x[i] += xvel[i];
 y[i] += yvel[i];
 if (xvel[i] > 0)
 {
 dir[i] = "right";
 }
 else
 {
 dir[i] = "left";
 }
 if (num[i] == 7)
 num[i] = 1;
 }
 if (x[i] > 10000)
 {
 x[i] = 0;
 }
 if (x[i] < 0)
 {
 x[i] = 10000;
 }
 }
 /*position1 = new Vector2(x[0], y[0]);
 position2 = new Vector2(x[1], y[1]);
 position3 = new Vector2(x[2], y[2]);
 position4 = new Vector2(x[3], y[3]);
 position5 = new Vector2(x[4], y[4]);*/
 }
 
 
 private void civilianDraw()
 {
 for (i = 0; i < civilians; i++)
 {
 Texture2D texture2D = Content.Load<Texture2D>("images/ash" + dir[i] + num[i]);
 if (health[i] > 0)
 {
 spriteBatch.Draw(texture2D, new Vector2((x[i]/zoom)-screenx, (y[i]/zoom)-screeny), null, color, 0, origin1, 1/zoom, spriteEffect, 0.5f);
 }
 }
 }
 
 
 private void ammoDraw()
 {
 Texture2D bullet = Content.Load<Texture2D>("images/bullet");
 for (i = 0; i < maxammo; i++)
 {
 if (ammo > i)
 {
 spriteBatch.Draw(bullet, Bullet-new Vector2(0,(5*i)), null, Color.White, 0, origin1, 0.5f, spriteEffect, 1f);
 }
 if (i != maxammo)
 {
 if (reloadWait > 1)
 {
 spriteBatch.Draw(bullet, Bullet - new Vector2(0, (5 * i)), null, Color.Red, 0, origin1, 0.5f, spriteEffect, 1f);
 }
 }
 }
 }
 
 
 private void reload()
 {
 if (GamePad.GetState(PlayerIndex.One).Buttons.RightShoulder == ButtonState.Pressed)
 {
 reloadWait = 80;
 }
 if (reloadWait == 0)
 {
 ammo = maxammo;
 reloadWait = -1;
 }
 if (reloadWait > 0)
 {
 reloadWait -= 1;
 }
 }
 
 
 private void shoot()  //here's where the problem is I think.
 {
 if (shot < -20 && reloadWait<0)
 {
 if (ammo > 0)
 {
 ammo -= 1;
 shot = 5;
 GamePad.SetVibration(PlayerIndex.One, 1f, 1f);
 //moveStick.X
 for (i = 0; i < civilians; i++)
 {
 if (x[i] + 25 > cross.X + 25)
 {
 if (x[i] - 25 < cross.X + 25)
 {
 if (y[i] + 25 > cross.Y + 25)
 {
 if (y[i] - 25 < cross.Y + 25)
 health[i] -= 1;
 }
 }
 }
 }
 }
 }
 }
 //end of functions ************************************************************************************************
 
 protected override void Initialize()
 {
 base.Initialize();
 }
 
 protected override void LoadContent()
 {
 // Create a new SpriteBatch, which can be used to draw textures.
 spriteBatch = new SpriteBatch(GraphicsDevice);
 }
 protected override void UnloadContent()
 {
 }
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
 //menu();
 UpdateCivilians();
 
 // Allows the game to exit
 moveStick = GamePad.GetState(PlayerIndex.One).ThumbSticks.Left;
 cross.X += (moveStick.X * sensitivity);
 cross.Y += -(moveStick.Y * sensitivity);
 if (shot == 0) GamePad.SetVibration(PlayerIndex.One, 0f, 0f);
 reload();
 if (GamePad.GetState(PlayerIndex.One).Triggers.Right > 0.1)
 {
 shoot();
 }
 shot -= 1;
 if (shot==-100){
 shot = -30;
 }
 if (delay > 0) delay -= 1;
 if (delay == 0)
 {
 if (GamePad.GetState(PlayerIndex.One).Triggers.Left > 0.1)
 {
 zoom -= 1;
 delay = 10;
 }
 if (GamePad.GetState(PlayerIndex.One).Buttons.LeftShoulder ==ButtonState.Pressed)
 {
 zoom += 1;
 delay = 10;
 }
 if (zoom < 1) zoom = 1;
 if (zoom > 10) zoom = 10;
 }
 
 
 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
 this.Exit();
 
 // TODO: Add your update logic here
 if (cross.X > screenx + 800) screenx += 10;
 if (cross.X < screenx) screenx -= 10;
 if (cross.Y < screeny) screeny -= 10;
 if (cross.Y > screeny + 600) screeny += 10;
 base.Update(gameTime);
 }
 
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(GameTime gameTime)
 {
 GraphicsDevice.Clear(Color.LawnGreen);
 
 spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
 Texture2D bg = Content.Load<Texture2D>("images/grass");
 Texture2D crosshair = Content.Load<Texture2D>("images/crosshairs");
 Texture2D shots = Content.Load<Texture2D>("images/shot");
 for (i = 0; i < 3; i++)
 {
 spriteBatch.Draw(bg, new Vector2(-screenx,-screeny), null, Color.White, 0, origin1, 5f / zoom, spriteEffect, 0f);
 }
 if (shot>0){
 spriteBatch.Draw(shots, new Vector2(cross.X + crossor.X + 5 - screenx, cross.Y + crossor.Y + 2-screeny), null, Color.White, 0, origin1, 1.0f, spriteEffect, 0.7f);
 }
 
 spriteBatch.Draw(crosshair, new Vector2(cross.X-screenx,cross.Y-screeny), null, Color.White, 0, crossor, 0.5f, spriteEffect, 0.6f);
 civilianDraw();
 ammoDraw();
 
 spriteBatch.End();
 // TODO: Add your drawing code here
 
 base.Draw(gameTime);
 }
 }
 }
 
 |