From 7f79b2e216617ff74ebd41ac02663b20ef3d0904 Mon Sep 17 00:00:00 2001 From: tom Date: Sat, 21 Nov 2015 12:30:13 -0600 Subject: began adding collision *added a location class for ease *much refractoring needed to fully implement it* --- src/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 93693ee..2a33d65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,19 +17,20 @@ int main() while(true) { char c = getch(); - + Location l = cursor.getLocation(); if (c == 'h') - cursor.move(cursor.getRow(),cursor.getCol()-1); + l.y = l.y-1; else if (c == 'l') - cursor.move(cursor.getRow(),cursor.getCol()+1); + l.y = l.y+1; else if (c == 'k') - cursor.move(cursor.getRow()-1,cursor.getCol()); + l.x = l.x+1; else if (c == 'j') - cursor.move(cursor.getRow()+1,cursor.getCol()); + l.x = l.x-1; else if (c == 'q') - break; + break; - L.actions(); + cursor.move(l); + L.action(); map.fillWindow(); L.draw(map.getWin()); cursor.draw(map.getWin()); -- cgit v1.2.3