[pygame] Screen Centering Trouble

2008-03-17 Thread Kris Schnee

os.environ[SDL_VIDEO_CENTERED] = 1 ## Center the graphics window.

This line used to work for putting the SDL window at the screen's 
center, but now it doesn't. I see that there was a recent thread about 
this, but I'm not sure what I'm doing wrong here.


Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit 
(Intel)] on win32

 import pygame
 pygame.ver
'1.7.1release'

I installed the latest Python 2.5-based edition of Pygame straight from 
pygame.org, so this shouldn't be a problem.


Re: [pygame] Screen Centering Trouble

2008-03-17 Thread Ian Mallett
I had trouble until I got 1.8.  I don't think it's an official
release--more like a beta.


Re: [pygame] Google summer of code, and pygame. Where Google pays students to work on pygame.

2008-03-17 Thread René Dudfield
Hello,

It looks like 'pygame' wasn't chosen to be a mentor organisation this year.
 We've received no communication from google throughout the process, but I
hope to find out their reasons so we might get in next year.  I'll share
whatever I find out.

We still might be able to do projects under the following mentor
organisations that were accepted:

Python Software Foundation http://code.google.com/soc/psf/about.html (
ideas http://wiki.python.org/moin/SummerOfCode)

One Laptop per Child http://code.google.com/soc/olpc/about.html
(ideashttp://wiki.laptop.org/go/Summer%20of%20Code/Ideas)


Simple DirectMedia Layer http://code.google.com/soc/sdl/about.html
(ideashttp://www.libsdl.org/gsoc.php)




cheers,


On Sun, Mar 9, 2008 at 12:25 PM, René Dudfield [EMAIL PROTECTED] wrote:
 Cool, that'd be good.

  Start thinking of ideas for projects you'd want to work on, and I'll
  let you know the outcome of our application.  Of course if they don't
  let 'pygame' in you should still be able to do stuff under the python
  organisation, or maybe even OLPC.

  Here's the list of ideas so far:
  http://www.pygame.org/wiki/gsoc2008ideas

  cu,





  On Fri, Mar 7, 2008 at 8:10 AM, Luke Paireepinart
  [EMAIL PROTECTED] wrote:
   René Dudfield wrote:
 Hello,

 We've almost got pygame 1.8 released!  ya!   Once that's done, we'll
 have to figure out what we want to do for the next release... but on
 another note, there's this google summer of code thing coming up
GSoC(
 http://code.google.com/soc/2008/ ).  It's where google pays students
 $4500 to work on open source projects for three months.
This is pretty exciting, Rene!
I'm a student currently, and I'm planning on doing a Summer of Code
project.  I'll apply for a Pygame one if you guys get accepted.
Thanks for letting us know,
-Luke
  



[pygame] Google SOC for SDL

2008-03-17 Thread Pete Shinners
The SDL project is eligible for the Google Summer of Code. This would be a
great way to help out Pygame projects.

Their idea page is here, http://www.libsdl.org/gsoc.php




Re: [pygame] my first game (so far)

2008-03-17 Thread Devon Scott-Tunkin
Hey,

I liked the weird american idol like menu song and the
tiles look pretty cool in the graphics file.  When I
first ran it and tried to select new game I got a
pygame.error: music not loaded for the
pygame.mixer.music.play in scene.py (line 28). i
commented it out and it started (as i haven't worked
with sound yet in pygame myself to try and fix it and
am just starting oop too). then i was in a field of
all grass with really wonky controls that would
sometimes not allow me to walk in certain directions.

i am using python 2.5 pygame 1.7 and windows vista.

But hey at least the guy animates nicely and does
something!

Devon

--- Michael Fiano [EMAIL PROTECTED] wrote:

 Hi all. First, I would like to thank this list, and
 the #pygame channel for all the help so far in
 writing my first game, which is going to be a 2D
 RPG. Thank you so much!
 
 I started writing my first game January 1st, and I
 have a long way to go, but I figured I would post my
 progress so far and maybe get some suggestions for
 improvement, or maybe my code can somehow help
 someone else, so here it is:
 

http://onyx.yi.org/sites/onyx.yi.org/files/test.tar_.bz2
 
 I am currently having difficulties figuring out how
 I can adapt what I have so far to scroll the world
 when the player moves near the edges of the screen.
 If you have any ideas, any help would be
 appreciated.
 
 Well, enjoy the code..or don't enjoy it. I actually
 expect a lot of criticism. I'm new to OOP and game
 design.
 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


Re: [pygame] my first game (so far)

2008-03-17 Thread Michael Fiano
On Mon, 17 Mar 2008 17:18:46 -0700 (PDT)
Devon Scott-Tunkin [EMAIL PROTECTED] wrote:

 Hey,
 
 I liked the weird american idol like menu song and the
 tiles look pretty cool in the graphics file. When I
 first ran it and tried to select new game I got a
 pygame.error: music not loaded for the
 pygame.mixer.music.play in scene.py (line 28). i
 commented it out and it started (as i haven't worked
 with sound yet in pygame myself to try and fix it and
 am just starting oop too). then i was in a field of
 all grass with really wonky controls that would
 sometimes not allow me to walk in certain directions.
 
 i am using python 2.5 pygame 1.7 and windows vista.
 
 But hey at least the guy animates nicely and does
 something!
 
 Devon

Thanks, though the graphics and sounds are just place-holders for 
nowdefinitely not the final versions.

As for the music error, this is because I was trying to save space with the 
archive on my web server and created a symlink for the menu music to the scene 
musicwhich now that I think about shouldn't work on non-nix systems :) As 
for the wonky controls, that I cannot explain. The player can move all over the 
viewable area (no scrolling yet [help?]) for me. Anyone else want to try it on 
Vista, or other versions of Windows, or other OS's? It seems to work fine on 
Linux with pygame 1.7.1 and python 2.5.

Anyway, I'm glad you like it so far. I'm quite happy with the result so far 
myself being my first OOP/game project and all.


Re: [pygame] my first game (so far)

2008-03-17 Thread Lenard Lindstrom

Michael Fiano wrote:

On Mon, 17 Mar 2008 17:18:46 -0700 (PDT)
Devon Scott-Tunkin [EMAIL PROTECTED] wrote:

  

Hey,



[snip]

then i was in a field of
all grass with really wonky controls that would
sometimes not allow me to walk in certain directions.





Thanks, though the graphics and sounds are just place-holders for 
nowdefinitely not the final versions.

As for the music error, this is because I was trying to save space with the 
archive on my web server and created a symlink for the menu music to the scene 
musicwhich now that I think about shouldn't work on non-nix systems :) As 
for the wonky controls, that I cannot explain. The player can move all over the 
viewable area (no scrolling yet [help?]) for me. Anyone else want to try it on 
Vista, or other versions of Windows, or other OS's? It seems to work fine on 
Linux with pygame 1.7.1 and python 2.5.

Anyway, I'm glad you like it so far. I'm quite happy with the result so far 
myself being my first OOP/game project and all.
  
I tried it with Pygame 1.8 on an older Windows and it works fine. No 
problems with the arrow keys that I could find. The only thing I 
wondered about is that changing the direction the sprite faces also 
makes it moving ahead one square.


--
Lenard Lindstrom
[EMAIL PROTECTED]



Re: [pygame] Te Tuhi Video Game System

2008-03-17 Thread Ian Mallett
A very cool concept!


Re: [pygame] Creating unique userevent ids?

2008-03-17 Thread René Dudfield
Hello,

that looks nice.

I see it uses opencv.  Did you know there is a python module for
opencv made by the opencv authors?

Talk to you again when you get back from your trip :)

cheers,




On Fri, Mar 7, 2008 at 8:02 AM, Gary Bishop [EMAIL PROTECTED] wrote:
 Hi Rene,

  You can find the rapidly changing current version of the code in CVS at
  http://uncpythontools.cvs.sourceforge.net/uncpythontools/CV/ under
  pygame_cam.py. You'll need CVtypes of course. It appears to work for me
  on Ubuntu, Windows, and Mac OS X.

  I've just hacked together an object for the pgu gui kit. If that
  interests you I can create another project for it in CVS.

  I'm working as hard as I can to get stuff ready for a trip to Asheville
  week after next so I don't have much time to discuss it now but I'd be
  very pleased to talk to anyone interested about how best to provide such
  capabilities to the pygame community.

  gb



  René Dudfield wrote:
   hi,
  
   that's probably a good idea :)
  
   The upcomming SDL 1.3 has a new method for doing better user events...
   until then, it's probably good to do something like Ian suggests -
   except maybe start way higher.  Perhaps have some functions for
   getting events?  That way your code would be more abstracted for
   working with later changes.  eg.  FRAME_READY =
   webcam.get_event(FRAME_READY) etc.
  
  
   ps. do you have a url for your code repository?  I've also been
   thinking about starting a webcam module probably based of VidCapture,
   and opencv.  I think webcam support would be good for the next release
   of pygame, that is version 1.9.  Same with wiimote support.
  
   I think if we include new code with pygame that requires new events,
   we would increment USEREVENT, and hopefully that won't break much user
   code.
  
   That could be another approach that you take, increment USEREVENT
   yourself at init time, and require your init code before USEREVENT
   usage.
  
  
   On Tue, Feb 26, 2008 at 7:40 AM, Ian Mallett [EMAIL PROTECTED] wrote:
   I really have no idea what I'm talking about.  :)
   If I have separate modules that must use the same set of integers to do
   something, (like my solution for wxPython menu bindings), I go like this:
   module number + number
 1+1   = 11
 2+52 = 252
 1+31 = 131
   ...and so on.  This ensures that the bandwidth for each module remains
   reserved.  All of the numbers beginning in 1 belong to module 1, like 11,
   110, and 1100, all the ones to 2 begin with 2, like 21, 210, and 2100.  
 You
   could add this value to pygame.USEREVENT for each submodule.
  
   I've never used pygame.USEREVENT, so I have no idea what I'm talking 
 about.
   This might totally work, or be completely in the wrong direction.  I
   apologise in the case of the latter. :)
   HTH
   Ian
   --
   There are 10 kinds of people;
   those who understand binary and those who don't.
   Without order nothing can exist - without chaos nothing can evolve.



Re: [pygame] my first game (so far)

2008-03-17 Thread Patrick Mullen
On Mon, Mar 17, 2008 at 6:50 PM, Lenard Lindstrom [EMAIL PROTECTED] wrote:
  problems with the arrow keys that I could find. The only thing I
  wondered about is that changing the direction the sprite faces also
  makes it moving ahead one square.

Most rpgs I know of work this way, so Michael is working within the
standard.  Although maybe the standard is not so good :)

