What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Python help

Python help
Author: Message:
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: Python help
well it's been a while since I did pygame but hopefully this is kinda right,
python code:
import pygame
from pygame.locals import *
class Mover(pygame.sprite.Sprite):
    """moves a clenched fist on the screen, following the mouse"""
    def __init__(self):
        pygame.sprite.Sprite.__init__(self) #call Sprite initializer

    def update(self):
        "move the fist based on the mouse position"
        pos = pygame.mouse.get_pos()
        if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
            return
        elif event.type == KEYDOWN:     # Verify pressed keys
            key = pygame.key.get_pressed()
         
            if key[K_UP] and key[K_RIGHT]:
                print 'AD'     
                elif key[K_UP] and key[K_LEFT]:
                    print 'AE'
                elif key[K_DOWN] and key[K_RIGHT]:
                    print 'RD'
                elif key[K_DOWN] and key[K_LEFT]:
                    print 'RE'
                elif key[K_UP]:
                    print 'Ax'
                elif key[K_DOWN]:
                    print 'Rx'
                elif key[K_RIGHT]:
                    print 'xD'
                elif key[K_LEFT]:
                    print 'xE'
       
   
            self.rect.move_ip(5, 10)
def main():
    pygame.init()
    screen = pygame.display.set_mode((75, 55))
    screen = pygame.display.set_caption('Projeto 39') 
    screen = pygame.display.get_surface()
    background = pygame.Surface(screen.get_size())
    background = background.convert()
    background.fill((250, 255, 255))
    screen.blit(background, (0, 0))
    m=Mover()
    screen.blit(background, (0, 0))
    pygame.display.flip()

main()

note: I haven't tested that but I think that's how pygame does it

[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














09-27-2009 09:12 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Python help - by Chancer on 09-14-2009 at 01:47 AM
RE: Python help - by Ezra on 09-14-2009 at 05:23 PM
RE: Python help - by Chancer on 09-14-2009 at 08:55 PM
RE: Python help - by Jarrod on 09-15-2009 at 08:11 AM
RE: Python help - by Chancer on 09-15-2009 at 08:45 PM
RE: Python help - by matty on 09-16-2009 at 12:36 PM
RE: Python help - by Chancer on 09-16-2009 at 05:55 PM
RE: Python help, Solution :) - by Jarrod on 09-20-2009 at 01:33 PM
RE: Python help - by Chancer on 09-20-2009 at 03:26 PM
RE: Python help - by Jarrod on 09-20-2009 at 09:40 PM
RE: Python help - by Chancer on 09-20-2009 at 10:05 PM
RE: Python help - by Jarrod on 09-20-2009 at 10:08 PM
RE: Python help - by Chancer on 09-21-2009 at 01:06 AM
RE: Python help - by Jarrod on 09-21-2009 at 01:23 AM
RE: Python help - by Chancer on 09-26-2009 at 11:20 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:35 AM
RE: Python help - by Chancer on 09-27-2009 at 02:39 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:12 PM
RE: Python help - by Chancer on 09-27-2009 at 10:47 PM
RE: Python help - by Chancer on 10-04-2009 at 04:05 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On