Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pygame Dual Stick Shooter

Name: !!l4TFXdSyunVD/x5 2010-11-14 13:03

I want to create a dual stick shooter, (Games like "Dead Ops Arcade" in the new Black Ops, and Smash Tv).

The controls will be movement with WASD, aiming with the mouse, and shooting by clicking the mouse.
But I want to have an enemy that will follow my character, what would be the best way to do this?

And here's my code:


import pygame, sys
from pygame.locals import *

bif = "bg.jpg"

pygame.init()
pygame.display.set_caption('Game Title')
screen=pygame.display.set_mode((640,360),0,32)

background=pygame.image.load(bif).convert()

x,y=0,0
movex, movey=0,0

points=[(50,50),(100,100),(75,100)]
colour=(0,255,0)

while True:
    screen.blit(background, (0,0))
    screen.lock()
    #Lock screen so nothing inteferes with draw.
    sqaure = pygame.draw.rect(screen, (100,100,100), Rect((x,y),(5,5)))
    pygame.draw.polygon(screen, colour, points)
    #enemy = pygame.draw.rect(screen, (255,0,0), Rect((50,50),(45,45)))
    screen.unlock()

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        if event.type == KEYDOWN:
            if event.key == K_a:
                movex=-1
            elif event.key == K_d:
                movex=+1
            elif event.key == K_w:
                movey=-1
            elif event.key == K_s:
                movey=+1
        if event.type==KEYUP:
            if event.key == K_a:
                movex=-0
            elif event.key == K_d:
                movex=+0
            elif event.key == K_w:
                movey=-0
            elif event.key == K_s:
                movey=+0
    x+=movex
    y+=movey

   
    #screen.blit(sqaure, (x,y))

    pygame.display.update()

Name: Anonymous 2010-11-14 14:53

>>7
"
U+0022 QUOTATION MARK


Looks valid to me.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List