Example #1
0
        public EnemyEntity(ThrongGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            // Calculate what entity type to attack.
            CurrentState = State.WanderAimless;
            MovementSpeed = SLOW_SPEED;
            EntityType = Type.Enemy;
            HitPlayer = false;
            HitEgg = false;

            DynamicBody.OnCollision += CollisionHandler;
            FindNearestTarget();

            _animations[new AnimKey(AnimState.Idle, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("idle-left");
            _animations[new AnimKey(AnimState.Idle, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("right-right");

            _animations[new AnimKey(AnimState.Run, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("run-right");
            _animations[new AnimKey(AnimState.Run, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("run-left");

            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("attack-right");
            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("attack-left");

            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Right)] = clip.AnimSet.CreateSubSet(true, "hitA-right", "hitB-right", "hitC-right");
            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Left)] = clip.AnimSet.CreateSubSet(true, "hitA-left", "hitB-left", "hitC-left");

            _animations[new AnimKey(AnimState.Death, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("death-right");
            _animations[new AnimKey(AnimState.Death, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("death-left");

            PlayNewEnemyAnimation();
        }
Example #2
0
        public EnemyEntity(ThrongGameScreen gameScreen, Clip clip,
                           Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            // Calculate what entity type to attack.
            CurrentState  = State.WanderAimless;
            MovementSpeed = SLOW_SPEED;
            EntityType    = Type.Enemy;
            HitPlayer     = false;
            HitEgg        = false;


            DynamicBody.OnCollision += CollisionHandler;
            FindNearestTarget();

            _animations[new AnimKey(AnimState.Idle, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("idle-left");
            _animations[new AnimKey(AnimState.Idle, AnimationDirection.Left)]  = clip.AnimSet.CreateSingleAnimSet("right-right");

            _animations[new AnimKey(AnimState.Run, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("run-right");
            _animations[new AnimKey(AnimState.Run, AnimationDirection.Left)]  = clip.AnimSet.CreateSingleAnimSet("run-left");

            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("attack-right");
            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Left)]  = clip.AnimSet.CreateSingleAnimSet("attack-left");

            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Right)] = clip.AnimSet.CreateSubSet(true, "hitA-right", "hitB-right", "hitC-right");
            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Left)]  = clip.AnimSet.CreateSubSet(true, "hitA-left", "hitB-left", "hitC-left");

            _animations[new AnimKey(AnimState.Death, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("death-right");
            _animations[new AnimKey(AnimState.Death, AnimationDirection.Left)]  = clip.AnimSet.CreateSingleAnimSet("death-left");

            PlayNewEnemyAnimation();
        }
Example #3
0
        // TODO: refactor this to use the content manager for retrieving
        // different enemy types ..
        public EnemySpawner(ThrongGameScreen gameScreen, Clip clip)
        {
            _gameScreen            = gameScreen;
            _secondsSinceLastSpawn = 0f;
            _minDistFromPlayer     = 10f;
            _clip = clip;

            // spawn every 5sec
            SpawnInterval = 5f;
        }
Example #4
0
        // TODO: refactor this to use the content manager for retrieving
        // different enemy types ..
        public EnemySpawner(ThrongGameScreen gameScreen, Clip clip)
        {
            _gameScreen = gameScreen;
            _secondsSinceLastSpawn = 0f;
            _minDistFromPlayer = 10f;
            _clip = clip;

            // spawn every 5sec
            SpawnInterval = 5f;
        }
Example #5
0
        public CharacterEntity(ThrongGameScreen gameScreen, Clip clip,
                               Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius)
        {
            ClipInstance   = new ClipInstance(clip);
            GameScreen     = gameScreen;
            Position       = position; Scale = scale; Rotation = rotation;
            _physicsRadius = physicsRadius;
            _physicsOffset = physicsOffset;
            IsValid        = true;

            SetupDynamics();
        }
Example #6
0
        public CharacterEntity(ThrongGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius)
        {
            ClipInstance = new ClipInstance(clip);
            GameScreen = gameScreen;
            Position = position; Scale = scale; Rotation = rotation;
            _physicsRadius = physicsRadius;
            _physicsOffset = physicsOffset;
            IsValid = true;

            SetupDynamics();
        }
Example #7
0
        public PlayerEntity(ThrongGameScreen gameScreen, Clip clip,
                            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            EntityType = Type.Player;

            _animDirection = AnimationDirection.Right;

            LoadSounds(gameScreen.Content);

            SetupAnimations(clip);

            SwitchToIdle();
        }
Example #8
0
        public EggEntity(ThrongGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            _clip = clip;

            EntityType = Type.Egg;
            CurrentState = State.Idle;

            InitialiseAnimations();
            PlayNewEggAnimation();

            //_sfxExplode = gameScreen.Content.Load<SoundEffect>("Sounds/Explode 1");
        }
Example #9
0
        public EggEntity(ThrongGameScreen gameScreen, Clip clip,
                         Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            _clip = clip;

            EntityType   = Type.Egg;
            CurrentState = State.Idle;

            InitialiseAnimations();
            PlayNewEggAnimation();

            //_sfxExplode = gameScreen.Content.Load<SoundEffect>("Sounds/Explode 1");
        }
Example #10
0
        public PlayerEntity(ThrongGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            EntityType = Type.Player;

            _animDirection = AnimationDirection.Right;

            LoadSounds(gameScreen.Content);

            SetupAnimations(clip);

            SwitchToIdle();
        }
Example #11
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Example #12
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f, Vector2.Zero, 1.0f)
 {
 }
Example #13
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }
Example #14
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
                        Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f, Vector2.Zero, 1.0f)
 {
 }
Example #15
0
 public EnemyEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
                    Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Example #16
0
 public EnemyEntity(ThrongGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Example #17
0
 void LoadMainGameScreen(object asyncState)
 {
     _gameScreen = new ThrongGameScreen(this);
     _inactiveScreens.Add(_gameScreen);
     _startScreen.IsGameLoaded = true;
 }
Example #18
0
 public EnemyEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }
Example #19
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }
Example #20
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Example #21
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }