示例#1
0
文件: Player.cs 项目: Jamsterx1/Titan
        public Player(Vector2f _position, String _file, GameWorld _world)
        {
            create(_position, _file, 1);
            mWorld      = _world;

            mEntityType = EntityType.Player;
            mHealth     = 100;
            mSegment    = 10;

            mInvicible = false;
            mOnce      = false;
            mTimer     = new Stopwatch();

            mShoot     = new Stopwatch();
            mShoot.Start();

            for (int i = 0; i < 11; i++)
            {
                Texture tex = new Texture("resources/health/health" + i + ".png");
                mHealthBar[i] = new Sprite(tex);

                Vector2f pos = new Vector2f();
                pos.X -= 17f;
                pos.Y -= 10f;
                mHealthBar[i].Position = mPosition - pos;
            }
        }
示例#2
0
 public void create(Player _target, GameWorld _world, World _physics)
 {
     mPlayer = _target;
     mPhysicsWorld = _physics;
     mWorld = _world;
     mWorld.add(spawn());
 }
示例#3
0
文件: Boss.cs 项目: Jamsterx1/Titan
 public Boss(Vector2f _position, String _file, Entity _target, GameWorld _world, uint _layer = 0)
 {
     create(_position, _file, _layer);
     mHealth     = 1000;
     mWorld      = _world;
     mEntityType = EntityType.Boss;
     mTarget     = _target;
 }
示例#4
0
文件: Enemy.cs 项目: Jamsterx1/Titan
        public Enemy(Vector2f _position, String _file, Entity _target, GameWorld _world, uint _layer = 2)
        {
            create(_position, _file, _layer);
            mTimer.Start();
            mDie.Start();

            mWorld      = _world;
            mEntityType = EntityType.Enemy;
            mState      = AIState.Chase;
            mTarget     = _target;
            mMovement   = new Vector2f();
            mHealth     = 3;
        }
示例#5
0
        public Spawner(float _x, float _y, World _physics = null, GameWorld _world = null, Player _target = null)
        {
            mPosition.X   = _x;
            mPosition.Y   = _y;
            mPlayer       = _target;
            mPhysicsWorld = _physics;
            mWorld        = _world;
            mCount        = 0;

            mTimer = new Stopwatch();
            mRandom = new Random();
            mTimer.Start();
        }
示例#6
0
        public static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(1280, 720), "Titan");
            GameWorld game = new GameWorld();

            game.createWorld();
            window.Closed += (sender, eventArgs) => window.Close();
            window.SetFramerateLimit(60);

            while (window.IsOpen())
            {
                window.DispatchEvents();
                game.update(window);
                game.render(window);
                window.Display();
            }
        }