import sas_pygame as sas

view = sas.createView(600, 400, "green","Münzsuche")
x = sas.Tools.randomNumber(10, 590)
y = sas.Tools.randomNumber(10,390)
muenze = sas.Circle(x, y, 5, "yellow")
roboter = sas.Rectangle(0,360,40,40, "blue")
randRechts = sas.Rectangle(601, 0, 5, 400,"red")
randLinks = sas.Rectangle(-5, 0, 5, 400,"red")

def main():
    verschiebung = 3
    gefunden = False
    while view.running:
        view.step()
        roboter.move(verschiebung, 0)
        if roboter.intersects(randRechts) or roboter.intersects(randLinks):
            verschiebung = -verschiebung
            roboter.move(verschiebung, -40)
        if roboter.intersects(muenze):
            gefunden = True
            muenze.setHidden(True)
            verschiebung = 0
    view.quit()

main()


