今回はガシャコンブレイカーの電源を入れ忘れずに撮影できたのですが、完成した動画を見た感じ、クリティカルフィニュッシュ音はあと0.2秒程度早めで良かったかもしれません。
とりあえず、レッキングクルーガシャットの製作はここで一旦中止として、次回からは別のネタの作製に入ります。
void loop(){
current_state[0] = digitalRead(BUTTON_1_PIN);
current_state[1] = digitalRead(BUTTON_2_PIN);
current_state[2] = digitalRead(BUTTON_3_PIN);
if(memcmp(before_state, OFF_OFF_OFF, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_1);
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
wait = 1;
action = set_action(GASHAT_IN);
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
if(single_mode_flag == false){
wait = 1;
action = set_action(GASHAT_NAME);
}else{
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(GAME_CLEAR);
}else{
wait = 1;
action = set_action(GAME_OVER);
}
}
single_mode_flag = !single_mode_flag;
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
slot_in_time = 0;
slot_in_flag = true;
wait = 1;
action = set_action(GASHAT_IN);
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_1);
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(GASHAT_IN);
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
critical_mode_flag = true;
slot_in_time = 0;
slot_in_flag = true;
wait = 1;
action = set_action(WEAPON_C_READY);
}
}else if(memcmp(before_state, ON_OFF_OFF, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
if(s_process_ID == 3 && slot_in_time >= 40){
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
s_process_ID = 0;
}else{
;
}
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(LEVEL_2);
}else{
if(s_process_ID == 3 && slot_in_time >= 40){
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
s_process_ID = 0;
}else{
;
}
}
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_2);
}
}else if(memcmp(before_state, OFF_ON_OFF, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
if(s_process_ID == 2 && slot_in_time >= 40){
wait = 1;
action = set_action(GENRE);
s_process_ID = 0;
}else{
;
}
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(LEVEL_3);
}else{
if(s_process_ID == 2 && slot_in_time >= 40){
wait = 1;
action = set_action(GENRE);
s_process_ID = 0;
}else{
;
}
}
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_X);
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_3);
}
}else if(memcmp(before_state, OFF_OFF_ON, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(LEVEL_1);
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(GASHAT_IN);
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(CRITICAL_READY);
}else{
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_STRIKE);
}else{
wait = 1;
action = set_action(CRITICAL_STRIKE_KAI);
}
}
critical_mode_flag = !critical_mode_flag;
}
}else if(memcmp(before_state, ON_ON_OFF, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(DRIVER_CLOSE);
}else{
if(slot_in_time >= 40){
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
}else{
s_process_ID = 3;
}
}
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(DRIVER_CLOSE);
}else{
if(slot_in_time >= 40){
wait = 1;
action = set_action(GENRE);
}else{
s_process_ID = 2;
}
}
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
if(s_process_ID >= 1 && slot_in_time >= 40){
switch(s_process_ID){
case 1:
wait = 1;
action = set_action(CRITICAL_READY);
critical_mode_flag = !critical_mode_flag;
break;
case 2:
wait = 1;
action = set_action(GENRE);
break;
case 3:
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
break;
}
s_process_ID = 0;
}else{
;
}
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
if(slot_in_time >= 40){
if(critical_mode_flag == false){
wait = 1;
action = set_action(CRITICAL_READY);
}else{
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_STRIKE);
}else{
wait = 1;
action = set_action(CRITICAL_STRIKE_KAI);
}
}
critical_mode_flag = !critical_mode_flag;
}else{
s_process_ID = 1;
}
}
}else if(memcmp(before_state, ON_OFF_ON, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(LEVEL_2);
}else{
;
}
}
}else if(memcmp(before_state, OFF_ON_ON, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
if(critical_mode_flag == false){
wait = 1;
action = set_action(LEVEL_3);
}else{
;
}
}
}else if(memcmp(before_state, ON_ON_ON, N_BUTTON) == 0){
if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
}else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
wait = 1;
action = set_action(GENRE);
}else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
s_process_ID = 0;
slot_in_flag = false;
critical_mode_flag = false;
wait = 1;
action = set_action(GASHAT_OUT);
}else if(memcmp(current_state, ON_ON_OFF, N_BUTTON) == 0){
;
}else if(memcmp(current_state, ON_OFF_ON, N_BUTTON) == 0){
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
}else if(memcmp(current_state, OFF_ON_ON, N_BUTTON) == 0){
wait = 1;
action = set_action(GENRE);
}else if(memcmp(current_state, ON_ON_ON, N_BUTTON) == 0){
if(s_process_ID >= 1 && slot_in_time >= 40){
switch(s_process_ID){
case 1:
wait = 1;
action = set_action(CRITICAL_READY);
critical_mode_flag = !critical_mode_flag;
break;
case 2:
wait = 1;
action = set_action(GENRE);
break;
case 3:
randNumber = random(2);
if(randNumber == 0){
wait = 1;
action = set_action(CRITICAL_FINISH);
}else{
wait = 1;
action = set_action(CRITICAL_FINISH_KAI);
}
break;
}
s_process_ID = 0;
}else{
;
}
}
}
if(wait >= 1) {
flash_led(action);
wait = 0;
}else{
wait++;
}
before_state[0] = current_state[0];
before_state[1] = current_state[1];
before_state[2] = current_state[2];
if(slot_in_flag == true){
if(slot_in_time < 5000){
slot_in_time++;
}else{
slot_in_time = 0;
}
}
delay(50);
}
他の方が作製する際の参考になれば良いのですが…