Below is an working program of how the spaceship moves. Would it be possible to add "aliens" that move left and right, and when the "bullet" hits the certain area of the LCD, it clears the alien from the tile, but doesn't clear any of the other aliens, only the one the bullet was to hit. Would this be possible with the capabilities of the arduino uno? If so, then how should I approach this problem? Thanks, Ben
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte Ship[8] = {
B00000,
B00000,
B00001,
B00111,
B11001,
B00111,
B00001,
B00000
};
byte Ailen[8] = {
B10001,
B10001,
B01010,
B01110,
B01110,
B01010,
B10001,
B10001
};
byte Bullet[8] = {
B00000,
B00000,
B11111,
B11111,
B11011,
B11111,
B11111,
B00000
};
int uButton = 14;
int dButton =8;
int lButton = 13;
int rButton = 6;
int fButton = 7;
int lState = 0;
int rState = 0;
int uState = 0;
int dState = 0;
int fState = 0;
int xShip=15;
int yShip=0;
boolean lTrue= false;
boolean rTrue = false;
const int dTime= 150;
void setup() {
pinMode(uButton, INPUT);
pinMode(dButton, INPUT);
pinMode(lButton, INPUT);
pinMode(rButton, INPUT);
lcd.begin(16, 2);
lcd.createChar(0, Ship);
lcd.createChar(1,Ailen);
lcd.createChar(2,Bullet);
}
void loop() {
lState=digitalRead(lButton);
rState=digitalRead(rButton);
fState=digitalRead(fButton);
uState=digitalRead(uButton);
dState=digitalRead(dButton);
if(dState==HIGH&&xShip<15&&rState==LOW&lState==LOW){
 xShip++;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip-1,yShip);
 lcd.print(" ");
 delay(dTime);
}
else if(uState==HIGH&&xShip>0&&rState==LOW&lState==LOW){
 xShip--;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip+1,yShip);
 lcd.print(" ");
 delay(dTime);
}
else if(rState==HIGH&&yShip==1&&uState==LOW&&dState==LOW){
 yShip--;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip,yShip+1);
 lcd.print(" ");
 delay(dTime);
}
else if(lState==HIGH&&yShip==0&&uState==LOW&&dState==LOW){
 yShip++;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip,yShip-1);
 lcd.print(" ");
 delay(dTime);
}
else if(lState==HIGH&&uState==HIGH&&yShip==0&&xShip>0){
 delay(dTime);
 yShip++;
 xShip--;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip+1,yShip-1);
 lcd.print(" ");
 delay(dTime);
}
else if(lState==HIGH&&dState==HIGH&&yShip==0&&xShip<15){
 yShip++;
 xShip++;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip-1,yShip-1);
 lcd.print(" ");
 delay(dTime);
}
else if(rState==HIGH&&dState==HIGH&&yShip==1&&xShip<15){
 yShip--;
 xShip++;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip-1,yShip+1);
 lcd.print(" ");
 delay(dTime);
}
else if(rState==HIGH&&uState==HIGH&&yShip==1&&xShip>0){
 yShip--;
 xShip--;
 lcd.setCursor(xShip,yShip);
 lcd.write(byte(0));
 lcd.setCursor(xShip+1,yShip+1);
 lcd.print(" ");
 delay(dTime);
}
}