Übersetzungen dieser Seite:

Karl

karl.tar.gz mein spiele-ordner

»»»>beastslayer_ver.1.0_.tar.gz««««« Version 1.0 des Kampfspieles „Beast-Slayer“.unbedingt downloaden!!!

beastslayer_newsystem_prototyp_.py.tar.gz derzeit wird an einer ausgefeilteren programmiermethode des spieles „Beast-Slayer“ gearbeitet.

karl_neu_.tar.gz das übliche wöchentliche update

Minzblattform:

script:

muster.py
# -*- coding: utf-8 -*-
"""
pygame step003
static blitting of ball surface
url: http://thepythongamebook.com/en:part2:pygame:step003
author: horst.jens@spielend-programmieren.at
 
Blitting a surface on a static position
Drawing a filled circle into ballsurface.
Blitting this surface once.
introducing pygame draw methods
The ball's rectangular surface is black because the background
color of the ball's surface was never defined nor filled."""
import pygame
pygame.init()
screen=pygame.display.set_mode((480,480))
background = pygame.Surface(screen.get_size())
background.fill((255,255,255))     # fill the background white (red,green,blue)
background = background.convert()  # faster blitting
for z in range(0,481,3):
    x1=0
    y1=480-z
    y2=0
    x2=z
    pygame.draw.line(background, (255,0,z/1.8759), (x1,y1),(x2,y2),1)
for z in range(0,481,3):
    x1=z
    y1=480
    y2=480-z
    x2=480
    pygame.draw.line(background, (z/1.8759,0,255), (x1,y1),(x2,y2),1)
            #max x is 640 max y is 480      
#------- blit the surfaces on the screen to make them visible
screen.blit(background, (0,0))     # blit the background on the screen (overwriting all)
#screen.blit(ballsurface, (ballx, bally))  # blit the topleft corner of ball surface at pos (ballx, bally)
clock = pygame.time.Clock()
mainloop = True
FPS = 30 # desired framerate in frames per second. try out other values !
playtime = 0.0
while mainloop:
    milliseconds = clock.tick(FPS) # do not go faster than this frame rate
    playtime += milliseconds / 1000.0
    # ----- event handler -----
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            mainloop = False # pygame window closed by user
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                mainloop = False # user pressed ESC
    pygame.display.set_caption("Frame rate: %.2f frames per second. Playtime: %.2f seconds" % (clock.get_fps(),playtime))
    pygame.display.flip()          # flip the screen like in a flipbook
print "this 'game' was played for %.2f seconds" % playtime

de/personen/karl/start.txt · Zuletzt geändert: 2011/02/17 13:04 von karl