Monday, June 15, 2009

21 POUNDS

21 POUNDS

A 1 pound coin bouncing randomly with a 20 pound note in the background ! Another PyGame creation !

Fig 1. 21 Pounds

Fig 2. 21 Pounds

Fig 3. 21 Pounds

OBSERVATIONS AND THE CODE

The code is somewhat different than my earlier PyGame creations. Further, there is a parameter 'e' to slow down the speed of the 1 Pound coin. At e = 0.98 the 1 Pound coin comes to a stop after about 141 seconds , at the upper left corner of the pygame screen. For e = 1 , the coin never comes to stop while for e > 1 , the motion becomes faster and erroneous and the software rejects it after some time.


Video 1. 21 Pounds

The PyGame screen is also made to suit to that of the 20 pound note (591 x 326) and not the usual (640 x 480).

Fig 4. 21 Pounds , the code

It is also worth noting that random motion is obtained without the use of the random module.

REFERENCES

(1) Daniweb , http://www.daniweb.com/code/snippet758.html
(2) source code and images , http://code.google.com/p/pygame-21pounds/downloads/list

Friday, June 5, 2009

MAKING A FIRE !

PYGAME FIRE

Trying to animate a fire , using python game platform , pygame. I got the fire 'to life' by combining together 16 different sketches or 'sprites'. The primary plume and the wood being the static parts while the other smaller portions of the flame being in repetitive motion. Black is used as background for best contrast.

Fig1.Fire, Screen-Shot 1

Fig2. Fire , Screen-Shot 2

Superimposing the main plume with 14 other minor plume allows creating a seeming movement of the flames upward.


Fig 3. Without the main plume (14 minor plumes and the wood)


Video 1. PyGame Fire

The 'effect' is created by motion of the 14 sprites both in horizontal and vertical axis and the variation of the colour. Not often 16 different pieces are sewn together to form an animation in PyGame.

Some tweaking has to be done with the various parameters in order to 'liven-up' the fire.

REFERENCES


(1) Source code and sketches , http://code.google.com/p/pygame-fire/downloads/list

Monday, June 1, 2009

CHERRYPY : HELLO WORLD

HELLO CHERRY

CherryPy is a python based web-development tool. The traditional 'hello world' is scripted as follows.

Fig 1. 'Hello World' in CherryPy

After running the program , on opening http://localhost:8080/


Fig 2. In Firefox

Fig 3. In Safari

REFERENCES
(1) CherryPy Website