コード例 #1
0
        // Add the player's character to the game
        public void AddPlayer(CharacterPlayer character)
        {
            PlayerCharacter.PlayerSpriteAttack = PlayerCharacter.PlayerImage1;
            Characters.Add(character);

            cameraNode.Parent = character.WorldNode;
        }
コード例 #2
0
        // Create the player object
        // <x> world x position
        // <y> world y position
        private void CreatePlayer(float x, float y)
        {
            Sprite2D        shieldSprite = ResourceCache.GetSprite2D("shield.png");
            CharacterPlayer player       = new CharacterPlayer(charClass, 10);

            if (schaubMode)
            {
                player.PlayerImage1       = ResourceCache.GetSprite2D("characters/cheat.png");
                player.PlayerSpriteAttack = player.PlayerImage1;
                player.CreateNode(scene, player.PlayerSpriteAttack, shieldSprite, new Vector2(x, y));
                Characters.Add(player);

                cameraNode.Parent = player.WorldNode;
                PlayerCharacter   = player;
                return;
            }

            player.CreateNode(scene, player.PlayerSpriteAttack, shieldSprite, new Vector2(x, y));
            PlayerCharacter = player;
            AddPlayer(player);
        }