예제 #1
0
파일: funcs.py 프로젝트: yasminsadi/games
def koopaResponse (player : example.Wrap1, koopa : example.Wrap1, x, y):
    if koopa.getState() == 'hide':
        if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
            player.vy = 300
        koopa.move(-10 * x, 0, 0)		
        left = 0 if (player.x() <koopa.x()) else 1
        s = Script()
        s.addAction (act.SetState(state='walk2', id=koopa.id(), args = {'left': left}))
        example.play(s)
    else:
        if (player.getState() == "jump" and y > 0 and abs(x) < 0.01):
            player.vy = 300
            s = Script()
            s.addAction (act.SetState(state='hide', id=koopa.id()))
            example.play(s)     
        else:
            playerHitByEnemy(player)
예제 #2
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def koopaResponse (player : example.Wrap1, koopa : example.Wrap1, x, y):
    if koopa.getState() == 'hide':
        koopa.killScripts()
        if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
            player.vy = 300
        koopa.move(-10 * x, 0, 0)		
        left = 0 if (player.x <koopa.x) else 1
        s = Script()
        s.addAction (act.SetState(state='walk2', id=koopa.id, args = {'left': left}))
        koopa.play(s)
    else:
        if (player.getState() == "jump" and y > 0 and abs(x) < 0.01):
            player.vy = 300
            s = Script()
            s.addAction (act.SetState(state='hide', id=koopa.id))
            s.addAction (act.Delay(sec=2))
            s.addAction (act.Blink(duration=2,blink_duration=0.2,id=koopa.id))
            s.addAction (act.SetState(state='walk', id = koopa.id))
            koopa.play(s)
        else:
            playerHitByEnemy(player)