To Michael, I think you are making a great start with this, and the
code looks very clean and well designed.  Scrolling the screen can be
tricky if you have never done it before, but it is not too
complicated.  The biggest loss with screen scrolling is that (at least
if you are smooth scrolling) dirty rects basically go out the window -
the entire screen becomes the dirty rect when it is scrolling.

The main idea, is to have a camera offset value, and then every time
you draw you subtract that value from the x and y of what you are
drawing.  This way, most of your code doesn't have to be changed, as
you are working with the same coordinates for everything.  The only
code that has to change are the blits.

screen.blit(image,[x,y])
becomes
screen.blit(image,[x-cam_x,y-cam_y])

Test this step of the code, before you worry about scrolling, by
setting the cam_x and cam_y to different values.

Once you have this, you can detect where the player is going to be
drawn (player pos minus camera offset) to determine if the screen
should be scrolled.

Here's some pseudo code for that:
screen_x = player_x - cam_x
screen_y = player_y - cam_y
screen.blit(player,[screen_x,screen_y]
if screen_x(screen_width-100):
   cam_x+=scroll_speed
if screen_x100:
   cam_x-=scroll_speed
if screen_y(screen_height-100):
   cam_y+=scroll_speed
if screen_y100:
   cam_y-=scroll_speed

Then, the camera will scroll when the player is 100 pixels from any screen edge.

This is of course not directly applied to your project, but you should
be able to figure it out.

I hope to see more of this project in the future.  The world can never
have too many rpgs :)