Compare commits
2 Commits
aa2016cc40
...
9dd304811b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dd304811b | ||
|
|
dcb65831ac |
@@ -75,9 +75,11 @@ public static class AnimationHelper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// When not growing: tail removed, new head added.
|
// When not growing: tail removed, new head added.
|
||||||
// current[0] = new head, current[1] = old head, etc.
|
// current[0] = new head, current[1] = old head, … current[N-2] = old[N-3]
|
||||||
// current[i] (i>=1) was at old[i-1]
|
// BUT the last segment (tail): it was old[N-1] (the removed tail's position)
|
||||||
var prevIdx = segmentIndex - 1;
|
// 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)
|
if (prevIdx < previousSegments.Count)
|
||||||
return previousSegments[prevIdx];
|
return previousSegments[prevIdx];
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
publish/Snake.Avalonia
Executable file
BIN
publish/Snake.Avalonia
Executable file
Binary file not shown.
Reference in New Issue
Block a user