Hello everyone. I am working on a ssd1306 alien-blast style game and this is my code. I dont know why but everytime I try to check it, it says" lvalue required as left operand of assignment" Can somebody fix this please?
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
int a1h = 0;
int a2h = 0;
int a3h = 0;
#define SCREEN_HEIGHT 64
#define SCREEN_WIDTH 128
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
float x = 9.13392857143;
#define imageWidth 15
#define imageHeight 16
int userx = 55;
int usery= 40;
int deathraytimer = 0;
int deathray = 0;
int deathrayx = userx;
const unsigned char bitmap2 [] PROGMEM=
{
0x8F, 0x73, 0xFD, 0xC1, 0xBF, 0x01, 0xFD, 0xF3, 0xFD, 0x01,
0xBF, 0xC1, 0xFD, 0x73, 0x8F, 0xFF, 0xFF, 0xFC, 0xF8, 0xF3,
0xE6, 0x80, 0x07, 0x80, 0xE6, 0xF3, 0xF8, 0xFC, 0xFF, 0xFF
};
const unsigned char bitmap [] PROGMEM=
{
0xFF, 0x7F, 0xBF, 0x5F, 0x5F, 0x6F, 0x27, 0xC1, 0x27, 0x6F,
0x5F, 0x5F, 0xBF, 0x7F, 0xFF, 0xFF, 0xFC, 0x03, 0xB7, 0xD6,
0xE1, 0x87, 0x6B, 0x87, 0xE1, 0xD6, 0xB7, 0x03, 0xFC, 0xFF
};
int a3x = random(0,113);
int a1x = random(0,113);
int a2x = random(0,113);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
userx = analogRead(A6) / x;
if(a3h=1){
int a3x = random(0,113);
}
if(a1h=1){
int a1x = random(0,113);
}
if(a2h=1){
int a2x = random(0,113);
}
a1h = 0;
a2h = 0;
a3h = 0;
if(digitalRead(3)= HIGH, deathraytimer = 0){
deathrayx = userx;
deathraytimer = 100;
deathray = 1;
}
if(deathray = 1){
display.drawLine(deathrayx +7,45,deathrayx +7, 0, WHITE );
if(deathraytimer > 0){
deathraytimer = deathraytimer - 1;
if (deathrayx + 7 = a1x){
a1h = 1;
}
if (deathrayx + 7 = a2x){
a2h = 1;
}
if (deathrayx + 7 = a3x){
a3h = 1;
}
}
else(){
deathray = 0;
}
}
display.drawBitmap(userx, usery, bitmap, 15, 16);
display.drawBitmap(a1x, 0, bitmap2, 15, 16);
display.drawBitmap(a2x, 0, bitmap2, 15, 16);
display.drawBitmap(a3x, 0, bitmap2, 15, 16);
display.display();
delay(20);
}