[pygame] Invitation to connect on LinkedIn
LinkedIn I'd like to add you to my professional network on LinkedIn. - Paulo Paulo Silva Independent Graphic Design Professional Portugal Confirm that you know Paulo Silva https://www.linkedin.com/e/f5h7l5-gnsl793l-6a/isd/2905094271/gJstEiEM/ -- (c) 2011, LinkedIn Corporation
Re: [pygame] how to remove spam comments in pygame wiki
thank you! i hope soon being able to share snippets there, and learning easier from what will be find there! would be awesome! thanks indeed! :) On 7/28/09, jug j...@fantasymail.de wrote: Hello, We are still working on the pygame website rewrite. I'm currently implementing a snippets app that should replace the cookbook section in the wiki. The code is handled as code, apart from the description. Thus, you can download the snippets directly as .py file. Then, its easier for everyone (who has an account) to add new snippets, to find useful snippets and to remember them. Since comments will be reserved for registered users, number of spam comments and other waste content should decrease a lot. For the rest, we may have something like mark as spam buttons, so you can tell the site admins directly if you notice any spam. Documentation is another problem. I think, with the website rewrite, also the docs should modernized. AFAIK, The current system is something self-made that uses documentation thats already written in html. It blends htms and stlyle to one html file, so it is quite impossible to change the style or to include it to the rest of the site. I don't know how the comments work, but it looks not good. As well, it would be better to have some kind of api access or at least methodical urls to access documentation programmatically form the rest of the site, the apis or even the attached irc bot. I don't know about all the possible documentation systems and generators, but sphinx[1] may be adequate. Further on, I'm not sure if documentation should include comments. I think it would be better to use the snippets section to show really useful code snippets (we could link against them from the online docs) and for other stuff the wiki. If there is really sth. missing in the docs, it should be added to them, so also users who download the docs an read it offline should see these additions. Next (maybe pre-final) testing phase will come soon, including the new snippets app and much more. Regards Julian [1] http://sphinx.pocoo.org/ Paulo Silva wrote: otherwise, it's extremelly important Pygame being plenty of small snippets, and having them on places like wiki or www.pygame.org/docs/ is extremelly important, specially for newbies like me On 7/27/09, Paulo Silva nitrofur...@gmail.com wrote: i don't know... maybe Pete Shinners? On 7/27/09, Horst JENS horst.j...@chello.at wrote: Am Sonntag, den 26.07.2009, 22:06 +0100 schrieb Paulo Silva: would be great if we can notify them for the administrator removing them - if we allow anyone to remove everything, the same spammers may wish to remove very useful information we waste our precious time on posting them... who is the official wiki admin to notify ? -Horst -- Horst JENS horst.j...@chello.at http://members.chello.at/horst.jens
Re: [pygame] write gif animation?
would be a good idea capturing each frame into a file, and joining all externally with gifsicle from a command line shell call? i used to do it a lot on sdlBasic, and surelly it will work on pygame... On 7/27/09, Jake b ninmonk...@gmail.com wrote: What's the best way to convert to a gif animation? I have a list of Surfaces, that I will use as each frame. Searching, it looked like PIL is the answer, but the installer requires python 2.2, while I have 2.5. -- Jake
[pygame] opengl from python - drawing wireframe shape colours and contour in the same time
hi! do someone know how can we draw opengl shapes with plain colour fill and outline, with different colours, at same time? a good example is what were used on the Area 4 of Rez: http://www.youtube.com/watch?v=aAncDNDsv7s , and some games from Kenta Cho (which also uses OpenGL) (sorry posting this message at pygame mailing list as well, maybe there are good audience can answer, and thanks in advance too) thanks!
Re: [pygame] opengl from python - drawing wireframe shape colours and contour in the same time
thanks! (pressuposed i understood the same object must be drawn twice, as shape and as wireframe?) On 7/27/09, Ian Mallett geometr...@gmail.com wrote: #Draw the object here #Disable texturing, lighting, etc. here glColor3f(0,0,0) glLineWidth(4) #or whatever glPolygonMode(GL_FRONT_AND_BACK,GL_LINE) #Draw the object here glPolygonMode(GL_FRONT_AND_BACK,GL_FILL) glLineWidth(1) #also or whatever glColor3f(1,1,1) #Enable texturing, lighting, etc. here
Re: [pygame] opengl from python - drawing wireframe shape colours and contour in the same time
no, my idea is doing simple poly games, a bit like those 3d games from Amiga time (such as Robocop3 and many others) - very flatcoloured - but i really wanted so have the meshes wireframed - thanks for all useful info! :) On 7/27/09, Ian Mallett geometr...@gmail.com wrote: Yes, unfortunately. That may be a problem, especially if the object is high poly. There are more complex methods that use shaders. One of the better ones I've found is: Render the scene to two textures, one RGB and the other depth Apply an edge-detection filter to the depth texture (no edge = white, edge = black) Multiply the two textures together on a fullscreen quad. The problem here is you'd need shaders if you want to only have one pass, which may be overkill. (MRT to render to both textures simultaneously or storing the depth in the alpha channel of the texture). If you want to use fixed function, you'd need two render-to-textures; one for each texture--and so there wouldn't really be an advantage to this method over the original one. There's also normal-based edge detection, which I have tried as well. It's simpler, though you'll probably need a shader here too. This unfortunately suffers from line-thickness, which may or may not be a problem. You'd only need one pass though. HTH, Ian
Re: [pygame] how to remove spam comments in pygame wiki
i don't know... maybe Pete Shinners? On 7/27/09, Horst JENS horst.j...@chello.at wrote: Am Sonntag, den 26.07.2009, 22:06 +0100 schrieb Paulo Silva: would be great if we can notify them for the administrator removing them - if we allow anyone to remove everything, the same spammers may wish to remove very useful information we waste our precious time on posting them... who is the official wiki admin to notify ? -Horst -- Horst JENS horst.j...@chello.at http://members.chello.at/horst.jens
Re: [pygame] how to remove spam comments in pygame wiki
otherwise, it's extremelly important Pygame being plenty of small snippets, and having them on places like wiki or www.pygame.org/docs/ is extremelly important, specially for newbies like me On 7/27/09, Paulo Silva nitrofur...@gmail.com wrote: i don't know... maybe Pete Shinners? On 7/27/09, Horst JENS horst.j...@chello.at wrote: Am Sonntag, den 26.07.2009, 22:06 +0100 schrieb Paulo Silva: would be great if we can notify them for the administrator removing them - if we allow anyone to remove everything, the same spammers may wish to remove very useful information we waste our precious time on posting them... who is the official wiki admin to notify ? -Horst -- Horst JENS horst.j...@chello.at http://members.chello.at/horst.jens
Re: [pygame] how to remove spam comments in pygame wiki
would be great if we can notify them for the administrator removing them - if we allow anyone to remove everything, the same spammers may wish to remove very useful information we waste our precious time on posting them... On 7/26/09, Horst JENS horst.j...@chello.at wrote: the pygame-documentation wiki is full of senseless spam comments, like at pygame.font, with meaningful comments like: [quote] hvjfjb [/quote] how can i edit/remove such comments ? -Horst -- Horst JENS horstj...@gmail.com http://spielend-programmieren.at
Re: [pygame] Axelay-like background scroll getting operand error
yes, i forgot '**' - i also confess i never used it! :) On 7/21/09, Henrique Nakashima henrique.nakash...@gmail.com wrote: In Python, exponentiation can be done with the ** operand (2 ** 3 returns 8). I don't know whether that is different in any way from pow(2, 3), but help(pow) says it's the same. On Tue, Jul 21, 2009 at 11:59, Paulo Silva nitrofur...@gmail.com wrote: http://pastebin.com/f5b433a3e thank you! :) On 7/21/09, Zack Schilling zack.schill...@gmail.com wrote: ypos2=(256.0/(1.0+(pow(2.0,(4.0-(ypos/64.0))*2.0 -Zack On Jul 21, 2009, at 10:30 AM, Paulo Silva wrote: Hi! i'm getting 'TypeError: unsupported operand type(s) for ^: 'float' and 'float'' when trying to start simulating an Axelay background scroll http://pastebin.com/f48d2045 (01.png used can be anything) do someone know how can i replace '^', or which wiser calculation i must do? thanks
Re: [pygame] noob questions about creating and playing sounds
just a question: afaik, since Pygame uses SDL, Pygame only can play sounds were loaded, and the only way to 'create' (one of the questions of this mailinglist post) sounds is writing binary data into a .raw file, and calling SoX for converting it as .ogg, .wav, etc.? On 7/20/09, Jerzy Jalocha N jjalo...@gmail.com wrote: On Mon, Jul 20, 2009 at 9:55 AM, Yanom Mobisya...@rocketmail.com wrote: code gets all gibberishy in the message itself attatch the .py file(s) to the message Oops, sorry, I didn't know that! I forgot to mention, that I am running Python 2.6.6 under Linux. I can provide further information if necessary.
Re: [pygame] sprite 'weird' rotation
loved that example! thank you! it recalls me childhood wooden toys! awesome! :) sent this link to http://identi.ca/group/pygame as well On 7/20/09, DR0ID dr...@bluewin.ch wrote: hi Maybe that helps you: http://arainyday.se/projects/python/JumpingJack/ Look in the archives, this has been asked before. ~DR0ID Paulo Silva schrieb: ok, understood! and thanks about the fixing from the attachment! :) On 7/20/09, Michael George mdgeo...@cs.cornell.edu wrote: Note that you would need rotate_point or something similar if you want to rotate around a point that's not the center. Michael George wrote: Oops, I made a type. See attached Michael George wrote: Actually, after looking more closely, rotate_point wasn't what you needed. The problem was because when you rotate the image, the output is still an upright rectangle, and you were placing (the upper left corner of) that rectangle in the same place. If you place the center instead, it works out. See the attached file for the fixed version. --Mike Paulo Silva wrote: thanks! but btw, i tried to apply it, and the result got more weird - not only i can't move the sprites independently, as the rotations got much more weird http://pastebin.com/f733ebf04 (anyway, i'm still newbie on Pygame, and i still struggle a lot about how Python deals with variables, arrays, lists, and methods ) if someone know how to fix it, be welcome on editing that, and sharing us the resulting pastebin url - thanks a lot in advance! :) On 7/19/09, Michael George mdgeo...@cs.cornell.edu wrote: You can use a function from my game: http://pen.svn.sourceforge.net/viewvc/pen/data/parts/cannon.py?revision=31view=markup see the rotate_point function --Mike Paulo Silva wrote: hi, i confess it seems a bad handle from me about sprite rotation on Pygame - do someone know better how we can handle it better, making them rotating its center? http://pastebin.com/f53335b66 thanks!
[pygame] sprite 'weird' rotation
hi, i confess it seems a bad handle from me about sprite rotation on Pygame - do someone know better how we can handle it better, making them rotating its center? http://pastebin.com/f53335b66 thanks!
Re: [pygame] sprite 'weird' rotation
thanks! but btw, i tried to apply it, and the result got more weird - not only i can't move the sprites independently, as the rotations got much more weird http://pastebin.com/f733ebf04 (anyway, i'm still newbie on Pygame, and i still struggle a lot about how Python deals with variables, arrays, lists, and methods ) if someone know how to fix it, be welcome on editing that, and sharing us the resulting pastebin url - thanks a lot in advance! :) On 7/19/09, Michael George mdgeo...@cs.cornell.edu wrote: You can use a function from my game: http://pen.svn.sourceforge.net/viewvc/pen/data/parts/cannon.py?revision=31view=markup see the rotate_point function --Mike Paulo Silva wrote: hi, i confess it seems a bad handle from me about sprite rotation on Pygame - do someone know better how we can handle it better, making them rotating its center? http://pastebin.com/f53335b66 thanks!
Re: [pygame] sprite 'weird' rotation
ok, understood! and thanks about the fixing from the attachment! :) On 7/20/09, Michael George mdgeo...@cs.cornell.edu wrote: Note that you would need rotate_point or something similar if you want to rotate around a point that's not the center. Michael George wrote: Oops, I made a type. See attached Michael George wrote: Actually, after looking more closely, rotate_point wasn't what you needed. The problem was because when you rotate the image, the output is still an upright rectangle, and you were placing (the upper left corner of) that rectangle in the same place. If you place the center instead, it works out. See the attached file for the fixed version. --Mike Paulo Silva wrote: thanks! but btw, i tried to apply it, and the result got more weird - not only i can't move the sprites independently, as the rotations got much more weird http://pastebin.com/f733ebf04 (anyway, i'm still newbie on Pygame, and i still struggle a lot about how Python deals with variables, arrays, lists, and methods ) if someone know how to fix it, be welcome on editing that, and sharing us the resulting pastebin url - thanks a lot in advance! :) On 7/19/09, Michael George mdgeo...@cs.cornell.edu wrote: You can use a function from my game: http://pen.svn.sourceforge.net/viewvc/pen/data/parts/cannon.py?revision=31view=markup see the rotate_point function --Mike Paulo Silva wrote: hi, i confess it seems a bad handle from me about sprite rotation on Pygame - do someone know better how we can handle it better, making them rotating its center? http://pastebin.com/f53335b66 thanks!
Re: [pygame] sprite collisions - looking for simple snippet
@Zack - here is the smaller example i were promissed - http://pastebin.com/f65869385 - an idea about handling 4 players on one keyboard - a very fun experience i wished to see more common on Pygame games! ;) - it recalls a bit like those early 90's arcade games with 3 or 4 players on the same machine and playfield (like Simpsons, Ninja Turtles, X-Men, etc. - or even Warlords from early 80's) and sorry this example not being pythonic yet - from people used to code from 25 years ago, not knowing these new coding features, on an almost 40yo guy, this process of learning is not that fast - but of course, any help on showing what for are they used, how it works, and a theorical idea of how the Python interpreter deals with it, and being assured all the come doesn't became an undebuggable mess, is all very important and useful (all these points are very important for learning them) but there are still a lot of obstacles: for example, that tuples example you shown, mixing strings with integers (or floats) are hugelly confusing - but otherwise, example_list looks simple and interesting (assuming there are no differences between lists and arrays?) thank you a lot about all help provided! :) On 7/14/09, Zack Schilling zack.schill...@gmail.com wrote: Making code more pythonic doesn't necessarily mean meeting the PEP8 style guidelines, it just means turning the ideas that you have into code in the most direct way that best uses the basic features of Python. For example, python's basic collection, the list, is not an array and works best when you don't use it as one. When you want to iterate through all the items in a list, you don't keep track of how many items there are and step through those numbers to address each data item. example_list = [3,4.5,3,2,8.1,39] for index in range(0,len(example_list),1): print The number + str(example_list[index]) + is in the list. That's a roundabout way of working with arrays in lower level languages. In python, you should iterate through a list with this much more intuitive structure: example_list = [3,4.5,3,2,8.1,39] for value in example_list: print The number + str(value) + is in the list. This creates a loop in which each number or object in the list is substituted for value in turn. Another example: Instead of creating multiple lists to hold multiple related values of different types, use tuples. colors = [ (Blue,0,0,255), (Red,255,0,0), (Green,0,255,0), (White,255,255,255)] print Available colors: for color in colors: print color[0] One of the most important things in python is writing clear and direct code. Once you're used to it, the barriers between your programming ideas and actual code will start to fall. Hope this helps you get started. -Zack On Jul 13, 2009, at 6:49 PM, Paulo Silva wrote: @Zack: 'more pythonic' you mean PEP8? thanks a lot fixing the code, and helping me sensiblelizing a habit on this codiing way one thing i were trying to do is making the collision changing a variable for the colour, and using 'screen.fill(collisioncolour)' just once, as seeing the logic of your last code http://pastebin.com/m25df2e2b , the result were not that different one thing impressed me is that your last code seems to be much more fluid - what you did on that? on the other side, i'm still very far of understanding stuff like 'elif' or 'pygame.sprite.Group' - i am really having lots of difficulties trying to understand how Pygame sprite groups work... again, thanks a lot! :) On 7/13/09, Zack Schilling zack.schill...@gmail.com wrote: It only shows one sprite because you're filling the screen each and every time you draw one. That's also part of the reason why your code is so incredibly slow. Delete this line: screen.fill(0x998877) And move it before the for loop: screen.fill(0x998877) for i in range (0,amnt,1): spridr[snum[i]].left=xpos[i] spridr[snum[i]].top=ypos[i] But forget all that, what's much more important is writing code in a more pythonic way. Look at this rewrite of your code. It's not perfect (and still does some things strange ways for the sake of simplicity and retaining the old structure) but it should help you a lot. http://pastebin.com/m25df2e2b -Zack On Jul 13, 2009, at 3:12 PM, Paulo Silva wrote: well, the exact answer i can say is 'yes and no'... ;) the 'yes' is finally i can start understanding how collisions works on pygame, and this is truly wonderful! thank you! the 'no' is, when i did use 'if' over coordinates and size calculations instead of collisions - http://pastebin.com/f38dfd442 - it also shown just one sprite instead of from 'amnt' variable (i used to try between 32 and 128), and performed hugelly slow as well... - this is concerning me when i had some ideas on coding games with some complexity on sprite ammounts (like doing some danmaku experimental stuff or something in this way...) for me were
Re: [pygame] sprite collisions - looking for simple snippet
@Zack - what i wanted were change the background colour to #FF only when the sprites 0 and 1 collides - anyway, sorry this code is not PEP8, and using abbreviated variable names - i came from hobbystic 80's ansi-basic , where i were hugelly one-liner, and variable names only took 1 or 2 characters that time - i have deep bad habits from that time, and learning PEP8 is still a huge barrier for me - be welcome on breaking lines at ';' or rewriting variable names, if you want... @Henrique, if you can help fixing http://pastebin.com/f524a8cf2 would be great - i understand what you were saying from the error message, but i don't have any idea about the solution for that... - what i coded there were the closest i could imagine as possible for having that working... - i even tried to avoid all default sprite collision methods from pygame, and only using position and size calculations for collisions (outside of any def or class - i'm trying to avoid them on snippets like this), but the code became hugelly slow thank you all! On 7/13/09, Henrique Nakashima henrique.nakash...@gmail.com wrote: Traceback (most recent call last): File col.py, line 52, in module collide=pygame.sprite.collide_rect(sprid[0],sprid[1]) File C:\Python25\lib\site-packages\pygame\sprite.py, line 1146, in collide_r ect return left.rect.colliderect(right.rect) AttributeError: 'pygame.Surface' object has no attribute 'rect' This error happens because you are passing Surfaces to pygame.sprite.collide_rect, not Sprites. On Mon, Jul 13, 2009 at 12:27, Zack Schilling zack.schill...@gmail.comwrote: I tried to read and correct your code, but I have no idea at all what's going on. It's written like C++ transposed directly into python, which is confusing. It doesn't help that there are no comments at all and the variable names are cryptic. A big problem seems to be simply feeding wrong object types to all the functions. You're sending sprites to blitters and rects to the sprite collide. I'll have a go at understanding what you want to do and making it work, but I make no promises. If I can get that far, I'll also rewrite it in a much more pythonic way. Then you can compare the two and learn much better practices when working in python. -Zack On Jul 13, 2009, at 8:03 AM, Paulo Silva wrote: hi! well, for me finding a good pygame snippet with sprite collision (and simple to understand) is like finding a needle in a haystack... but when i try do on my own, i get this: Traceback (most recent call last): File _spritesheetexample15b4_difsiz_collision.py, line 47, in module collide=pygame.sprite.collide_rect(spridr[0].rect,spridr[1].rect) AttributeError: 'pygame.Rect' object has no attribute 'rect' the example is: http://pastebin.com/f524a8cf2 all suggestions are welcome! (be welcome also fixing that pastebin, and sending us the pastebin url with the fixes! ;) ) - sorry it's not PEP8 yet... :/ thanks! ;) On 7/13/09, René Dudfield ren...@gmail.com wrote: On Mon, Jul 13, 2009 at 7:32 AM, Paulo Silva nitrofur...@gmail.com wrote: this reference i know from a long time, and figured out easily there were the exact methods to be used - the problem is i couldn't have a snippet working only following that - on my oppinion on that referenence, each pygame method should have a working snippet to be tried out - for me is easier to work on tiny snippets, just like with lego bricks Hi, pygame comes with examples. Either use those, or use the code search button next to each method, to search through all the projects on the internet that use pygame. There's 238 results for spritcollide for example. cu,
Re: [pygame] sprite collisions - looking for simple snippet
well, the exact answer i can say is 'yes and no'... ;) the 'yes' is finally i can start understanding how collisions works on pygame, and this is truly wonderful! thank you! the 'no' is, when i did use 'if' over coordinates and size calculations instead of collisions - http://pastebin.com/f38dfd442 - it also shown just one sprite instead of from 'amnt' variable (i used to try between 32 and 128), and performed hugelly slow as well... - this is concerning me when i had some ideas on coding games with some complexity on sprite ammounts (like doing some danmaku experimental stuff or something in this way...) for me were a surprise why both http://pastebin.com/m1e1c7c94 and http://pastebin.com/f38dfd442 shown only one sprite - very weird... overally, your correction will help me coding simpler snippets thanks! :) (and thanks also confirming subsurfaces are fine for collisions - i'm still very newbie on Pygame! :) ) On 7/13/09, Zack Schilling zack.schill...@gmail.com wrote: Well, this version runs. I'm not sure if it's doing what you want but it does make a windows and draws some stuff. The subsurface splits are correct. I tried to make minimal corrections. http://pastebin.com/m1e1c7c94 -Zack On Jul 13, 2009, at 11:47 AM, Paulo Silva wrote: @Zack - what i wanted were change the background colour to #FF only when the sprites 0 and 1 collides - anyway, sorry this code is not PEP8, and using abbreviated variable names - i came from hobbystic 80's ansi-basic , where i were hugelly one-liner, and variable names only took 1 or 2 characters that time - i have deep bad habits from that time, and learning PEP8 is still a huge barrier for me - be welcome on breaking lines at ';' or rewriting variable names, if you want... @Henrique, if you can help fixing http://pastebin.com/f524a8cf2 would be great - i understand what you were saying from the error message, but i don't have any idea about the solution for that... - what i coded there were the closest i could imagine as possible for having that working... - i even tried to avoid all default sprite collision methods from pygame, and only using position and size calculations for collisions (outside of any def or class - i'm trying to avoid them on snippets like this), but the code became hugelly slow thank you all! On 7/13/09, Henrique Nakashima henrique.nakash...@gmail.com wrote: Traceback (most recent call last): File col.py, line 52, in module collide=pygame.sprite.collide_rect(sprid[0],sprid[1]) File C:\Python25\lib\site-packages\pygame\sprite.py, line 1146, in collide_r ect return left.rect.colliderect(right.rect) AttributeError: 'pygame.Surface' object has no attribute 'rect' This error happens because you are passing Surfaces to pygame.sprite.collide_rect, not Sprites. On Mon, Jul 13, 2009 at 12:27, Zack Schilling zack.schill...@gmail.comwrote: I tried to read and correct your code, but I have no idea at all what's going on. It's written like C++ transposed directly into python, which is confusing. It doesn't help that there are no comments at all and the variable names are cryptic. A big problem seems to be simply feeding wrong object types to all the functions. You're sending sprites to blitters and rects to the sprite collide. I'll have a go at understanding what you want to do and making it work, but I make no promises. If I can get that far, I'll also rewrite it in a much more pythonic way. Then you can compare the two and learn much better practices when working in python. -Zack On Jul 13, 2009, at 8:03 AM, Paulo Silva wrote: hi! well, for me finding a good pygame snippet with sprite collision (and simple to understand) is like finding a needle in a haystack... but when i try do on my own, i get this: Traceback (most recent call last): File _spritesheetexample15b4_difsiz_collision.py, line 47, in module collide=pygame.sprite.collide_rect(spridr[0].rect,spridr[1].rect) AttributeError: 'pygame.Rect' object has no attribute 'rect' the example is: http://pastebin.com/f524a8cf2 all suggestions are welcome! (be welcome also fixing that pastebin, and sending us the pastebin url with the fixes! ;) ) - sorry it's not PEP8 yet... :/ thanks! ;) On 7/13/09, René Dudfield ren...@gmail.com wrote: On Mon, Jul 13, 2009 at 7:32 AM, Paulo Silva nitrofur...@gmail.com wrote: this reference i know from a long time, and figured out easily there were the exact methods to be used - the problem is i couldn't have a snippet working only following that - on my oppinion on that referenence, each pygame method should have a working snippet to be tried out - for me is easier to work on tiny snippets, just like with lego bricks Hi, pygame comes with examples. Either use those, or use the code search button next to each method, to search through all the projects on the internet that use pygame. There's 238 results for spritcollide
Re: [pygame] sprite collisions - looking for simple snippet
this reference i know from a long time, and figured out easily there were the exact methods to be used - the problem is i couldn't have a snippet working only following that - on my oppinion on that referenence, each pygame method should have a working snippet to be tried out - for me is easier to work on tiny snippets, just like with lego bricks On 7/12/09, Henrique Nakashima henrique.nakash...@gmail.com wrote: Pygame.sprite has methods for detection collisions: pygame.sprite.spritecollide(), pygame.sprite.collide_rect(), etc. You can find their reference at http://www.pygame.org/docs/ref/sprite.html. On Sun, Jul 12, 2009 at 17:41, nitrofur...@gmail.com wrote: hi! i'm having difficulty on coding a small nippet of sprite collisions on pygame on sdlbasic, it's extremelly simple to get working (please don't worry about PEP8... :/ ) http://img19.imageshack.us/img19/6966/bht0.png http://img19.imageshack.us/img19/8138/bht1.png http://pastebin.com/f289d80eb i imagine it can be possible coding similar stuff on python pygame, using as few lines of code as this one, and providing similar results all feedback is very apreciated, thanks! :)
[pygame] being at pygame-users group without receiving mails in our inbox
Hi! since i used to follow pygame-users mailing list from google groups, is that possible sending messages to there, and not receiving anyone in your mail inbox? if it is, where must we configure, by webpage configuring or mailing list commands? what google groups is awesome is exactly this feature, making us able to post messages in a mailing list, seeing which mailing list messages were sent there, and not having the worry of loosing time deleting every message from our mail account inbox i'm asking this because it's very boring having to subscribe and unsubscribe all the time we want to send messages to this mailing list... thanks! :)
[pygame] sprites in arrays, instead of simple variables
hi! recently i coded this humble snipped using sprites from subsurfaces: http://pastebin.com/f2b05bf70 the question is: it seems to be simple working with just 4 different sprites, one in each variable - but when they are hundreds or thousands, this task become to be very boring - can we store sprites into arrays instead of simple variables? another question: this example became slow when the ammount of sprites on screen are 256 or more, on a Pentium4-sse2 (i'm using Ubuntu Linux 9.04) - is there some way to speed up this task, and allowing as much as 1000 sprites or more for this? (i'm interested on trying to start coding those bullet-hell doujin shumps, and this snippet were for testing how many sprites we can count with for this kind of game development) thanks! :)
Re: [pygame] sprites in arrays, instead of simple variables
@TyleLaing but do you know where can i find working snippets with sprite groups, like this one i sent? http://pastebin.com/f2b05bf70 (or how sprite group classes can be easily implemented there, if you or someone don't mind... :| ) thanks a lot! :) On 7/7/09, Paulo Silva nitrofur...@gmail.com wrote: thanks! :) On 7/7/09, Tyler Laing trinio...@gmail.com wrote: Hi, Take a look at the group classes. This lets you manage the sprites easily. http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.Group -Tyler On Tue, Jul 7, 2009 at 8:55 AM, Paulo Silva nitrofur...@gmail.com wrote: hi! recently i coded this humble snipped using sprites from subsurfaces: http://pastebin.com/f2b05bf70 the question is: it seems to be simple working with just 4 different sprites, one in each variable - but when they are hundreds or thousands, this task become to be very boring - can we store sprites into arrays instead of simple variables? another question: this example became slow when the ammount of sprites on screen are 256 or more, on a Pentium4-sse2 (i'm using Ubuntu Linux 9.04) - is there some way to speed up this task, and allowing as much as 1000 sprites or more for this? (i'm interested on trying to start coding those bullet-hell doujin shumps, and this snippet were for testing how many sprites we can count with for this kind of game development) thanks! :) -- Visit my blog at http://oddco.ca/zeroth/zblog
Re: [pygame] being at pygame-users group without receiving mails in our inbox
thanks, i didn't knew about filters, and how to use them - let's see how fine it works! thanks! :) On 7/7/09, Nirav Patel o...@spongezone.net wrote: I don't know about using Google Groups, but I see you are using Gmail. Why not create a filter that adds a List or Pygame label to mailing list messages, removes them from the inbox, and maybe marks them as read? Labels and filters make gmail great for following mailing lists without crowding your inbox. Plus, with 7GB+ of space, I don't think you need to worry about 1MB a month of mailing list traffic. http://mail.google.com/support/bin/topic.py?hl=entopic=12881 Nirav On Tue, Jul 7, 2009 at 11:54 AM, Paulo Silvanitrofur...@gmail.com wrote: Hi! since i used to follow pygame-users mailing list from google groups, is that possible sending messages to there, and not receiving anyone in your mail inbox? if it is, where must we configure, by webpage configuring or mailing list commands? what google groups is awesome is exactly this feature, making us able to post messages in a mailing list, seeing which mailing list messages were sent there, and not having the worry of loosing time deleting every message from our mail account inbox i'm asking this because it's very boring having to subscribe and unsubscribe all the time we want to send messages to this mailing list... thanks! :)
Re: [pygame] looking for generative graphism code done with Pygame
@RenéDudfield thanks! subscribed everything! =) are stuff like this i were looking for! =) btw, at http://nitrofurano.linuxkafe.com/sdlbasic i have lots of stuff i'm curious to recode with Pygame, most are about vectorial drawings --- On Thu, Oct 9, 2008 at 11:39 PM, René Dudfield [EMAIL PROTECTED] wrote: hello, Here's a few things: http://www.youtube.com/watch?v=yqdfCQ5og3E http://www.youtube.com/watch?v=-raPTH_ZiLk http://www.youtube.com/watch?v=S7PkSFFpkYI http://www.youtube.com/watch?v=Cw1b_RYi784 There's also some fractal explorers and such things... I've also done some simple interactive party game type scripts. Then of course there are all the games, which each in there own way generate graphics (mostly sprite based though). However some are very vector based games (especially from the various 64KB/128KB games). cu, On Wed, Oct 8, 2008 at 8:54 PM, Paulo Silva [EMAIL PROTECTED] wrote: on the Related Intiatives from http://processing.org/ , it seems Pygame is cited there, but i couldn't find much more generative code made on Python, beyond some screenshots from John Maeda clog at http://www.maedastudio.com/clog/ if someone knows where can we find similar experiences online with Pygame, please let us know... thanks in advance
[pygame] looking for generative graphism code done with Pygame
on the Related Intiatives from http://processing.org/ , it seems Pygame is cited there, but i couldn't find much more generative code made on Python, beyond some screenshots from John Maeda clog at http://www.maedastudio.com/clog/ if someone knows where can we find similar experiences online with Pygame, please let us know... thanks in advance
[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
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
@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? shrug 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] PyGameSF meetup Tuesday August 12th 7pm @ Metreon San Francisco
thanks! :-) On Sat, Aug 9, 2008 at 12:05 AM, Harry Tormey [EMAIL PROTECTED] wrote: Usually the speakers post slides after each talk. I will try to at least post podcast if we can not get a camera for the event. -H -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Silva Sent: Friday, August 08, 2008 1:11 PM To: pygame-users@seul.org Subject: Re: [pygame] PyGameSF meetup Tuesday August 12th 7pm @ Metreon San Francisco for all the people can't get there, would be a good idea someone(s) recording it on video and sharing to us from youtube or alike? if it's possible, please share to us later where from can we see them! thanks! --- On Fri, Aug 8, 2008 at 5:39 PM, Harry Tormey [EMAIL PROTECTED] wrote: Hi All, just writing to say that this months PyGameSF meet up is on Tuesday August 12th from 7pm at the Metreon food court in San Francisco. This month's presentations are: - Casey Duncan/Harry Tormey: Particle engines for fun and profit About:py-lepton (http://code.google.com/p/py-lepton/) is a high-performance, pluggable particle engine and API for Python. The talk will be an overview of the engine which is written in python/c followed by a demo of an example game which uses it. The main focus of this months meet up will be to discuss preparations for the pyweek competition. PyGame SF is an informal group meet up in San Francisco for Software engineers interested in python, OpenGL, audio, pygame, SDL, programming and generally anything to do with multimedia development. The format of our meetings typically involve several people giving presentations on projects they are developing followed by group discussion and feedback. f anyone else would like to give a micro presentation, show demos or just talk about what they are doing or generally give examples of any relevant software they are working on please feel free to head along. To subscribe to the pygamesf mailing list simply email pygame-sf+subscribe at unworkable.org -Harry
Re: [pygame] pygame and bulletml
thanks! - i have now this code stored in my Pygame folder for testing them as far i can get at least as comfortable with Pygame as i think i were being on sdlBasic - really thanks - i'm really very curious about how easy on Pygame we can get those shower of bullets as from Kenta Cho games! :-) -- On Tue, Jul 29, 2008 at 6:18 PM, Paul Pigg [EMAIL PROTECTED] wrote: I don't know bulletML and don't have plans for using it, but xml didn't seem to hard to work with when I needed to. Here's a quick contrived example based on the fire example xml on the website, just to give you a quick idea of the api. On it's own, it's not too useful. --Paul import xml.dom.minidom # Note that I put some whitespace in the XML, which is parsed as Text s='fire direction type=absolute270/direction speed2/speed bulletRef label=rocket/ /fire' dom = xml.dom.minidom.parseString(s) doc = dom.documentElement assert doc.tagName == 'fire' print doc.tagName for child in doc.childNodes: if hasattr(child, 'tagName'): # isinstance(child, xml.dom.minidom.Element) also works... if child.tagName == 'direction': outstr = ' direction = ' + child.childNodes[0].data if child.hasAttribute('type'): outstr += ', type = ' + child.getAttributeNode('type').value print outstr elif child.tagName == 'speed': print ' speed = ' + child.childNodes[0].data elif child.tagName == 'bulletRef': if child.hasAttribute('label'): print ' bulletRef label = ' + child.getAttributeNode('label').value prints: fire direction = 270, type = absolute speed = 2 bulletRef label = rocket On Tue, Jul 29, 2008 at 1:31 AM, Paulo Silva [EMAIL PROTECTED] wrote: thanks, but if someone may have some ready snippet, please let us know... :-) On Tue, Jul 29, 2008 at 4:37 AM, Jake b [EMAIL PROTECTED] wrote: Python can read xml. I don't know of a bulletml specific python lib. -- Jake
Re: [pygame] very easy snippets to start: where from i can get?
thanks! On Mon, Jul 28, 2008 at 4:16 AM, Knapp [EMAIL PROTECTED] wrote: On Mon, Jul 28, 2008 at 1:08 AM, Paulo Silva [EMAIL PROTECTED] wrote: about oop, i'm really curious about learning it, but i have to see examples (smaller than 1kb, please...) explaining clearly where and how the code gets so improved instead as coding them as procedural (all of my trying experiences on oop coding were completely frustrating up to now...) In many ways it is just a matter of the subroutines having private data. And then, taking those routines and using them as a basis for extended data and routines based of the first ones. And this idea too but I don't use it much. http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming -- Douglas E Knapp http://sf-journey-creations.wikispot.org/Front_Page
Re: [pygame] how hexcolour arrays works?
Noah, i also agree completelly each person works differently, of course! :-) (maybe that's why i got concerned about politeness on pasting code here, which i didn't know how far is it needed or not...) - you may be from the academic world, and i'm hobbyst, academically from graphic design area (and still with some bad habits from the ansi-basic 80's coding...) When compaired with Perl, Ruby and Java, Python for me is maybe the very best language i found - it's clean, and also works fine as script language on Gimp, Inkscape, Blender, Scribus, etc., what is truly awesome for me... - and as well, Python came installed on all Linux and MacOS-X, what is awesome as well... what made me becoming so surprised with Python is i could code there in the same way i used to code on sdlBasic and wxBasic, and these codes worked fine! :-) - you know, a mere graphic designer with a hobbyst taste about coding, being able to code scripts for Gimp and so on (the python version of the .ai importer from Inkscape is mine, as well the Gnome menu converter for Fluxbox, for example... :-p ), even some small converters... why i shoutd stop coding on Python, you know... ? thanks! :-) On Mon, Jul 28, 2008 at 12:38 PM, Noah Kantrowitz [EMAIL PROTECTED] wrote: Paulo Silva wrote: Stop right now? oh please, just now when i were getting so happy on trying to learn it? what a stimulation from the open-source world... :-(( (i really wanted only to focus in the solutions of doubts like mine one...) If Python doesn't match the way you work, I doubt you will enjoy it. Not every tool is right for every job, and each person works differently. Thats all. --Noah
Re: [pygame] very easy snippets to start: where from i can get?
those idea-alter examples are really useful for me in the stage i am http://www.geocities.com/ek.bhaaluu/python/ is also very in the way i used to code thanks again! :-) - about oop, i'm really curious about learning it, but i have to see examples (smaller than 1kb, please...) explaining clearly where and how the code gets so improved instead as coding them as procedural (all of my trying experiences on oop coding were completelly frustrating up to now...) -- On Sun, Jul 27, 2008 at 10:15 PM, Paulo Silva [EMAIL PROTECTED] wrote: thanks all bookmarks - i'm reading all them, and also all going to del.icio.us as well! :-) -- On Sun, Jul 27, 2008 at 5:29 PM, bhaaluu [EMAIL PROTECTED] wrote: Maybe these examples will help you get an idea of simple Python programming? They are based on ancient line-numbered BASIC code which is in the Text Adventure Game book, linked to on the web page: http://www.geocities.com/ek.bhaaluu/python/index.html There is no PyGame used in those games, but they should be easy to read, since they are based on BASIC from the 80's. I am a hobbyist programmer, so the Python code is not very Pythonistic. However, the code runs okay on my GNU/Linux computer running Python 2.4.4. A very good PyGame tutorial is called GAME PROGRAMMING by Andy Harris [ISBN-13: 978-0-470-06822-9] All the source code for the PyGame example programs in the book are located here:: http://www.cs.iupui.edu/~aharris/pygame/ That site also has some PowerPoint slides that cover the major points that are in the book. The best Python tutorial, IMHO, is PYTHON PROGRAMMING FOR THE ABSOLUTE BEGINNER by Michael Dawson [ISBN-13: 978-1-59863-112-8]. Unfortunately, the source code for that book is not available anywhere that I know of, however, you may be able to find some code snippets if you do a Google Code Search: http://www.google.com/codesearch/advanced_code_search Of course, the PyGame site has some beginning tutorials: http://www.python.org/ Also, this is a nice Python tutorial: http://www.learningpython.com/ Especially interesting are the step-by-step tutorials http://www.learningpython.com/2006/03/12/creating-a-game-in-python-using-pygame-part-one/ Happy Programming! -- 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 Fri, Jul 25, 2008 at 7:12 AM, Paulo Silva [EMAIL PROTECTED] wrote: my coding style (if it can be named as this) is deeply based on hobbystic ansi-basic from 80's - i'm a bit unknown of definitions, but maybe it's procedural (i can't find definition from google)? thanks! Paulo
Re: [pygame] Moving sprites.
well, for now i were enjoying these ones http://www.cs.iupui.edu/~aharris/pygame/ch04/ On Sun, Jul 27, 2008 at 11:38 PM, [EMAIL PROTECTED] wrote: So I've read piman's tutorial and checked out a few others. I'm still confused. I don't really understand the process of moving a sprite around. I would like to use RenderUpdates and such, but I'm lost. I basically have a simple script that moves a ship around a background (the background is an image.) To create the sprite I'm using: class Units(pygame.sprite.Sprite): def __init__(self, img, loc1 = 250, loc2 = 250): pygame.sprite.Sprite.__init__(self) #start up sprites #locs self.loc1 = loc1 self.loc2 = loc2 #create sprite self.image, self.rect = load_image(img) self.rect.center = [self.loc1, self.loc2] I create the ship like this: self.ship = Units('bship.png') self.screen.blit(self.ship.image, self.ship.rect) To redraw the ship when it moves I'm using this: self.ship.loc1 = n1 #n1 and n2 are setup earlier in the code that looks for key presses and sets the pixel difference self.ship.loc2 = n2 self.ship.rect.center = [self.ship.loc1, self.ship.loc2] print self.ship.rect.center self.screen.blit(self.bg, (0,0)) self.screen.blit(self.ship.image, self.ship.rect.center) pygame.display.flip() I'm really pretty confused at this point. I know I'm just doing something stupid, but I haven't managed to get any other code working to redraw the ship properly when it's moved. I don't have the code from when I was doing it wrong, but basically, can someone point me in the right direction to changing this over to just redraw the appropriate areas? Thanks, and sorry this was rambling.
Re: [pygame] Moving sprites.
thanks! :-) On Mon, Jul 28, 2008 at 1:06 AM, René Dudfield [EMAIL PROTECTED] wrote: make sprite.image use the same surface. Surfaces are not copied by default. You need to use the Surface.copy() method to create a new one. So just assigning the same surface will work for sharing one picture with lots of sprites. On Mon, Jul 28, 2008 at 9:33 AM, Paulo Silva [EMAIL PROTECTED] wrote: you welcome! :-) - btw, i'm still trying to to on Pygame what i were doing on sdlBasic up to now (http://nitrofurano.linuxkafe.com/sdlbasic), stuff like how to get lots of sprites from just one picture, etc. -- On Mon, Jul 28, 2008 at 12:19 AM, Percival Kelley [EMAIL PROTECTED] wrote: Awesome. Thank you. That did the trick. On Sun, Jul 27, 2008 at 1:10 PM, Paulo Silva [EMAIL PROTECTED] wrote: well, for now i were enjoying these ones http://www.cs.iupui.edu/~aharris/pygame/ch04/ On Sun, Jul 27, 2008 at 11:38 PM, [EMAIL PROTECTED] wrote: So I've read piman's tutorial and checked out a few others. I'm still confused. I don't really understand the process of moving a sprite around. I would like to use RenderUpdates and such, but I'm lost. I basically have a simple script that moves a ship around a background (the background is an image.) To create the sprite I'm using: class Units(pygame.sprite.Sprite): def __init__(self, img, loc1 = 250, loc2 = 250): pygame.sprite.Sprite.__init__(self) #start up sprites #locs self.loc1 = loc1 self.loc2 = loc2 #create sprite self.image, self.rect = load_image(img) self.rect.center = [self.loc1, self.loc2] I create the ship like this: self.ship = Units('bship.png') self.screen.blit(self.ship.image, self.ship.rect) To redraw the ship when it moves I'm using this: self.ship.loc1 = n1 #n1 and n2 are setup earlier in the code that looks for key presses and sets the pixel difference self.ship.loc2 = n2 self.ship.rect.center = [self.ship.loc1, self.ship.loc2] print self.ship.rect.center self.screen.blit(self.bg, (0,0)) self.screen.blit(self.ship.image, self.ship.rect.center) pygame.display.flip() I'm really pretty confused at this point. I know I'm just doing something stupid, but I haven't managed to get any other code working to redraw the ship properly when it's moved. I don't have the code from when I was doing it wrong, but basically, can someone point me in the right direction to changing this over to just redraw the appropriate areas? Thanks, and sorry this was rambling.
Re: [pygame] Moving sprites.
about sprite.image, Surface.copy(): i almost getting the point, and i hope not being abusing if i'd ask for a small and simple working snippet (small as 1kb-like or less) could show us this - thanks! :-) - On Mon, Jul 28, 2008 at 1:11 AM, Paulo Silva [EMAIL PROTECTED] wrote: thanks! :-) On Mon, Jul 28, 2008 at 1:06 AM, René Dudfield [EMAIL PROTECTED] wrote: make sprite.image use the same surface. Surfaces are not copied by default. You need to use the Surface.copy() method to create a new one. So just assigning the same surface will work for sharing one picture with lots of sprites. On Mon, Jul 28, 2008 at 9:33 AM, Paulo Silva [EMAIL PROTECTED] wrote: you welcome! :-) - btw, i'm still trying to to on Pygame what i were doing on sdlBasic up to now (http://nitrofurano.linuxkafe.com/sdlbasic), stuff like how to get lots of sprites from just one picture, etc. -- On Mon, Jul 28, 2008 at 12:19 AM, Percival Kelley [EMAIL PROTECTED] wrote: Awesome. Thank you. That did the trick. On Sun, Jul 27, 2008 at 1:10 PM, Paulo Silva [EMAIL PROTECTED] wrote: well, for now i were enjoying these ones http://www.cs.iupui.edu/~aharris/pygame/ch04/ On Sun, Jul 27, 2008 at 11:38 PM, [EMAIL PROTECTED] wrote: So I've read piman's tutorial and checked out a few others. I'm still confused. I don't really understand the process of moving a sprite around. I would like to use RenderUpdates and such, but I'm lost. I basically have a simple script that moves a ship around a background (the background is an image.) To create the sprite I'm using: class Units(pygame.sprite.Sprite): def __init__(self, img, loc1 = 250, loc2 = 250): pygame.sprite.Sprite.__init__(self) #start up sprites #locs self.loc1 = loc1 self.loc2 = loc2 #create sprite self.image, self.rect = load_image(img) self.rect.center = [self.loc1, self.loc2] I create the ship like this: self.ship = Units('bship.png') self.screen.blit(self.ship.image, self.ship.rect) To redraw the ship when it moves I'm using this: self.ship.loc1 = n1 #n1 and n2 are setup earlier in the code that looks for key presses and sets the pixel difference self.ship.loc2 = n2 self.ship.rect.center = [self.ship.loc1, self.ship.loc2] print self.ship.rect.center self.screen.blit(self.bg, (0,0)) self.screen.blit(self.ship.image, self.ship.rect.center) pygame.display.flip() I'm really pretty confused at this point. I know I'm just doing something stupid, but I haven't managed to get any other code working to redraw the ship properly when it's moved. I don't have the code from when I was doing it wrong, but basically, can someone point me in the right direction to changing this over to just redraw the appropriate areas? Thanks, and sorry this was rambling.
[pygame] pygame and bulletml
a question from a pygame newbie - how fine can pygame work with Kenta Cho's bulletml, and where can we see snippets about?
Re: [pygame] phpbb forum missing at pygame.org website
it were also hard to find unofficial pygame forae - is this the best one? http://z7.invisionfree.com/pygame/ (if it is, would be nice pygame.org linking them in their webpage! ;-) ) -- On Sun, Jul 27, 2008 at 4:30 PM, Frozenball [EMAIL PROTECTED] wrote: Personally I prefer forums over mailing list - they are much easier to handle and use. On Sun, Jul 27, 2008 at 6:10 PM, Ian Mallett [EMAIL PROTECTED] wrote: I was scrolling up through this quickly, and I saw Emmanuel Berg and Knapp, and I thought it said Immanuel Kant--the philosopher. I digress; I'm sorry. Ian
[pygame] very easy snippets to start: where from i can get?
hi! I'm very curious about learning pygame, but having lots of difficulties to start because i can't find simple, small and useful snippets where i can learn from. The problem is mostly of all pygame code i found were too much strong-typed for me For an idea, you can see some of my snippets at: http://nitrofurano.linuxkafe.com/python http://nitrofurano.linuxkafe.com/sdlbasic http://nitrofurano.linuxkafe.com/wxbasic Specially being able to recode my sdlbasic minimal examples into python-pygame, and from the other code you all may have some idea of the coding style i were using, which is completelly different of what i saw used on pygame codes. Any help is very welcome and apreciated! :-) Thanks! Paulo
Re: [pygame] very easy snippets to start: where from i can get?
thanks, but it looks confusing for me, too messy for me... (sorry saying this, but i got really lost with this url...) - it's a bit object oriented (and i know nothing about it), and the code is splitted between comments i don't know what to have in a complete code - On Fri, Jul 25, 2008 at 12:56 PM, René Dudfield [EMAIL PROTECTED] wrote: hey, this tutorial kind of covers the basics of python with pygame... http://rene.f0o.com/mywiki/PythonGameProgramming cu, On Fri, Jul 25, 2008 at 9:12 PM, Paulo Silva [EMAIL PROTECTED] wrote: thanks about the urls - btw, i'm stuck on starting, anyway... - the programs are the links to the zipped files at the top of the webpage. Maybe a good idea is, for example, i posting some or another snippet (very small stuff in sdlBasic) at pastebin.org and asking you how does it can be coded on python-pygame? my coding style (if it can be named as this) is deeply based on hobbystic ansi-basic from 80's - i'm a bit unknown of definitions, but maybe it's procedural (i can't find definition from google)? is oop object-oriented programing, using classes, methods, etc.? i still know nothing about them, and having completelly no idea how to start using them... well, please take a look at my code and help me defining which style are them - they may look very amateur for academic and professional coders, but i were using them for my personal needs, and were working fine for me up to now... thanks! Paulo -- On Fri, Jul 25, 2008 at 11:54 AM, Jake b [EMAIL PROTECTED] wrote: If you have a specific problem you're stuck on, or a program you're trying to re-create in pythin, it'd be easier to give you more help. [ I looked at your site, but didn't see a program. It's hard to read for me on ff3 win32. ] A few links to get you started http://kai.vm.bytemark.co.uk/~piman/writing/sprite-tutorial.shtml http://www.pygame.org/wiki/tutorials http://www.libsdl.org/tutorials.php http://www.pygame.org/docs/ref/index.html [you're best friend] There's also NeHe tutorials if you want to get started into pygame+OpenGL. What coding style were you used to? What are you seeing? Procedural vs OOP or something else? -- Jake
Re: [pygame] very easy snippets to start: where from i can get?
well, more ugly code: this is about arrays and how can i get several sprites from just one picture: randomize xed=320:yed=240:sprn=32:maxspd=4:spram=16 dim xdr[sprn],ydr[sprn],xpo[sprn],ypo[sprn],sprid[sprn] for i=0 to sprn:sprid[i]=3:next wdwd=1 setdisplay(xed,yed,32,wdwd) for i=0 to sprn:xdr[i]=rnd(4):ydr[i]=rnd(4):xpo[i]=1:ypo[i]=1:next screenopen(1,xed,yed,0,0,0,0,0) loadimage(ubuntumarks2.png,1):pasteicon(0,0,1):screen(1) for y=0 to 1:for x=0 To 9:k=x+(y*10):grab(1+k,x*32,y*32,32,32):next:next screen(0) for xt=0 to xed step 32:for yt=0 to yed step 32 pasteicon(xt,yt,1):next:next while (0=0) for i=0 to sprn-1 bob(1+i,xpo[i],ypo[i],sprid[i]) xpo[i]=xpo[i]+xdr[i]:ypo[i]=ypo[i]+ydr[i] if xpo[i](xed-32) then:xpo[i]=0:end if if xpo[i]0 then:xpo[i]=(xed-32):end if if ypo[i](yed-32) then:ypo[i]=0:end if if ypo[i]0 then:ypo[i]=(yed-32):end if next i=rnd(sprn):xdr[i]=(rnd(8)-4):ydr[i]=(rnd(8)-4):sprid[i]=1+(rnd(spram)) waitvbl if key(27) then:end:end if '- esc key wend waitkey the picture i were using with the sprites were this one: http://img355.imageshack.us/img355/1572/ubuntumarks2jj3.png thanks again! :-) On Fri, Jul 25, 2008 at 5:34 PM, Paulo Silva [EMAIL PROTECTED] wrote: thanks! is exactly like that were what i'm looking for! :-) -- On Fri, Jul 25, 2008 at 4:51 PM, Brad Montgomery [EMAIL PROTECTED] wrote: A! My eyes :) On Fri, Jul 25, 2008 at 10:47 AM, Peter Shinners [EMAIL PROTECTED] wrote: Paulo Silva wrote: for example, this code, how do it would look like with Python-Pygame? http://pastebin.com/f5642fd17 (runs on sdlBasic) I have created the ugliest pygame code in the world to match you example. I hope it provides an interest for you to actually learn a bit of Python's elegence (little of which is on display here) --- import pygame, random from random import randint as rnd def waitkey(): while 1: e = pygame.event.wait() if e.type in (pygame.QUIT, pygame.KEYDOWN): return finp=ring5.png;fout=finp+.bmp xed=320;yed=240 window=pygame.display.set_mode((xed, yed),0,32) img=pygame.image.load(finp);window.blit(img,(0,0)) for i in range(100): color=rnd(0,255),rnd(0,255),rnd(0,255) box=rnd(0,xed),rnd(0,yed),rnd(0,xed),rnd(0,yed) window.fill(color,box) pygame.display.flip() pygame.image.save(window,fout) waitkey() --- -- brad [bradmontgomery.net]
[pygame] phpbb forum missing at pygame.org website
What do you all think about a phpbb forum at pygame.org, where pygame coders can share ideas, questions, snippets, in a way some people (like me) used to use this as a more effective and direct way? there are lots of people used to enjoy much more phpbb forums than mailing lists... (even if some developers are known as being not so addict on phpbb, but this may be an easier contact for newbies, which are not too much into mailing lists)
Re: [pygame] phpbb forum missing at pygame.org website
for reading mailing list archives they looks fine, but for posting directly from there i couldn't find where we can post messages... otherwise, i think pygame.org webpage will gain a lot with a phpbb forum into it, maybe may bring more curious about, and sharing some ideas as far they are visiting pygame.org another fact is almost all open-source projects as known as pygame has a forum in their webpage, even wxBasic and sdlBasic thanks! On Fri, Jul 25, 2008 at 7:30 PM, James Paige [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 07:19:03PM +0100, Paulo Silva wrote: What do you all think about a phpbb forum at pygame.org, where pygame coders can share ideas, questions, snippets, in a way some people (like me) used to use this as a more effective and direct way? there are lots of people used to enjoy much more phpbb forums than mailing lists... (even if some developers are known as being not so addict on phpbb, but this may be an easier contact for newbies, which are not too much into mailing lists) I know it isn't the same thing, but have you tried the gmane web interface to the pygame mailing list? It should be far more comfortable for a person who prefers forums http://blog.gmane.org/gmane.comp.python.pygame http://news.gmane.org/gmane.comp.python.pygame --- James Paige
Re: [pygame] phpbb forum missing at pygame.org website
i'm one example of this - since long time mailing list exists (and i were using internet regularly for more than 10 years), and only now with gmail i'm getting enough 'courage' to subscribe into mailing lists - all the time i were (and will be for sure) much more addict of 'forae' (i'm not that good in latin language; is 'forae' the plural of 'forum'? ;-) ) as well, i think also is lots easier to point an url of a forum post than locating an url of an archived post of mailing list... and getting posters connecting each others by this way... On Fri, Jul 25, 2008 at 9:03 PM, Nathan Whitehead [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 11:51 AM, James Paige [EMAIL PROTECTED] wrote: The blog-like interface does allow posting. The newsgroup-thread interface does not. I like the idea of switching from a mailing list to phpBB. There are many great features of bulletin boards: * user icons * getting email notifications for some threads and not others * sticky topics and announcements * easy to moderate if necessary * syntax highlighting for code snippets * uniform interface for html links in messages * ability to upload screenshots and include in messages Apart from the features, I think nowadays people are more comfortable joining a forum than subscribing to a mailing list. -- Nathan Whitehead
Re: [pygame] phpbb forum missing at pygame.org website
another thing is it's much more easier to reply a post from 2 or 3 years old on a forum than on a mailing list... - these situations happened also with me somehow regularly... - On Fri, Jul 25, 2008 at 10:53 PM, Paulo Silva [EMAIL PROTECTED] wrote: i'm one example of this - since long time mailing list exists (and i were using internet regularly for more than 10 years), and only now with gmail i'm getting enough 'courage' to subscribe into mailing lists - all the time i were (and will be for sure) much more addict of 'forae' (i'm not that good in latin language; is 'forae' the plural of 'forum'? ;-) ) as well, i think also is lots easier to point an url of a forum post than locating an url of an archived post of mailing list... and getting posters connecting each others by this way... On Fri, Jul 25, 2008 at 9:03 PM, Nathan Whitehead [EMAIL PROTECTED] wrote: On Fri, Jul 25, 2008 at 11:51 AM, James Paige [EMAIL PROTECTED] wrote: The blog-like interface does allow posting. The newsgroup-thread interface does not. I like the idea of switching from a mailing list to phpBB. There are many great features of bulletin boards: * user icons * getting email notifications for some threads and not others * sticky topics and announcements * easy to moderate if necessary * syntax highlighting for code snippets * uniform interface for html links in messages * ability to upload screenshots and include in messages Apart from the features, I think nowadays people are more comfortable joining a forum than subscribing to a mailing list. -- Nathan Whitehead