From 3a5529c0269b655d7dc0e26683287520d12b0e99 Mon Sep 17 00:00:00 2001 From: octospacc Date: Tue, 2 Aug 2022 23:37:54 +0200 Subject: [PATCH] Fully working block placing (still needs camera and cursor tweaks) --- README.md | 2 +- Source/Main.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 23fface..f0f25ce 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ BloccSpacc is a portable isometric voxel sandbox game, mainly focused on buildin ### Development status / roadmap: -- [x] Breaking/placing blocks (broken because view is broken) +- [x] Breaking/placing blocks - [ ] View mode / Edit mode - [ ] Moving cursor in all 3 axis - [ ] Rotating view diff --git a/Source/Main.c b/Source/Main.c index 2038bb5..f468296 100644 --- a/Source/Main.c +++ b/Source/Main.c @@ -102,12 +102,13 @@ void MoveCursor (int Direction) { if ( Direction == 6 && CursorPos.x > 0 ) { // Left CursorPos.x -= BlockSize; } - if ( Direction == 8 && CursorPos.y > 0 ) { // Above - CursorPos.y -= BlockSize; - } - if ( Direction == 9 && CursorPos.y < BlockSize * (ChunksNum.y - 1) ) { // Below + if ( Direction == 8 && CursorPos.y < BlockSize * (ChunksNum.y - 1) ) { // Above CursorPos.y += BlockSize; } + if ( Direction == 9 && CursorPos.y > 0 ) { // Below + CursorPos.y -= BlockSize; + } + } void EventHandle() { @@ -156,7 +157,7 @@ void DrawMap( struct xyz ChunksNum ) { DrawSurf( MapCoords.x - Camera.x - BlockSize/2, MapCoords.z - Camera.z - y*BlockSize/2, //- Camera.y, - Blockset, & Blocks[Map[ChunksNum.y-1-y][z][x]], Screen + Blockset, & Blocks[Map[y][z][x]], Screen ); } }