From 362f41d3d2d1baa0530e6ca50bf234f15ce9a484 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 14 Jul 2017 12:21:17 -0400 Subject: [PATCH] gamnit: fix animations with a single frame MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/flat/flat_core.nit | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/gamnit/flat/flat_core.nit b/lib/gamnit/flat/flat_core.nit index 6cd0411..800b3de 100644 --- a/lib/gamnit/flat/flat_core.nit +++ b/lib/gamnit/flat/flat_core.nit @@ -1211,8 +1211,12 @@ private class SpriteContext data[o+36] = tc[v*2+1] # a_tex_diff - var dx = animation.frames[1].texture_coords[0] - animation.frames[0].texture_coords[0] - var dy = animation.frames[1].texture_coords[1] - animation.frames[0].texture_coords[1] + var dx = 0.0 + var dy = 0.0 + if animation.frames.length > 1 then + dx = animation.frames[1].texture_coords[0] - animation.frames[0].texture_coords[0] + dy = animation.frames[1].texture_coords[1] - animation.frames[0].texture_coords[1] + end data[o+37] = dx data[o+38] = dy -- 1.7.9.5