feat: add up dow through nunchuk
This commit is contained in:
parent
810745b483
commit
8a307b6435
|
@ -131,6 +131,7 @@ void display_game() {
|
|||
|
||||
void init_game(){
|
||||
score = 0;
|
||||
max_score = 0;
|
||||
posX = INIT_X;
|
||||
posY = INIT_Y;
|
||||
for ( short i = 0 ; i < 8; i++){
|
||||
|
@ -174,8 +175,6 @@ void compute_fishes_position(){
|
|||
max_score = score;
|
||||
}
|
||||
}
|
||||
Serial.print("score: ");
|
||||
Serial.println(score);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +216,7 @@ void compute_cat_position() {
|
|||
}
|
||||
//compute jump
|
||||
//detect a new jump
|
||||
if(nunchuk.zButton == 1 && !jump && !jumpBack && posY > 0){
|
||||
if((nunchuk.zButton == 1 || nunchuk.analogY > 160) && !jump && !jumpBack && posY > 0){
|
||||
Serial.println("jump!");
|
||||
//tone1.play(NOTE_B4,500);
|
||||
jump = true;
|
||||
|
@ -244,7 +243,7 @@ void compute_cat_position() {
|
|||
}
|
||||
}
|
||||
|
||||
if(nunchuk.cButton == 1 && !jump && !jumpBack && posY < 48){
|
||||
if((nunchuk.cButton == 1 || nunchuk.analogY < 100) && !jump && !jumpBack && posY < 48){
|
||||
Serial.println("jump bottom!");
|
||||
//tone1.play(NOTE_B2,500);
|
||||
jumpBack = true;
|
||||
|
|
Loading…
Reference in New Issue