This is a simple tutorial of moving the cursor around, be it basic or complex.

In any game you're most likely to have a cursor in your game, what it does is up to you. But this will be more about Game Menu Cursors/Tiles than anything else.


What you need
- 3 Variables(only 2 if it's a single row)
- Cursor Graphic

Variables
- Cursor_Cur_Location = 1 (This will be our first choice)
- Cursor_Max_Location = 3 (3 is the number of max choices, you would add your own number and if a choice is added don't forget to add '1' to the variable)
- Cursor_X = 0 (This is our Cursor X position)
- Cursor_Y = 0 (This is our Cursor Y Position)

Basic Coding

Remember that third variable we would use for rows, it's the same type of coding for left and right but it uses 2 extra variables, example. Cursor_Row_Cur_Location = 0 (This is our first row location), and you'd just add "MAX" to the second variable.

Key Up

CODE
if (Cursor_Cur_Location < 1) {
  Cursor_Cur_Location +=1; // add 1 choice;
  Cursor_Y +=16; // Move 1 16X16 tile.
}
else {
  Cursor_Cur_Location = 1;
  //  If you want to  add an animation for the cursor to move back
  Cursor_Y = 0 // Third Choice
}


Key Up

CODE
if (Cursor_Cur_Location < 1) {
  Cursor_Cur_Location -=1; // minus 1 choice;
  Cursor_Y -=16; // Move 1 16X16 tile.
}
else {
  Cursor_Cur_Location = 3;
  //  If you want to  add an animation for the cursor to move back
  Cursor_Y = 32 // Third Choice
}


Basic Menu Code

CODE
if (Cursor_Cur_Location = 1) {
  // First Choice
}
if (Cursor_Cur_Location = 2) {
  // Second Choice
}
if (Cursor_Cur_Location = 3) {
  // Third Choice
}


Conclusion

While simple this is really how Menus work and Cursors move, you can change how the cursor moves if you want rows, say 4 choices but 2 choices max per row.
I hope you learned something, and expect something new each week!