예제 #1
0
def koopa_response(player: example.Wrap1, koopa: example.Wrap1, x, y):
    if koopa.getState() == 'hide':
        koopa.killScripts()
        if player.getState() == 'jump' and player.vy < 0:
            player.vy = 300
        #koopa.move(-10 * x, 0, 0)
        left = 0 if (player.x < koopa.x) else 1
        s = Script()
        s.add_action(
            act.SetState(state='walk2',
                         entity_id=koopa.id,
                         args={'left': left}))
        koopa.play(s)
    elif koopa.getState() == 'walk2':
        # hit player only if going towards player
        dx = player.x - koopa.x
        if (dx > 0 and not koopa.flipx) or (dx < 0 and koopa.flipx):
            player_hit_by_enemy(player)

    else:
        if player.getState() == "jump" and player.vy < 0:
            print('fokkami')
            player.vy = 300
            s = Script()
            s.add_action(act.SetState(state='hide', entity_id=koopa.id))
            s.add_action(act.Delay(20))
            s.add_action(
                act.Blink(duration=2, blink_duration=0.2, entity_id=koopa.id))
            s.add_action(act.SetState(state='walk', entity_id=koopa.id))
            koopa.play(s)
        else:
            player_hit_by_enemy(player)
예제 #2
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)
예제 #3
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def winSlide(p: example.Wrap1, k, x, y):
    example.remove(k.id)
    p.setState('slide', {})
    s = Script()
    p.vy = 0
    s.addAction(Move(speed=50, to=[p.x, 48], tag='player'))
    s.addAction(SetState(tag='player', state='demo', args={'left': 0}))
    example.play(s)
예제 #4
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def goombaResponse (player : example.Wrap1, goomba : example.Wrap1, x, y):
    if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
        s = Script()
        player.vy = 300
        s.addAction (act.SetState (state = 'dead', id = goomba.id ))
        s.addAction (act.Delay (sec = 2))
        s.addAction (act.RemoveEntity (id=goomba.id))
        example.play(s)        
    else:
        playerHitByEnemy(player)
예제 #5
0
def goomba_response(player: example.Wrap1, goomba: example.Wrap1, x, y):
    if player.getState() == 'jump' and player.vy < 0:
        s = Script()
        player.vy = 300
        s.add_action(act.SetState(state='dead', entity_id=goomba.id))
        s.add_action(act.Delay(2))
        s.add_action(act.RemoveEntity(goomba.id))
        example.play(s)
    else:
        player_hit_by_enemy(player)
예제 #6
0
파일: funcs.py 프로젝트: yasminsadi/games
def goombaResponse (player : example.Wrap1, goomba : example.Wrap1, x, y):
    if vars.invincibility:
        return
    print ('qui')
    if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
        s = Script()
        player.vy = 300
        s.addAction (act.SetState (state = 'dead', id = goomba.id() ))
        example.play(s)
        print ('ciao')
    else:
        playerHitByEnemy(player)
예제 #7
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)
예제 #8
0
def brick_response(player: example.Wrap1, brick: example.Wrap1, x, y):
    # get the actual brick
    b = brick.parent()
    brick_id = b.id
    player.vy = -abs(player.vy)
    if vars.state == 0:
        s = Script()
        ystop = b.y
        s.add_action(
            act.MoveAccelerated(v0=[0, 50],
                                a=[0, 0.5 * vars.gravity],
                                yStop=ystop,
                                entity_id=brick_id))
        example.play(s)
    else:
        # supermario
        piece = b.getInfo()['piece']
        example.remove(brick_id)
        m = example.get('main')
        make_piece(pos=[b.x, b.y, 1], vx=60, vy=180, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=-60, vy=180, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=120, vy=120, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=-120, vy=120, model=piece, parent=m)