Posts

Es werden Posts vom Mai, 2022 angezeigt.

Intellect as the sixth sense

Reading the blog of Ed Close I had the idea that we perceive our thoughts, dreams and ideas just like the input from our five senses, so our intellect is our sixth sense. This is in accordance with Jungian theory which postulates that intuition is the sixth sense. However, intuition should be more properly named intellect. 80% of the population primarily relies on their five physical senses, while 20% prefers to use intellect.

Day 6 of the Level Editor project

I decided that I would make the level scrollable today, so that tiles could be placed outside the first screen. In game.h, we define two new variables unsigned int currentPosX; unsigned int currentPosY; which we set to zero in the Initialize method. These variables will store the current position in the world, where x,y = 0,0 is the bottom-left corner. We need to consider this position whenever we work with coordinates of tiles. So in the Update method, we have to write: case Solid: newElement->coordX0 += currentPosX; newElement->coordX1 += currentPosX; newElement->coordY0 += currentPosY; newElement->coordY1 += currentPosY; level.push_back(newElement); break; and evaluate the keypresses: if (g_keys->keyDown[VK_UP]) { currentPosY++; } if (g_keys->keyDown[VK_DOWN]) { if (currentPosY > 0) currentPosY--; } if (g_keys->keyDown[VK_LEFT]) { if (currentPosX > 0) currentPosX--; } if (g_keys->

Day 5 of the Level Editor project

I've decided that today we will implement a delete functionality. If levelEditorDrawMode is set to Delete, the user shall have the power to draw a rectangle and as a consequence all objects that are completely within the boundaries of this rectangle will be removed from the level. To the Update method, we have to add code that checks for the keypresses: If the user presses '0', Delete mode shall be activated, if he/she presses '1', Solid drawing mode. if (g_keys->keyDown['0']) { keyPressed->keyDown['0'] = true; } else if (keyPressed->keyDown['0'] && !g_keys->keyDown['0']) { levelEditorDrawMode = Delete; keyPressed->keyDown['0'] = false; } if (g_keys->keyDown['1']) { keyPressed->keyDown['1'] = true; } else if (keyPressed->keyDown['1'] && !g_keys->keyDown['1']) { levelEditorDrawMode = Solid; keyPressed->keyDown[&