Re: [pygame] looking for pygame minimal examples
hi, Note, for the next pygame release we are going to include a pygame.example package. This is so that people can access examples on each platform more easily... and so that distributors will hopefully always include the examples. cheers, On Thu, Oct 9, 2008 at 9:59 AM, Lenard Lindstrom <[EMAIL PROTECTED]> wrote: > Paulo Silva wrote: >> >> Hi! >> >> I'm looking for webpages could have minimal examples, just like from: >> . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip >> . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip >> >> i'm needing them, since i'm still having really huge difficulties on >> starting coding on Pygame... and i think i know a bit about Python and >> SDL, but they seems to be not that enough... >> >> if you all know urls having very simple and encouraging pygame >> examples, please share with us newbies... >> thanks and regards, >> >> Paulo >> > > For future reference I have just added a new Pygame FAQ entry for this kind > of question: > > http://www.pygame.org/wiki/FrequentlyAskedQuestions > > > -- > Lenard Lindstrom > <[EMAIL PROTECTED]> > >
Re: [pygame] looking for pygame minimal examples
On Wed, Oct 8, 2008 at 6:59 PM, Lenard Lindstrom <[EMAIL PROTECTED]> wrote: > > For future reference I have just added a new Pygame FAQ entry for this kind > of question: > > http://www.pygame.org/wiki/FrequentlyAskedQuestions > > > -- > Lenard Lindstrom > <[EMAIL PROTECTED]> I'm glad to see that Andy Harris' site is back up! It has the latest dope. Happy Happy Joy Joy -- b h a a l u u at g m a i l dot c o m Kid on Bus: What are you gonna do today, Napoleon? Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!
Re: [pygame] looking for pygame minimal examples
Paulo Silva wrote: Hi! I'm looking for webpages could have minimal examples, just like from: . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip i'm needing them, since i'm still having really huge difficulties on starting coding on Pygame... and i think i know a bit about Python and SDL, but they seems to be not that enough... if you all know urls having very simple and encouraging pygame examples, please share with us newbies... thanks and regards, Paulo For future reference I have just added a new Pygame FAQ entry for this kind of question: http://www.pygame.org/wiki/FrequentlyAskedQuestions -- Lenard Lindstrom <[EMAIL PROTECTED]>
Re: [pygame] looking for pygame minimal examples
On Wed, 8 Oct 2008 12:26:15 -0700, "Ian Mallett" <[EMAIL PROTECTED]> wrote: > On Wed, Oct 8, 2008 at 8:54 AM, kschnee <[EMAIL PROTECTED]> wrote: >> >> >> ## Create an SDL window for graphics, and draw a blue square. >> import pygame >> screen = pygame.display.set_mode((800,600)) >> pygame.draw.rect((42,42,200,200),(0,0,255),0)) ## Parameter order might > be >> wrong >> pygame.display.update() >> > > pygame.draw.rect(screen,(0,0,255),(42,42,200,200),0) Ah, right, I forgot the surface reference (you don't have to draw to the screen, but can draw to any surface object) and reversed the color and rect parameters. Some of the other things being asked about are basically one-or-two-liners. Loading and displaying an image (by one method), for instance: pic = pygame.image.load("filename.png").convert() ## convert() is optional pic.set_colorkey((r,g,b)) ## Treat this color as transparent; good for images on a background marked with a weird color like (255,0,255) screen.blit(pic,(100,0)) ## Draw it at (100,0) For a sprite you can use general Python knowledge to make a class that has references to a loaded image and to a set of coordinates, then use the logic section of whatever main loop you've established to define rules for where the sprites move to, and to draw each sprite wherever its coordinates say. The pygame.sprite module contains methods for logical groupings of sprites and there's been discussion about collision detection methods. I don't like the sprite module myself, because it doesn't do much and it assumes that screen coordinates are the same as world coordinates. Instead I built a sprite module focused on defining a set of rect objects representing the frames of animation within a larger image, then having my sprite objects reference which frame should be displayed. For a main game loop you need some kind of loop that draws everything, handles events, and does some game logic like deciding what moves where and whether the game is over yet. In general you should look at the documentation on pygame.org, and try the built-in help commands help(thing_you_want_help_on) or dir(thing) to see what functions are available and how they work.
Re: [pygame] looking for pygame minimal examples
On Wed, Oct 8, 2008 at 8:54 AM, kschnee <[EMAIL PROTECTED]> wrote: > > > ## Create an SDL window for graphics, and draw a blue square. > import pygame > screen = pygame.display.set_mode((800,600)) > pygame.draw.rect((42,42,200,200),(0,0,255),0)) ## Parameter order might be > wrong > pygame.display.update() > pygame.draw.rect(screen,(0,0,255),(42,42,200,200),0) Ian
Re: [pygame] looking for pygame minimal examples
@bhaaluu Thanks! Some of these examples i saw online somewhere, seems to be inspiring (like idea.py) and helpful, but a bit far for what i needed (or wanted to help doing) The idea is really doing minimals of almost everything... this can take a while, but would be even more interesting seeing seeing some similar open examples where can explain as simple how everything is done, from primitives drawing, to picture processing, basics of game action like moving sprites and collisions, etc. thanks again! =) On Wed, Oct 8, 2008 at 6:09 PM, bhaaluu <[EMAIL PROTECTED]> wrote: > http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470068221,descCd-DOWNLOAD.html > > That's the alternate link. The first one was good a few days ago. > Maybe his computer went down? You'll find a zip archive of > all the source code in the book, Game Programming by Andy Harris > at the Wiley site. There are also PowerPoint slides of the main points > from the book. There is enough there to get you up and running in > PyGame, if you'll spend a little time with those materials. I got my > copy of Game Programming online for about $15. Don't pay the full > cover price for the book, if you decide you want to buy it. All the > examples are good to learn from. > > Happy Happy Joy Joy! > -- > b h a a l u u at g m a i l dot c o m > Kid on Bus: What are you gonna do today, Napoleon? > Napoleon Dynamite: Whatever I feel like I wanna do. Gosh! > > >> >> - >> On Wed, Oct 8, 2008 at 5:04 PM, bhaaluu <[EMAIL PROTECTED]> wrote: >>> http://www.cs.iupui.edu/~aharris/pygame/ >>> >>> On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: Hi! I'm looking for webpages could have minimal examples, just like from: > > > On Wed, Oct 8, 2008 at 12:53 PM, Paulo Silva <[EMAIL PROTECTED]> wrote: >> >> @bhaaluu: dead link... >> >> >> - >> On Wed, Oct 8, 2008 at 5:04 PM, bhaaluu <[EMAIL PROTECTED]> wrote: >>> http://www.cs.iupui.edu/~aharris/pygame/ >>> >>> On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: Hi! I'm looking for webpages could have minimal examples, just like from: . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip i'm needing them, since i'm still having really huge difficulties on starting coding on Pygame... and i think i know a bit about Python and SDL, but they seems to be not that enough... if you all know urls having very simple and encouraging pygame examples, please share with us newbies... thanks and regards, Paulo >
Re: [pygame] looking for pygame minimal examples
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470068221,descCd-DOWNLOAD.html That's the alternate link. The first one was good a few days ago. Maybe his computer went down? You'll find a zip archive of all the source code in the book, Game Programming by Andy Harris at the Wiley site. There are also PowerPoint slides of the main points from the book. There is enough there to get you up and running in PyGame, if you'll spend a little time with those materials. I got my copy of Game Programming online for about $15. Don't pay the full cover price for the book, if you decide you want to buy it. All the examples are good to learn from. Happy Happy Joy Joy! -- b h a a l u u at g m a i l dot c o m Kid on Bus: What are you gonna do today, Napoleon? Napoleon Dynamite: Whatever I feel like I wanna do. Gosh! > > - > On Wed, Oct 8, 2008 at 5:04 PM, bhaaluu <[EMAIL PROTECTED]> wrote: >> http://www.cs.iupui.edu/~aharris/pygame/ >> >> On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: >>> Hi! >>> >>> I'm looking for webpages could have minimal examples, just like from: On Wed, Oct 8, 2008 at 12:53 PM, Paulo Silva <[EMAIL PROTECTED]> wrote: > > @bhaaluu: dead link... > > > - > On Wed, Oct 8, 2008 at 5:04 PM, bhaaluu <[EMAIL PROTECTED]> wrote: >> http://www.cs.iupui.edu/~aharris/pygame/ >> >> On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: >>> Hi! >>> >>> I'm looking for webpages could have minimal examples, just like from: >>> . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip >>> . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip >>> >>> i'm needing them, since i'm still having really huge difficulties on >>> starting coding on Pygame... and i think i know a bit about Python and >>> SDL, but they seems to be not that enough... >>> >>> if you all know urls having very simple and encouraging pygame >>> examples, please share with us newbies... >>> thanks and regards, >>> >>> Paulo >>>
Re: [pygame] looking for pygame minimal examples
@kschnee: a bit like this, minimal examples illustrating all possible commands and interesting situations where from newbies can work over and easily copy stuff to build their own programs, and feeling encouraged of their progresses. @bhaaluu: dead link... - On Wed, Oct 8, 2008 at 5:04 PM, bhaaluu <[EMAIL PROTECTED]> wrote: > http://www.cs.iupui.edu/~aharris/pygame/ > > On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: >> Hi! >> >> I'm looking for webpages could have minimal examples, just like from: >> . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip >> . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip >> >> i'm needing them, since i'm still having really huge difficulties on >> starting coding on Pygame... and i think i know a bit about Python and >> SDL, but they seems to be not that enough... >> >> if you all know urls having very simple and encouraging pygame >> examples, please share with us newbies... >> thanks and regards, >> >> Paulo >> > > > > -- > b h a a l u u at g m a i l dot c o m > Kid on Bus: What are you gonna do today, Napoleon? > Napoleon Dynamite: Whatever I feel like I wanna do. Gosh! >
Re: [pygame] looking for pygame minimal examples
http://www.cs.iupui.edu/~aharris/pygame/ On Wed, Oct 8, 2008 at 5:45 AM, Paulo Silva <[EMAIL PROTECTED]> wrote: > Hi! > > I'm looking for webpages could have minimal examples, just like from: > . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip > . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip > > i'm needing them, since i'm still having really huge difficulties on > starting coding on Pygame... and i think i know a bit about Python and > SDL, but they seems to be not that enough... > > if you all know urls having very simple and encouraging pygame > examples, please share with us newbies... > thanks and regards, > > Paulo > -- b h a a l u u at g m a i l dot c o m Kid on Bus: What are you gonna do today, Napoleon? Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!
Re: [pygame] looking for pygame minimal examples
On Wed, 8 Oct 2008 10:45:52 +0100, "Paulo Silva" <[EMAIL PROTECTED]> wrote: > Hi! > > I'm looking for webpages could have minimal examples, just like from: > . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip > . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip > > i'm needing them, since i'm still having really huge difficulties on > starting coding on Pygame... and i think i know a bit about Python and > SDL, but they seems to be not that enough... > > if you all know urls having very simple and encouraging pygame > examples, please share with us newbies... > thanks and regards, Have you looked through the material on pygame.org? Also, are there specific things you'd like to know? Doing a minimal Pygame demonstration is as simple as: ## Create an SDL window for graphics, and draw a blue square. import pygame screen = pygame.display.set_mode((800,600)) pygame.draw.rect((42,42,200,200),(0,0,255),0)) ## Parameter order might be wrong pygame.display.update() Or to demonstrate the input loop: ## Until user hits a key, print a rising counter's value over and over. import pygame from pygame.locals import * ## For the KEYDOWN constant spam = 0 done = False while not done: ## Handle events such as keypresses. for event in pygame.event.get(): if event.type == KEYDOWN: done = True ## Some would suggest "break" instead, which ignores other events this cycle. ## Do actual processing stuff like gameplay here, or before the event handling. print spam spam += 1
[pygame] looking for pygame minimal examples
Hi! I'm looking for webpages could have minimal examples, just like from: . http://nitrofurano.linuxkafe.com/sdlbasic/MinimalExamples_050624.zip . http://nitrofurano.linuxkafe.com/python/PythonStuff_060822.zip i'm needing them, since i'm still having really huge difficulties on starting coding on Pygame... and i think i know a bit about Python and SDL, but they seems to be not that enough... if you all know urls having very simple and encouraging pygame examples, please share with us newbies... thanks and regards, Paulo