private void Grab(int command) { command %= 8; World.matter m = Look(command); if (m == World.matter.food) { life += 15; World.ReSetRandomPosition(x_pos + xShiftMatrix[command], y_pos + yShiftMatrix[command]); } if (m == World.matter.poison) { life += 15; World.ReSetRandomPosition(x_pos + xShiftMatrix[command], y_pos + yShiftMatrix[command]); } }
private void Move(int command) { World.matter m = Look(command); command %= 8; if (m == World.matter.empty || m == World.matter.food) { x_pos += xShiftMatrix[command]; y_pos += yShiftMatrix[command]; } if (m == World.matter.food) { life += 15; World.ReSetRandomPosition(x_pos, y_pos); } if (m == World.matter.poison) { life = 0; } }