From d312cf14976ce7b9e042726a27732e8dab7d0563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 11 Sep 2018 11:00:27 +0200 Subject: [PATCH] Look at changes --- demo3.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/demo3.cpp b/demo3.cpp index 95f9e9f..3af0e04 100644 --- a/demo3.cpp +++ b/demo3.cpp @@ -463,10 +463,20 @@ int main() colorAddition = -1; } - if (editing && editCounter == 0) + if (editing) { - changes[changeIndex].mColor = wrap(changes[changeIndex].mColor + colorAddition,SQUARE_COLORS); - editCounter = 4; + int16_t heightDiff = changes[changeIndex].mHeight - player.mCamera.height; + + if (heightDiff > UNITS_PER_SQUARE / 2) + shearDirection = 1; + else if (heightDiff < -1 * UNITS_PER_SQUARE / 2) + shearDirection = -1; + + if (editCounter == 0 && colorAddition != 0) + { + changes[changeIndex].mColor = wrap(changes[changeIndex].mColor + colorAddition,SQUARE_COLORS); + editCounter = 4; + } } editCounter = max(0, editCounter - 1);