コード例 #1
0
ファイル: Bullet.cs プロジェクト: nicolebranagan/aspectstar
        public Bullet(Map map, Vector2 loc, Game1.Directions dir, Game1.Aspects asp)
        {
            currentMap = map;
            location = loc;
            moveDir = dir;
            aspect = asp;
            inert = false;

            texture = new Rectangle(0, (int)asp * 6, 6, 6);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: nicolebranagan/aspectstar
        public Player(Texture2D texture, Vector2 loc, Map map)
        {
            currentMap = map;

            Texture = texture;
            location = loc;
            currentFrame = 0;
            stallCount = 0;

            faceDir = Game1.Directions.Down;
            moving = false;

            aspect = Game1.Aspects.Blue;
        }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: nicolebranagan/aspectstar
        public Enemy(EnemyDef ident, Vector2 loc, Map map, GameScreen screen, Game1.Aspects aspect = Game1.Aspects.None)
        {
            this.identity = ident;
            this.location = loc;
            this.currentMap = map;
            this.currentScreen = screen;

            this.faceDir = Game1.Directions.Down;
            this.currentFrame = 0;
            this.stallCount = 0;

            if (aspect == Game1.Aspects.None)
                this.aspect = (Game1.Aspects)r.Next(0, 3);
            else
                this.aspect = aspect;
        }
コード例 #4
0
ファイル: Enemy.cs プロジェクト: nicolebranagan/aspectstar
        public void Update(Vector2 target)
        {
            if (stallCount % identity.beSlow == 0) // Slowness
            {
                if (r.Next(10) > identity.beIndecisive) // Indecisive
                    this.Move(faceDir);
                else
                {
                    if (r.Next(10)>identity.beWanderer)
                    {
                        // Move towards the target
                        int x_tar = (int)(location.X - target.X);
                        int y_tar = (int)(location.Y - target.Y);
                        Game1.Directions targetDir;
                        if (Math.Abs(x_tar) > Math.Abs(y_tar))
                        {
                            if (x_tar > 0)
                                targetDir = Game1.Directions.Left;
                            else
                                targetDir = Game1.Directions.Right;
                        }
                        else
                        {
                            if (y_tar > 0)
                                targetDir = Game1.Directions.Up;
                            else
                                targetDir = Game1.Directions.Down;
                        }
                        this.faceDir = targetDir;
                    }
                    else
                        faceDir = (Game1.Directions)r.Next(0, 4);
                }
            }

            stallCount++;
            if (stallCount == 10)
            {
                currentFrame++;
                stallCount = 0;
            }
            if (currentFrame == 2)
                currentFrame = 0;
        }