Nauč se Python > Materiály > Snake Workshop for PyLadies > The Snake > Game logic

Game logic – Řešení [0]

In the move method, it is necessary to set the variables new_x and new_y differently:

For upward movement:

new_x = old_x
new_y = old_y + 1

"And down:"

new_x = old_x
new_y = old_y - 1

This code sets the value of new_x to be the same as old_x, and sets the value of new_y to be one less than the value of old_y.

Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.