Beispiel #1
0
import player

player.put_on_mask()
player.go_right(4)
player.wait(8)
player.go_left()
player.go_down(2)
player.go_right()
player.go_down(4)
player.wash_hands()
Beispiel #2
0
import player

player.go_down()
player.go_right(3)
player.go_down()
player.go_right()
player.go_down(2)
player.go_right()
player.go_down()
player.go_right()
player.go_down()
player.wash_hands()
Beispiel #3
0
import player
 
player.go_right(6)
player.go_up(2)
player.go_left(3)
player.go_up(2)
player.go_left(3)
player.go_up(2)
player.go_right()
player.wash_hands()
Beispiel #4
0
import player

player.put_on_mask()
player.go_up(3)
player.go_right(5)
player.go_up(2)
player.go_right()
player.get_products()
player.go_left(7)
player.go_down(2)
player.go_right()
player.go_down(3)
player.go_left()
player.wash_hands()
Beispiel #5
0
import player

player.go_down()
player.go_left(2)
player.go_down(3)
player.go_left(3)
player.go_up()
player.go_left()
player.go_up(2)
player.go_right(2)
player.go_up(2)
player.go_down(2)
player.go_right(4)
player.go_up(2)
player.wash_hands()
Beispiel #6
0
Datei: main.py Projekt: th28/RPG
def main():
    pygame.mixer.pre_init(44100,-16,2,2048)
    pygame.mixer.init()
    pygame.init()
    screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT),pygame.FULLSCREEN)
    players = pygame.sprite.Group()
   
    npcs = pygame.sprite.Group()
    
    player = Player(960,0,"1.png",100,"Tom","elf")
    players.add(player)
    
    myStates = StateMachine()

    clock = pygame.time.Clock()
    #1920,960
    camera = Camera(complex_camera,1920,960)
    
    
    myWorld = World(players,npcs,screen,player,camera)
    diag = None
  
    interface = Interface(screen,player,myQuests)
    
    npcs.add(milton)
    npcs.add(jwood)
    myStates.addState("WORLD_STATE",myWorld)
    myStates.addState("INTF_STATE",interface)
    myStates.addState("DIAG_STATE",diag)
    
    keepGoing = True
    counter = 0
    
    currentState = "WORLD_STATE"

    manager = StateChangeManager(currentState,player)


    pygame.joystick.init()
    mypad = pygame.joystick.Joystick(0)
    mypad.init()
    
    
    
    while keepGoing:
        
        clock.tick(30)
        #print clock.get_fps()
        player.update(myWorld,dialog,manager,npcs,myStates)
        myStates.renderState(manager.getCurrentState(),manager)
        
        q1.update()
        myQuests.update()

        
        
        if mypad.get_axis(0) < -.8:
            
            player.go_down_left()
 
        elif player.change_x < 0 or player.change_y > 0:

            player.stop('xy')
            
        
           
        if mypad.get_axis(0) > .8:

            player.go_up_right()

            
        elif player.change_x > 0 or player.change_y < 0:
            player.stop('xy')
        
        #------------------------#
        
        if mypad.get_axis(1) < -.8:

            player.go_up_left()
        
        if mypad.get_axis(1) > .8:

            player.go_down_right()

        
                        
        
        if mypad.get_axis(0) > .7 and mypad.get_axis(1) > .7:
            print "fork"
            player.stop('xy')
            player.go_right()

        if mypad.get_axis(0) < -.7 and mypad.get_axis(1) > .7:
            print "fork"
            player.stop('xy')
            player.go_down()

        if mypad.get_axis(0) < -.7 and mypad.get_axis(1) < -.7:
            player.stop('xy')
            player.go_left()

        if mypad.get_axis(0) > .7 and mypad.get_axis(1) < -.7:
            player.stop('xy')
            player.go_up()
        
        
            
        for event in pygame.event.get():
            if event.type == KEYDOWN:
                if manager.getCurrentState() == "WORLD_STATE":
                    
                    if (event.key == K_a):
                        
                            
                        player.go_left()
                    
                    if (event.key == K_d):
                        
                    
                        player.go_right()
                    
                    if (event.key == K_s):
                        
                    
                        player.go_down()
                    
                    if (event.key == K_w):
                        
                    
                        player.go_up()
                        
                    if (event.key == K_e):

                        player.interact()

                if (event.key == K_m):
                    if manager.getCurrentState() == "WORLD_STATE":
                        manager.changeState("INTF_STATE")
                    
            if event.type == KEYUP:
                if event.key == pygame.K_a and player.change_x < 0:
                    player.stop("x")
                   
                if event.key == pygame.K_d and player.change_x > 0:
                    player.stop("x")
                    
                if event.key == pygame.K_w and player.change_y < 0:
                    player.stop("y")
                    
                if event.key == pygame.K_s and player.change_y > 0:
                    player.stop("y")
                    
                if event.key == pygame.K_e:
     
                    player.uninteract()
                    
            if event.type == QUIT:
                pygame.quit()
                sys.exit(0)
        
            
        pygame.display.update()