diff --git a/Snake.Avalonia/Views/AnimationHelper.cs b/Snake.Avalonia/Views/AnimationHelper.cs index 55426a1..f11c590 100644 --- a/Snake.Avalonia/Views/AnimationHelper.cs +++ b/Snake.Avalonia/Views/AnimationHelper.cs @@ -75,9 +75,11 @@ public static class AnimationHelper else { // When not growing: tail removed, new head added. - // current[0] = new head, current[1] = old head, etc. - // current[i] (i>=1) was at old[i-1] - var prevIdx = segmentIndex - 1; + // current[0] = new head, current[1] = old head, … current[N-2] = old[N-3] + // BUT the last segment (tail): it was old[N-1] (the removed tail's position) + // because visually it slides from where the old tail was. + var isLast = segmentIndex == currentSegments.Count - 1; + var prevIdx = isLast ? segmentIndex : segmentIndex - 1; if (prevIdx < previousSegments.Count) return previousSegments[prevIdx]; } diff --git a/publish/Snake.Avalonia b/publish/Snake.Avalonia new file mode 100755 index 0000000..e97e7ee Binary files /dev/null and b/publish/Snake.Avalonia differ