Sketch error can u help me fix it?

(Error: error: ‘buttonClicked’ was not declar/ if (buttonClicked(LEFTBUTTON))

// Snake on 8x8Matrix
//
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>

// Button pin
const int buttonRightPin = 2;
const int buttonLeftPin = 3;

// Game constants
// buttons
const int RIGHTBUTTON = 0;
const int LEFTBUTTON = 1;
// direction
const int TOP = 0;
const int RIGHT = 1;
const int BOTTOM = 2;
const int LEFT = 3;
// Snake
const int MAX_SNAKE_LENGTH = 10;

// Variables
Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); // Display
int direction = TOP; // direction of movement
int snakeX[MAX_SNAKE_LENGTH]; // X-coordinates of snake
int snakeY[MAX_SNAKE_LENGTH]; // Y-coordinates of snake
int snakeLength = 1; // nr of parts of snake
boolean buttonRead = false; // is button already read in this loop
unsigned long prevTime = 0; // for gamedelay (ms)
unsigned long delayTime = 500; // Game step in ms

int fruitX, fruitY;
unsigned long fruitPrevTime = 0;
unsigned long fruitBlinkTime = 1000/250;
int fruitLed = LED_ON;

void setup(){
Serial.begin(9600);
Serial.println(“Snake is started”);
randomSeed(analogRead(0));
// Init led matrix
matrix.begin(0x70);
// init buttons
int buttonpins = {buttonRightPin, buttonLeftPin};
int Buttons(buttonpins, 2);

// init snake
snakeX[0] = 4;
snakeY[0] = 7;
for(int i=1; i<MAX_SNAKE_LENGTH; i++){
snakeX = snakeY = -1;
* }*
* makeFruit();*
}
void loop(){
* checkButtons();*
* unsigned long currentTime = millis();*
* if(currentTime - prevTime >= delayTime){*
* nextstep();*
* buttonRead = false;*
* prevTime = currentTime;*
* }*
* draw();*
}
void checkButtons(){
* if(!buttonRead){*
* int currentDirection = direction;*

* if (buttonClicked(LEFTBUTTON))*
* {*
* direction–;*
* if(direction < 0){*
* direction = LEFT;*
* }*
* }*
* else if(buttonClicked(RIGHTBUTTON))*
* {*
* direction++;*
* if(direction > 3){*
* direction = TOP;*
* }*
* }*
* buttonRead = (currentDirection != direction);*
* }*
}
void draw(){
* matrix.clear();*
* drawSnake();*
* drawFruit();*
* matrix.writeDisplay();*
}
void drawSnake(){
* for(int i=0; i<snakeLength; i++){*
matrix.drawPixel(snakeX, snakeY*, LED_ON);
_ }
}
void drawFruit(){
if(inPlayField(fruitX, fruitY)){
unsigned long currenttime = millis();
if(currenttime - fruitPrevTime >= fruitBlinkTime){_

fruitLed = (fruitLed == LED_ON) ? LED_OFF : LED_ON;
_ fruitPrevTime = currenttime;
}
matrix.drawPixel(fruitX, fruitY, fruitLed);
}
}
boolean inPlayField(int x, int y){
return (x>=0) && (x<8) && (y>=0) && (y<8);
}
void nextstep(){
for(int i=snakeLength-1; i>0; i–){
snakeX = snakeX[i-1];
snakeY = snakeY[i-1];
}
switch(direction){
case TOP:
snakeY[0] = snakeY[0]-1;
break;
case RIGHT:
snakeX[0] = snakeX[0]+1;
break;
case BOTTOM:
snakeY[0] = snakeY[0]+1;
break;
case LEFT:
snakeX[0]=snakeX[0]-1;
break;
}
if((snakeX[0] == fruitX) && (snakeY[0] == fruitY)){
snakeLength++;_

if(snakeLength < MAX_SNAKE_LENGTH){
_ makeFruit();
}
else {
fruitX = fruitY = -1;
}
}
}
void makeFruit(){
int x, y;
x = random(0, 8);
y = random(0, 8);
while(isPartOfSnake(x, y)){
x = random(0, 8);
y = random(0, 8);
}
fruitX = x;
fruitY = y;
}
boolean isPartOfSnake(int x, int y){
for(int i=0; i<snakeLength-1; i++){
if((x == snakeX) && (y == snakeY)){
return true;
}
}
return false;
}*_

Please remember to use code tags when posting code

You should probably also tell us what the error is if you want anyone to be able to help. You might include a word or two about what the code is supposed to do or any other details that might be helpful.

You are referencing a function called buttonClicked().

Your code does not include any function by that name (nor any code that looks like it was meant to be that function,).

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks... Tom... :slight_smile: