[ create a new paste ] login | about

Link: http://codepad.org/YRwh7hOw    [ raw code | output | fork ]

C++, pasted on Nov 4:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Audio;

namespace Application
{
	public class Player
	{
		protected Vector2 position = Vector2.Zero;
		protected Texture2D texture = null;
		protected SoundEffect shootSfx;


		protected float speed = 200.0f;



		protected float cooldownTimer = 0;

		protected bool isDead = false;

		public bool IsDead 

		{
			get { return isDead; }
			set { isDead = value; }
		}

		public Rectangle Bounds

		{
			get {return new Rectangle ((int)position.X,(int) position.Y, texture.Bounds.Width,texture.Bounds.Height);}

		}

		public Texture2D Texture 

		{
			get { return texture; }
			set { texture = value; }
		}

		public Vector2 Position 

		{
			get { return position; }
			set { position = value; }
		}

		public SoundEffect ShootSfx 

		{
			set { shootSfx = value; }
		}

		public Player ()
		{
		}
			
	
				
			
						
		public void Update (float deltaTime )
		{
			if (Keyboard.GetState ().IsKeyDown (Keys.Left))
				position.X -= speed * deltaTime;

			if (Keyboard.GetState ().IsKeyDown (Keys.Right))
				position.X += speed * deltaTime;

			if (Keyboard.GetState ().IsKeyDown (Keys.Up))
				position.Y -= speed * deltaTime;

			if (Keyboard.GetState ().IsKeyDown (Keys.Down))
				position.Y += speed * deltaTime;
			
			if (cooldownTimer > 0)
				cooldownTimer -= deltaTime;

			if (Keyboard.GetState ().IsKeyDown (Keys.Space)) {
				if (cooldownTimer <= 0) {
					foreach (Bullet b in Game1.Bullets) {

						if (b.IsDead == true)
						 {
							b.IsDead = false;
							b.isFromPlayer = true;
							b.Position = Position;
							shootSfx.Play ();
							break;
											
						}
					}

						
					cooldownTimer = 0.3f;
				}
		
					
			}

		}			

		public void Draw (SpriteBatch spriteBatch)

		{

			foreach (Bullet b in Game1.Bullets)
			{

			if (isDead == true)
				return;
			if (texture == null)
				return;

			spriteBatch.Draw (texture, position, Color.White);

		}


			
		}
	}
}


Output:
1
2
Line 1: error: expected nested-name-specifier before 'System'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: