Advice on general approaches or feasibility and discussions about game design
by hrangan » Wed Apr 23, 2014 1:34 pm
ripper121 wrote: This detection is not bijective (one-to-one)
If 2 asteroids are in the same range when the pixel get methode returns true then which one will you select as hide?
And i think the bounding box is faster then the getpixel methode.
I could be wrong, but the original asteroids simply assumed asteroids to just be their boundaries. If two asteroids overlapped, you'd simply draw both boundaries, ala
http://2dboy.com/blog/wp-content/upload ... eroids.png I think a very important aspect to get right is the *ahem* frustating *ahem* behaviour of the ship to glide, ie, retain momemtum from its previous direction even when moving in a new direction. Move along the x-axis and change to the y-axis results in you following a curved trajectory.
hrangan
Posts: 58Joined: Thu Mar 20, 2014 9:35 pmLocation: Bangalore, India
by hrangan » Wed Apr 23, 2014 1:45 pm
The circles look the most accurate (for deciding the boundaries), but I agree that playtesting will be the best bet. The code should, ideally, also allow for switching between modes without too much trouble. Maybe a patch file to implement a different bounding box.
The hardware of the gamebuino is, for a game like asteroids, over and above anything you'd need. To put things in perspective, I present to you the Atari 2600,
Code: Select all | Atari 2600 | Gamebuino _______|___________________________________|___________________________ CPU | MOS 6507 @ 1.19 MHz | 20Mhz Memory | 128 bytes RAM, 4 kB ROM | 2kB RAM
I just noticed, but it's 16x both the CPU and memory.
hrangan
Posts: 58Joined: Thu Mar 20, 2014 9:35 pmLocation: Bangalore, India
by ripper121 » Wed Apr 23, 2014 2:39 pm
The hardware is no problem at all, but its better to get the code as fast as possible. So when we create functions we can use it in other bigger games.
ripper121
Posts: 224Joined: Fri Apr 04, 2014 2:02 pmLocation: Germany
by Drakker » Wed Apr 23, 2014 3:43 pm
Yeah, and extra free CPU cycles mean you can have better sound and music. If you have enough free RAM and free CPU you can also start using a shade of gray with Myndale's awesome interrupt based double buffering technique.
Drakker
Posts: 297Joined: Sun Mar 30, 2014 2:54 amLocation: Québec, Canada
by ripper121 » Wed Apr 23, 2014 4:20 pm
First step the Ship with the 4x4 Sprite
Code: Select all #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> Adafruit_PCD8544 display = Adafruit_PCD8544(8, 9, 10, 12, 11); int IBridge_Column_Pin0 = 7; int IBridge_Column_Pin1 = 6; int IBridge_Column_Pin2 = 5; int IBridge_Column_Pin3 = 4; int IBridge_Row_Pin0 = 3; int IBridge_Row_Pin1 = 2; int IBridge_Row_Pin2 = 18; int IBridge_Row_Pin3 = 19; void setup() { display.begin(); display.setContrast(60); pinMode(IBridge_Column_Pin0, OUTPUT); pinMode(IBridge_Column_Pin1, OUTPUT); pinMode(IBridge_Column_Pin2, OUTPUT); pinMode(IBridge_Column_Pin3, OUTPUT); pinMode(IBridge_Row_Pin0, INPUT); pinMode(IBridge_Row_Pin1, INPUT); pinMode(IBridge_Row_Pin2, INPUT); pinMode(IBridge_Row_Pin3, INPUT); display.clearDisplay(); display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0, 0); display.println("Asteroid v.0.1"); display.println(".by Ripper121"); display.display(); delay(1000); } //Ship Sprite static const unsigned char PROGMEM ShipN[] = { B01000000, B01000000, B10100000, B11100000 }; static unsigned char PROGMEM ShipNE[] = { B00010000, B01100000, B10100000, B01000000 }; static unsigned char PROGMEM ShipE[] = { B11000000, B10110000, B11000000, B00000000 }; static unsigned char PROGMEM ShipSE[] = { B01000000, B10100000, B01100000, B00010000 }; static unsigned char PROGMEM ShipS[] = { B11100000, B10100000, B01000000, B01000000 }; static unsigned char PROGMEM ShipSW[] = { B00100000, B01010000, B01100000, B10000000 }; static unsigned char PROGMEM ShipW[] = { B00110000, B11010000, B00110000, B00000000 }; static unsigned char PROGMEM ShipNW[] = { B10000000, B01100000, B01010000, B00100000 }; #define lcdheight 48 #define lcdwidth 84 typedef struct { int x; int y; byte w; byte h; byte dir; boolean exist; } ship; byte gamespeed = 40; void loop() { ship Ship; Ship.x = lcdheight / 2 - Ship.h / 2; Ship.y = lcdwidth / 2 - Ship.w / 2; Ship.dir = 0; Ship.w = 4; Ship.h = 4; display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0, 0); while (1) { display.clearDisplay(); //Get input & draw Player unsigned char key = 0; key = IBridge_Read_Key(); if (key == 7) if (Ship.dir < 7) Ship.dir++; else Ship.dir = 0; if (key == 15) if (Ship.dir > 0) Ship.dir--; else Ship.dir = 7; if (key == 12) { switch (Ship.dir) { case 0: Ship.y--; break; case 1: Ship.y--; Ship.x++; break; case 2: Ship.x++; break; case 3: Ship.y++; Ship.x++; break; case 4: Ship.y++; break; case 5: Ship.y++; Ship.x--; break; case 6: Ship.x--; break; case 7: Ship.y--; Ship.x--; break; } } if (key == 10) { switch (Ship.dir) { case 0: Ship.y++; break; case 1: Ship.y++; Ship.x--; break; case 2: Ship.x--; break; case 3: Ship.y--; Ship.x--; break; case 4: Ship.y--; break; case 5: Ship.y--; Ship.x++; break; case 6: Ship.x++; break; case 7: Ship.y++; Ship.x++; break; } } if (Ship.x < 0) Ship.x = 0; if (Ship.y < 0) Ship.y = 0; if (Ship.x > lcdwidth - Ship.w) Ship.x = lcdwidth - Ship.w; if (Ship.y > lcdheight - Ship.h) Ship.y = lcdheight - Ship.h; switch (Ship.dir) { case 0: display.drawBitmap(Ship.x, Ship.y, ShipN, Ship.w, Ship.h, BLACK); break; case 1: display.drawBitmap(Ship.x, Ship.y, ShipNE, Ship.w, Ship.h, BLACK); break; case 2: display.drawBitmap(Ship.x, Ship.y, ShipE, Ship.w, Ship.h, BLACK); break; case 3: display.drawBitmap(Ship.x, Ship.y, ShipSE, Ship.w, Ship.h, BLACK); break; case 4: display.drawBitmap(Ship.x, Ship.y, ShipS, Ship.w, Ship.h, BLACK); break; case 5: display.drawBitmap(Ship.x, Ship.y, ShipSW, Ship.w, Ship.h, BLACK); break; case 6: display.drawBitmap(Ship.x, Ship.y, ShipW, Ship.w, Ship.h, BLACK); break; case 7: display.drawBitmap(Ship.x, Ship.y, ShipNW, Ship.w, Ship.h, BLACK); break; } display.println(Ship.dir); //Draw to Screen display.display(); delay(gamespeed); } } unsigned char IBridge_Read_Key() { //unsigned char i = 10; //Column 0 scan digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, LOW); digitalWrite(IBridge_Column_Pin0, HIGH); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (1); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (2); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (3); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (4); //Column 2 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, HIGH); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, LOW); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (5); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (6); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (7); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (8); //Column 3 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, HIGH); digitalWrite(IBridge_Column_Pin3, LOW); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (9); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (10); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (11); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (12); //Column 4 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, HIGH); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (13); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (14); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (15); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (16); return (0); }
VIDEO
ripper121
Posts: 224Joined: Fri Apr 04, 2014 2:02 pmLocation: Germany
by hrangan » Wed Apr 23, 2014 5:41 pm
Two
very good bits of code from an otherwise excellent site.
http://gamemechanicexplorer.com/#thrust-1 -> Simulates movement without deceleration
http://gamemechanicexplorer.com/#thrust-1 -> With deceleration
These should help get the movement correct. That site has a bunch of other examples, and I'll ask rodot to add it to the wiki to help anyone new to this.
I can't remember if the ship slowed down in the original game. Does anyone know?
hrangan
Posts: 58Joined: Thu Mar 20, 2014 9:35 pmLocation: Bangalore, India
by ripper121 » Wed Apr 23, 2014 7:38 pm
The best is to add this functions to the Gamebuino lib
ripper121
Posts: 224Joined: Fri Apr 04, 2014 2:02 pmLocation: Germany
by yodasvideoarcade » Wed Apr 23, 2014 9:28 pm
That already looks great so far! Now: The ship starts in the middle. It has some acceleration and drag, because it's meant to be in space. You have 4 shoots at a time. The asteroids don't collide each other. One big rock splits into 2 medium. 1 medium splits into 2 small. New direction of movement is rather random. Big rocks are slower, medium are faster, smallest are fastest (but there's some random factor here). The higher the level, the more rocks on screen (start of level: only big rocks). The spaceships appear only when there's not so many rocks left. Spaceship collides with rocks. Big spaceship shoots (shoots destroy rocks and player), but aims not very good. Like: 10 shoots - 1 hits player. Small spacship shoots quite accurately - at least 1 of 3 shots hits player (if he doesn't escape by moving his ship).
yodasvideoarcade
Posts: 102Joined: Sat Apr 19, 2014 10:48 amLocation: Frankfurt/Germany
by hrangan » Thu Apr 24, 2014 8:08 am
Number of initial asteroids,
Round 1: 4
Round 2: 6
Round 3: 8
Round 4: 10
Round 5 and up: 11
"Senior engineer Steve Calfee reflected that Asteroids appeals to some low, primitive drive in the human mind to clean and take control of the environment. Blasting asteroids into rubble until a once-crowded screen turned into a neat black field appealed to people whose lives were nothing but a field of chaos. For them, Asteroids became a metaphor for life." Paul Schuytema, Microsoft Arcade, The Official Strategy Guide.
hrangan
Posts: 58Joined: Thu Mar 20, 2014 9:35 pmLocation: Bangalore, India
by ripper121 » Thu Apr 24, 2014 9:17 am
Update:
-Add Bullets
Code: Select all #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> Adafruit_PCD8544 display = Adafruit_PCD8544(8, 9, 10, 12, 11); int IBridge_Column_Pin0 = 7; int IBridge_Column_Pin1 = 6; int IBridge_Column_Pin2 = 5; int IBridge_Column_Pin3 = 4; int IBridge_Row_Pin0 = 3; int IBridge_Row_Pin1 = 2; int IBridge_Row_Pin2 = 18; int IBridge_Row_Pin3 = 19; void setup() { display.begin(); display.setContrast(60); pinMode(IBridge_Column_Pin0, OUTPUT); pinMode(IBridge_Column_Pin1, OUTPUT); pinMode(IBridge_Column_Pin2, OUTPUT); pinMode(IBridge_Column_Pin3, OUTPUT); pinMode(IBridge_Row_Pin0, INPUT); pinMode(IBridge_Row_Pin1, INPUT); pinMode(IBridge_Row_Pin2, INPUT); pinMode(IBridge_Row_Pin3, INPUT); display.clearDisplay(); display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0, 0); display.println("Asteroid v.0.1"); display.println(".by Ripper121"); display.display(); delay(1000); } //Ship Sprite static const unsigned char PROGMEM ShipN[] = { B01000000, B01000000, B10100000, B11100000 }; static unsigned char PROGMEM ShipNE[] = { B00010000, B01100000, B10100000, B01000000 }; static unsigned char PROGMEM ShipE[] = { B11000000, B10110000, B11000000, B00000000 }; static unsigned char PROGMEM ShipSE[] = { B01000000, B10100000, B01100000, B00010000 }; static unsigned char PROGMEM ShipS[] = { B11100000, B10100000, B01000000, B01000000 }; static unsigned char PROGMEM ShipSW[] = { B00100000, B01010000, B01100000, B10000000 }; static unsigned char PROGMEM ShipW[] = { B00110000, B11010000, B00110000, B00000000 }; static unsigned char PROGMEM ShipNW[] = { B10000000, B01100000, B01010000, B00100000 }; static unsigned char PROGMEM SBullet[] = { B01000000, B11100000, B01000000, B00000000 }; #define lcdheight 48 #define lcdwidth 84 #define maxBullets 5 typedef struct { int x; int y; byte w; byte h; byte dir; boolean exist; } ship; typedef struct { int x; int y; byte w; byte h; byte Speed; byte TTL; byte dir; boolean exist; } bullet; byte gamespeed = 40; void loop() { ship Ship; Ship.y = lcdheight / 2 - Ship.h; Ship.x = lcdwidth / 2 - Ship.w; Ship.dir = 0; Ship.w = 4; Ship.h = 4; bullet Bullet[maxBullets]; for (byte i = 0; i < maxBullets; i++) { Bullet[i].x = 0; Bullet[i].y = 0; Bullet[i].w = 3; Bullet[i].h = 3; Bullet[i].Speed = 0; Bullet[i].TTL = 0; Bullet[i].dir = 0; Bullet[i].exist = false; } display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0, 0); unsigned char key = 0; while (1) { display.clearDisplay(); //Get input & draw Player key = IBridge_Read_Key(); //Ship Dir if (key == 7) if (Ship.dir < 7) Ship.dir++; else Ship.dir = 0; if (key == 15) if (Ship.dir > 0) Ship.dir--; else Ship.dir = 7; //Ship Move if (key == 12) { switch (Ship.dir) { case 0: Ship.y--; break; case 1: Ship.y--; Ship.x++; break; case 2: Ship.x++; break; case 3: Ship.y++; Ship.x++; break; case 4: Ship.y++; break; case 5: Ship.y++; Ship.x--; break; case 6: Ship.x--; break; case 7: Ship.y--; Ship.x--; break; } } if (key == 10) { switch (Ship.dir) { case 0: Ship.y++; break; case 1: Ship.y++; Ship.x--; break; case 2: Ship.x--; break; case 3: Ship.y--; Ship.x--; break; case 4: Ship.y--; break; case 5: Ship.y--; Ship.x++; break; case 6: Ship.x++; break; case 7: Ship.y++; Ship.x++; break; } } if (Ship.x < 0) Ship.x = 0; if (Ship.y < 0) Ship.y = 0; if (Ship.x > lcdwidth - Ship.w) Ship.x = lcdwidth - Ship.w; if (Ship.y > lcdheight - Ship.h) Ship.y = lcdheight - Ship.h; switch (Ship.dir) { case 0: display.drawBitmap(Ship.x, Ship.y, ShipN, Ship.w, Ship.h, BLACK); break; case 1: display.drawBitmap(Ship.x, Ship.y, ShipNE, Ship.w, Ship.h, BLACK); break; case 2: display.drawBitmap(Ship.x, Ship.y, ShipE, Ship.w, Ship.h, BLACK); break; case 3: display.drawBitmap(Ship.x, Ship.y, ShipSE, Ship.w, Ship.h, BLACK); break; case 4: display.drawBitmap(Ship.x, Ship.y, ShipS, Ship.w, Ship.h, BLACK); break; case 5: display.drawBitmap(Ship.x, Ship.y, ShipSW, Ship.w, Ship.h, BLACK); break; case 6: display.drawBitmap(Ship.x, Ship.y, ShipW, Ship.w, Ship.h, BLACK); break; case 7: display.drawBitmap(Ship.x, Ship.y, ShipNW, Ship.w, Ship.h, BLACK); break; } //Bullet Create key = IBridge_Read_Key(); if (key == 5) { for (byte i = 0; i < maxBullets; i++) { if (!Bullet[i].exist) { Bullet[i].dir = Ship.dir; Bullet[i].x = Ship.x; Bullet[i].y = Ship.y; Bullet[i].exist = true; break; } } } //Bullet Move for (byte i = 0; i < maxBullets; i++) { if (Bullet[i].exist) { switch (Bullet[i].dir) { case 0: Bullet[i].y--; break; case 1: Bullet[i].y--; Bullet[i].x++; break; case 2: Bullet[i].x++; break; case 3: Bullet[i].y++; Bullet[i].x++; break; case 4: Bullet[i].y++; break; case 5: Bullet[i].y++; Bullet[i].x--; break; case 6: Bullet[i].x--; break; case 7: Bullet[i].y--; Bullet[i].x--; break; } //Destroy Bullet if (Bullet[i].x < 0 || Bullet[i].y < 0 || Bullet[i].x > lcdwidth - Bullet[i].w || Bullet[i].y > lcdheight - Bullet[i].h) Bullet[i].exist = false; display.drawBitmap(Bullet[i].x, Bullet[i].y, SBullet, Bullet[i].w, Bullet[i].h, BLACK); } } //display.println(bulletsexist); //Draw to Screen display.display(); delay(gamespeed); } } unsigned char IBridge_Read_Key() { //unsigned char i = 10; //Column 0 scan digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, LOW); digitalWrite(IBridge_Column_Pin0, HIGH); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (1); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (2); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (3); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (4); //Column 2 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, HIGH); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, LOW); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (5); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (6); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (7); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (8); //Column 3 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, HIGH); digitalWrite(IBridge_Column_Pin3, LOW); //i=10; //while(i--); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (9); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (10); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (11); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (12); //Column 4 Scan digitalWrite(IBridge_Column_Pin0, LOW); digitalWrite(IBridge_Column_Pin1, LOW); digitalWrite(IBridge_Column_Pin2, LOW); digitalWrite(IBridge_Column_Pin3, HIGH); delay(1); if ((digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (13); if (!(digitalRead(IBridge_Row_Pin0)) && (digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (14); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && (digitalRead(IBridge_Row_Pin2)) && !(digitalRead(IBridge_Row_Pin3))) return (15); if (!(digitalRead(IBridge_Row_Pin0)) && !(digitalRead(IBridge_Row_Pin1)) && !(digitalRead(IBridge_Row_Pin2)) && (digitalRead(IBridge_Row_Pin3))) return (16); return (0); }
VIDEO
ripper121
Posts: 224Joined: Fri Apr 04, 2014 2:02 pmLocation: Germany
Return to Project Guidance & Game development
Who is online
Users browsing this forum: No registered users and 4 guests