I am trying to write a war game with microbit, that use both button A, B and A+B. I try to set press A to move my ship (one pixel on broad) to the left, and press B move to the right. finally, press A+B to fire. But I don't know how to trigger A+B action in a better way. every time I press A+B, it comes out not fire, but the ship move to left or right. It is not easy to trigger A+B accurately.
My code is in the following, Please kindly advise how to improve it . Thanks
Code: Select all
from microbit import * while True: if button_a.is_pressed() and button_b.is_pressed(): fire....... elif button_a.is_pressed(): ship move left....... elif button_b.is_pressed(): ship move right....... sleep(100)