Beispiel #1
0
        public Player()
        {
            this.speed = new Vector2D(3, 3);
            this.position = new Vector2D(10, 10);

            animation = AnimationGroupManager.GetAnimationGroup("player_animation");
            animation.SetCurrentAnimation("player_up");

            Program.RenderWindow.KeyPressed += RenderWindow_KeyPressed;
            Program.RenderWindow.KeyReleased += RenderWindow_KeyReleased;
        }
Beispiel #2
0
        public Character(Vector2D position, Vector2D speed, DirectionAnimationCouple animationCouples,
            World world, string animation, int collisionLayer)
            : base(position)
        {
            this.collisionLayer = collisionLayer;
            this.world = world is LayeredWorld ? (LayeredWorld)world : world;

            this.speed = speed;
            this.position = position;
            this.animationCouples = animationCouples;
            this.animation = AnimationGroupManager.GetAnimationGroup(animation);

            this.animation.CurrentAnimation = animationCouples[Direction.Down];
        }
Beispiel #3
0
 public static void AddAnimationGroup(string name, AnimationGroup animationGroup)
 {
     ExceptionHelper.AssertIsNotInDictionary <AnimationGroup>(animationGroups, name, "AGM.AddAnimationGroup()");
     animationGroups.Add(name, animationGroup);
 }
        private static void LoadAnimationGroup(string line)
        {
            string[] parts = line.Replace("animation_group:", "").Split(',');
            string name = parts[NAME];

            ExceptionHelper.AssertIsNotInDictionary<AnimationGroup>(animationGroups, name, "AGM.LoadAnimationGroup()");

            int interval = int.Parse(parts[INTERVAL]);
            int framesOnX = int.Parse(parts[FRAMES_ON_X]);
            int framesOnY = int.Parse(parts[FRAMES_ON_Y]);
            int frameWidth = int.Parse(parts[FRAME_WIDTH]);
            int frameHeight = int.Parse(parts[FRAME_HEIGHT]);
            string frameset = parts[FRAME_SET];
            int[] references = GetReferences(parts);

            AnimationGroup group = new AnimationGroup(
                    interval, framesOnX, framesOnY, frameset,
                    new Vector2D(frameWidth, frameHeight), references
                );

            animationGroups.Add(name, group);
        }
 public static void AddAnimationGroup(string name, AnimationGroup animationGroup)
 {
     ExceptionHelper.AssertIsNotInDictionary<AnimationGroup>(animationGroups, name, "AGM.AddAnimationGroup()");
     animationGroups.Add(name, animationGroup);
 }
Beispiel #6
0
 public AnimatedTile(bool isHollow, string animation, Vector2D position)
     : base(isHollow, "cmd:none", position)
 {
     this.animation = AnimationGroupManager.GetAnimationGroup(animation);
     this.animation.Position = CoordinateSystemConverter.WorldToPixels(position).InternalVector;
 }