Fully working block placing (still needs camera and cursor tweaks)

This commit is contained in:
octospacc 2022-08-02 23:37:54 +02:00
parent 73be9daa2e
commit 3a5529c026
2 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@ BloccSpacc is a portable isometric voxel sandbox game, mainly focused on buildin
### Development status / roadmap: ### Development status / roadmap:
- [x] Breaking/placing blocks (broken because view is broken) - [x] Breaking/placing blocks
- [ ] View mode / Edit mode - [ ] View mode / Edit mode
- [ ] Moving cursor in all 3 axis - [ ] Moving cursor in all 3 axis
- [ ] Rotating view - [ ] Rotating view

View File

@ -102,12 +102,13 @@ void MoveCursor (int Direction) {
if ( Direction == 6 && CursorPos.x > 0 ) { // Left if ( Direction == 6 && CursorPos.x > 0 ) { // Left
CursorPos.x -= BlockSize; CursorPos.x -= BlockSize;
} }
if ( Direction == 8 && CursorPos.y > 0 ) { // Above if ( Direction == 8 && CursorPos.y < BlockSize * (ChunksNum.y - 1) ) { // Above
CursorPos.y -= BlockSize;
}
if ( Direction == 9 && CursorPos.y < BlockSize * (ChunksNum.y - 1) ) { // Below
CursorPos.y += BlockSize; CursorPos.y += BlockSize;
} }
if ( Direction == 9 && CursorPos.y > 0 ) { // Below
CursorPos.y -= BlockSize;
}
} }
void EventHandle() { void EventHandle() {
@ -156,7 +157,7 @@ void DrawMap( struct xyz ChunksNum ) {
DrawSurf( DrawSurf(
MapCoords.x - Camera.x - BlockSize/2, MapCoords.x - Camera.x - BlockSize/2,
MapCoords.z - Camera.z - y*BlockSize/2, //- Camera.y, 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
); );
} }
} }