www.main.lv

Don't think just code it

Menu

  • Projects
    • Robatik
    • ArpSni
  • Samples
    • FreeBSD Asm
    • Linux Asm
    • PyGame Tutorial
    • UNIX programming
    • PSP programming
    • AVR
    • Math
  • Contact

Tags

algo (1)asm (19)attractor (2)avr (2)blender (3)bug (1)c (25)coalision (2)debug (3)editor (1)elf (1)fractals (2)freebsd (3)game (3)generator (1)gimp (1)int80h (22)map (1)math (5)mit (1)nano (1)net (2)opengl (1)plugin (1)post (2)povray (1)psp (3)pygame (19)python (28)robatik (2)sdl (3)skype (2)sql (1)towers (2)tutorial (7)voronoi (1)wudu (1)

Archive

  • 2010 august (1)
  • 2010 july (2)
  • 2010 june (1)
  • 2010 april (2)
  • 2010 march (2)
  • 2010 february (2)
  • 2010 january (2)
  • 2009 december (3)
  • 2009 november (8)
  • 2009 october (3)
  • 2009 september (5)
  • 2009 august (1)
  • 2009 july (1)
  • 2009 june (1)
  • 2009 may (1)
  • 2009 april (3)
  • 2009 march (1)
  • 2009 february (2)
  • 2009 january (1)
  • 2008 october (2)
  • 2008 september (4)

2008-09-14 Star generator



Python scripth with generating picture of points from bmp image. Colors in bmp image is like koeficent map with allow generate more random points in any place of image you want. There shown source image from what where generated points on black image.
Download


2008-09-07 Simple Fractals

Here is some Fractal examples. That is my first fractals.


Start Script


Circle Script


2009-02-12 Pygame Border Coalision

I wanted to know how many simple object can be drawn by Pygame. Red point is starting point for flying bullets. And only thing with bullets have coalision is screen border. You can shut new bullets with mouse.


Download Script


After some optimisations script works faster.

Download Script v2


Also I have implemented the same on C++.

Download Source


2009-02-14 PyGame Bullets with Boxes

You can shut your bullets and they will contact with difrent boxes with diffrent result there is boxes that speed up, freeze, slow down bullets.


Download


2009-03-18 PyGame Post

Wanted to know how will looks when mousepointer moving and all arrows shows it direction


Download


2009-04-13 Map Editor

This is simple map editor for small games. Also I think it will be useful for other people who started writing game and made first test maps.

Download


2009-04-15 PyGame Rotating Flower

Flower where all list rotating around lists.

SDownload


2009-05-07 PyGame Attractors

I have found old article about attractors that is resoult what I have done with playing with attractor values. Attractor formula is very simple but result is interesting.


2009-06-02 Voronoi distance

I where interested to see how looks visualy distance to the closest point. When I saw result i remembered that it is Voronoi diagramm.


Download


2009-08-23 Python PyGame Tutorial


Python Pygame tutorial. This tutorial goal show how to make small and simple pygame pythone script that include all that is need for bigger application. Every tutorial part add only few new lines of code.

Moving Boxes

Goal

Make featured applications with boxes that coaliding one with another.

1. [Set Display]
2. [Event Sytem]
3. [Image loading]
4. [Box object]
5. [Box move]
6. [Boxes move]
7. [Randomnes]
8. [Fullscreen]


2009-09-15 Python Pygame Tutorial Box Move

added constants that helps controlling screen size

SCREEN_X = 500
SCREEN_Y = 500
BOX_SIZE = 20
BOX_SPEED = 1
box have speed by axis
self.dx = BOX_SPEED
self.dy = BOX_SPEE
detecting if given rect is inside screen borders or not if not then change it direction
def move( self ):
        if self.rect.left+BOX_SIZE > SCREEN_X:
            self.dx = -BOX_SPEED
        if self.rect.left < 0:
            self.dx = BOX_SPEED
        if self.rect.top+BOX_SIZE > SCREEN_Y:
            self.dy = -BOX_SPEED
        if self.rect.top < 0:
            self.dy = BOX_SPEED
        self.rect.left += self.dx
        self.rect.top += self.dy
after few line of code where added box move inside given screen and coalide with screen borders

Tutorial Source


2009-09-23 PyGame Lorenz attractor

Here is Lorenz attractor whery popular attractor i have used basic coloring tehnique.

Script

PovRay source


2009-09-23 Python Pygame Tutorial Boxes Move

New class boxes handles many boxes. Number of boxes depends on cpnstant MAX_BOXES.

MAX_BOXES = 100

and all class Boxes methods is the same only diference is that it handles many boxes.

Tutorial Source


2009-09-23 Python Pygame Tutorial Randomnes

All boxes moving with same speed in same directions and all boxes have same size and color
Make changes step by step to see result

self.dx = randint(1,BOX_SPEED)
self.dy = randint(1,BOX_SPEED)
and boxes now moving all seperatly at diferent directions.
self.boxes.append( Box( i*2 , i*2 , randint(BOX_MIN_SIZE,BOX_MAX_SIZE) ,
(i,0,0) )
now boxes have diferent sizes

Tutorial source


2009-11-12 Python PyGame Tutorial Fullscreen

added new variable tha tcheck in with mode now screen is
fullscreen = False

Used new event type

if event.type == pygame.KEYDOWN:

When pressing key m we making new screen surface in fullscreen mode. If screen is in fuulscreen mode make window.

if event.key == pygame.K_m:		
  if not fullscreen:
    screen = pygame.display.set_mode( (SCREEN_X,SCREEN_Y) , pygame.FULLSCREEN )
    fullscreen = True
  else:
    screen = pygame.display.set_mode( (SCREEN_X,SCREEN_Y) )
    fullscreen = False



Tutorial Source


© 2010