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

Pages: 1-

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 13:08

I'm not reading your code but you just use theta = atan2(you.x - him.x, you.y - him.y) to get the angle at which he should look at you and then him.x += him.speed * cos(theta) and also with him.y to make him move.


Helping because I'm intoxicated and my threads are doing iron man numbers

Name: Anonymous 2010-11-14 13:13

Just use Multimedia Fusion.

Name: Anonymous 2010-11-14 13:28

I'm so offended by the fact that you've apparently never heard of Robotron that I'm not even going to help you with this high school math.

Name: Anonymous 2010-11-14 13:51

Just use Multimedia Fusion.
"script-free programming tool"

What?

"I'm so offended by the fact that you've apparently never heard of Robotron that I'm not even going to help you with this high school math."

There are many duals stick shooters, does it matter if I haven't heard of them all?

Name: Anonymous 2010-11-14 14:12

Robotron is pretty much the father of all duel-stick shooters. It's also a very fine game.

Name: Anonymous 2010-11-14 14:37

>>5
There are many duals stick shooters, does it matter if I haven't heard of them all?
Did I say I was offended that you hadn't heard of them all, or did I say I was offended that you hadn't heard of Robotron?

Learn to quote, please.

Name: Anonymous 2010-11-14 14:53

>>7
"
U+0022 QUOTATION MARK


Looks valid to me.

Name: Anonymous 2010-11-14 14:59

>>7
pwned bitch

Name: Anonymous 2010-11-14 15:12

>>8
Learn to [m]

Name: Anonymous 2010-11-14 15:59

therfucker

Name: Anonymous 2010-11-14 17:03

>>11
omtherfuckermo?

Name: Anonymous 2010-11-14 18:27

y anus

Name: Anonymous 2010-11-14 18:31

What the fuck are you guys doing in thread?

Name: Anonymous 2010-11-14 18:33

>>15,1000 are ``Faggots''

Name: Anonymous 2010-11-14 18:43

>>15
I can confirm on 15, and this thread will never have a 1000, ``faggot''.

Name: Anonymous 2010-11-14 18:45

I'm a huge Faggot please rape my face

Name: Anonymous 2010-11-14 18:47

>>16

Yes, ``Faggot''

Name: Anonymous 2010-12-06 9:38

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2011-01-31 20:33

<-- check em dubz

Name: Anonymous 2011-02-04 12:08

Name: Anonymous 2013-01-18 23:13

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

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