Another recruit

Andy Armstrong n at rciss.us
Sun Oct 21 22:14:00 BST 2007


On 21 Oct 2007, at 19:42, Nicholas Clark wrote:
> On Sun, Oct 21, 2007 at 12:11:39PM +0100, Andy Armstrong wrote:
>> On 21 Oct 2007, at 12:07, Shuying Wang wrote:
>>> Woot!! That's great! :-) Is she going to programme in Perl next?
>>
>> I was thinking PyGame actually...
>
> Why do you contemplate such a heresy?

:)

I guess I think Perl is a pretty tough language to learn well and that,
in any case, learning Perl as a first language isn't necessarily
conducive to achieving Perl godliness. What do they know of Perl who
only Perl know?

I also think it's unlikely that Perl will suffer as a result of me
learning Python well enough to teach it to someone. Either I'll learn
something that might make Perl, or my use of it, better or I'll learn
something that will allow me to critique Python more authoritatively.

> [ie what is PyGame and should/could there be something analogous  
> for Perl?]

It's an SDL based framework that simplifies writing 2D games. It might
do more than that but I haven't probed that deeply yet.

Here's the 'Hello, World' bouncing ball example:

     import sys, pygame
     pygame.init()

     size = width, height = 320, 240
     speed = [2, 2]
     black = 0, 0, 0

     screen = pygame.display.set_mode(size)

     ball = pygame.image.load("ball.bmp")
     ballrect = ball.get_rect()

     while 1:
         for event in pygame.event.get():
             if event.type == pygame.QUIT: sys.exit()

         ballrect = ballrect.move(speed)
         if ballrect.left < 0 or ballrect.right > width:
             speed[0] = -speed[0]
         if ballrect.top < 0 or ballrect.bottom > height:
             speed[1] = -speed[1]

         screen.fill(black)
         screen.blit(ball, ballrect)
         pygame.display.flip()

I'm sure I remember writing the same thing in BBC Basic once upon a
time. I can't for the life of me remember the OSBYTE call to swap screen
banks though :)

I see SDL_Perl exists. I see a bunch of test failures and no updates
since Oct 2005. Maybe it needs loving, extending.

-- 
Andy Armstrong, Hexten





More information about the london.pm mailing list