Recent Forum Posts
From categories:
page 1123...next »
Some_guy (guest) 05 Aug 2018 18:50
in discussion Hidden / Per page discussions » Drawing on the screen

why not store the images in a dict and access them in a more straightforward way?

sprite_dict = {
"hero" : "hero.png",
"badguy" : "orc.png"
}

imgs = []

for key in sprite_dict :
imgs.append( pygame.image.load(sprite_dict[key] )

You could dynamically create your sprite_dict and load from what's in there each loop.

by Some_guy (guest), 05 Aug 2018 18:50
Java2525 (guest) 31 Jul 2018 02:16
in discussion Hidden / Per page discussions » Drawing on the screen

Oof ouch that E D G E

by Java2525 (guest), 31 Jul 2018 02:16
Sadman Tariq (guest) 13 Jul 2018 12:07
in discussion About site / Improvements » What game write for sprite tutorial??

It has been 9 years dude. Did you die?

by Sadman Tariq (guest), 13 Jul 2018 12:07
nigga (guest) 23 Feb 2018 17:28
in discussion Hidden / Per page discussions » Drawing on the screen

what the fuck is happening here just fucking stop you dipshits before i kill you

by nigga (guest), 23 Feb 2018 17:28
Guest (guest) 15 Aug 2017 18:09
in discussion Hidden / Per page discussions » Event handling

Good, thanks! Also see www.teachyourselfpython.com and inventwithpython

by Guest (guest), 15 Aug 2017 18:09
Pythoncarrot (guest) 13 Jun 2017 10:24
in discussion Hidden / Per page discussions » Tutorials Basic

also check out www.teachyourselfpython.com - a great resource. I liked this tutorials - thanks!

by Pythoncarrot (guest), 13 Jun 2017 10:24
christophe (guest) 30 Apr 2017 08:57
in discussion Hidden / Per page discussions » Drawing on the screen

How to set the image size

by christophe (guest), 30 Apr 2017 08:57
thedon (guest) 01 Apr 2017 20:44
in discussion Hidden / Per page discussions » Tutorials Basic

you need to install python first. then when you are installing pygame, select the python option in one of the screens

by thedon (guest), 01 Apr 2017 20:44
Garrett (guest) 06 Jan 2017 23:52
in discussion Hidden / Per page discussions » Drawing on the screen

Wonderful tut for game programmers who are new to python!

by Garrett (guest), 06 Jan 2017 23:52
Jakey (guest) 29 Aug 2016 20:13
in discussion Hidden / Per page discussions » Tutorials Basic

I am not getting past first base and it is pathethic. I have installed Python and Pygame on three different PCs and every installation of Python fails to find Pygame. Entering "import pygame" returns "ImportError: DLL load failed: The specified module could not be found." I have consulted a dozen tutorials and none say anymore than just installing these two packages is needed. What am I missing??

by Jakey (guest), 29 Aug 2016 20:13
Chance Watkins (guest) 28 Sep 2015 22:38
in discussion Hidden / Per page discussions » Drawing on the screen

Great tutorial. Thanks for sharing this with us; Jesus Christ Bless! :)

by Chance Watkins (guest), 28 Sep 2015 22:38
Chance Watkins (guest) 08 Sep 2015 23:34
in discussion Hidden / Per page discussions » Tutorials Basic

Great tutorial. Thanks for sharing this with us; Jesus Christ Bless! :)

by Chance Watkins (guest), 08 Sep 2015 23:34
Rivet (guest) 03 Aug 2015 02:01
in discussion Hidden / Per page discussions » Drawing on the screen

This is just explaining a general setup for pygame which is understandable if you're already familiar with python, which this tutorial assumes you are.

Also it's demonstrating an object oriented approach, your few lines of code would be fine but it will quickly become hard to manage the complexity of your game and add to it, meanwhile the object oriented approach has got his framework setup and can easily and quickly add content and features to the game.

by Rivet (guest), 03 Aug 2015 02:01
msid (guest) 19 Jun 2015 19:03
in discussion Hidden / Per page discussions » Tutorials Basic

