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; } }
public void create(Player _target, GameWorld _world, World _physics) { mPlayer = _target; mPhysicsWorld = _physics; mWorld = _world; mWorld.add(spawn()); }
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; }
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; }
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(); }
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(); } }