awesome, got me started in few mins. Would love to see more explanations like adding text , images, controls to the window

by msid (guest), 19 Jun 2015 19:03
november (guest) 24 Dec 2014 01:42
in discussion Hidden / Per page discussions » Drawing on the screen

I agree with you; a lot of what this tutorial has in the script isn't explained. I do like the concept of using a class to have the game in, even though there is no real need for it. It's not like we need to make to games that are exactly the same in one script.

by november (guest), 24 Dec 2014 01:42

Hi, I've just started using Python/Pygame as a hobby. I've gotten the code to draw my Plane.png and move it using the wsad keys, and I mapped the q and e keys to rotate it which it does, but each time it rotates, it 'falls' down the screen to the bottom right and after a few key presses, disappears. I read that this is because when it turns the sprite, it adds padding to resize the image while it is turning. I think that each time it turns, it adds more padding, making it add exponentially for each keypress. I can't figure out how to stop this from happening. Any help for a beginner greatly appreciated! The Colours import is just a file where I keep my pre-defined colours for easier colour filling, and Plane.gif is an inch by inch and a half gif of a black plane with transparent background, and loads no problem, it just flies away when i use the e or q keys

-CODE-

import pygame, sys, time, random
from pygame.locals import *
from Colours import *
from PIL import Image, ImageDraw

class MySprite(pygame.sprite.Sprite):
def init(self):
pygame.sprite.Sprite.init(self)
self.image = pygame.image.load('Plane.gif').convert()
self.rect = self.image.get_rect()
self.x = 0
self.y = 0

def draw(self,surface):

surface.blit(self.image,(self.x,self.y))

def onKeyPress(self):

key = pygame.key.get_pressed()
distance = 5
if key[ord('s')] or key[pygame.K_DOWN]: #down
self.y += distance
elif key[ord('w')] or key[pygame.K_UP]: #up
self.y -= distance
if key[ord('d')] or key[pygame.K_RIGHT]: #right
self.x += distance
elif key[ord('a')] or key[pygame.K_LEFT]: #left
self.x -= distance

rotate = pygame.transform.rotate
if key[ord('e')]:
self.image = rotate(self.image, 10)
elif key[ord('q')]:
self.image = rotate(self.image, -10)

class Event(object):

def init(self):

for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pygame.quit()
sys.exit()

pygame.init()

fps = 30
fpsClock = pygame.time.Clock()

size = width,height = 800,600
screen = pygame.display.set_mode(size)
mySprite = MySprite()

while True:

event = Event()
screen.fill(Blue)

mySprite.draw(screen)
mySprite.onKeyPress()

pygame.display.update()

fpsClock.tick(fps)

This is the code, hope you can help, thanks!

Rotating a sprite with pygame by najanaja (guest), 18 Nov 2014 17:11
jilin (guest) 07 Sep 2014 08:43
in discussion Hidden / Per page discussions » Drawing on the screen

It's a good tutorial. I've been reading a little on the pygame documents. Which is long and good. But here, it's what helps me to summarize what I've got till now.

by jilin (guest), 07 Sep 2014 08:43
Dash (guest) 26 Aug 2014 02:03
in discussion Hidden / Per page discussions » Tutorials Basic

When I ran that program, it came up with a message like this:
Traceback (most recent call last):
File "C:/Python27/For new programs for Ken/first pygame.py", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\init.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

by Dash (guest), 26 Aug 2014 02:03
tsh (guest) 06 Aug 2014 20:28
in discussion Hidden / Per page discussions » Drawing on the screen

nice tutorial, short and concise. Thank you.

by tsh (guest), 06 Aug 2014 20:28
Das (guest) 25 Jun 2014 05:46
in discussion Hidden / Per page discussions » Tutorials Basic

I think rather than having

if self.on_init() == None:
self._running = False

something efficient would be

try: self.on_init()
except: self._running = False

by Das (guest), 25 Jun 2014 05:46
page 1123...next »