Now I’m calling this set of free and open art for my and others games I draw just by Openpixels. And to celebrate this and Christmas, here’s a pixel art game style Santa Claus. I hope he bring a lot a pixels in his bag.
This is a simple space effect of sliding stars using Pygame.
Direct link to video: simple_space_effect_01.ogv
We set some constants like the screen size and the number N of star we want.
N = 200 SCREEN_W, SCREEN_H = (640, 480)
Using list comprehension we create a list of random points in the screen, that will be our stars. The size of this list is N.
stars = [ [random.randint(0, SCREEN_W),random.randint(0, SCREEN_H)] for x in range(N) ]
Each star is represented by one tuple on the stars list. The first star is on stars and is a touple with [x, y] positions.
for star in stars: pygame.draw.line(background, (255, 255, 255), (star, star), (star, star)) star = star - 1 if star < 0: star = SCREEN_W star = random.randint(0, SCREEN_H)
In this example we update the position of a star by decreasing its horizontal position. When the horizontal position is less than zero, it’s not displayed on the screen anymore so we replace its horizontal position (star) by the screen width (SCREEN_W) and the vertical position (star) by a new random position. This will be like create a new star and guarantee always a different pattern of sliding stars.
The complete code:
#!/usr/bin/env python # A simple effect of sliding stars to create a deep space sensation. # by Silveira Neto <email@example.com> # Free under the terms of GPLv3 license # See http://silveiraneto.net/2009/08/12/pygame-simple-space-effect/ import os,sys,random import pygame from pygame.locals import * # Constants N = 200 SCREEN_W, SCREEN_H = (640, 480) def main(): # basic start pygame.init() screen = pygame.display.set_mode((SCREEN_W,SCREEN_H)) pygame.display.set_caption('Simple Space Effect by Silveira Neto') # create background background = pygame.Surface(screen.get_size()) background = background.convert() # generate N stars stars = [ [random.randint(0, SCREEN_W),random.randint(0, SCREEN_H)] for x in range(N) ] # main loop clock = pygame.time.Clock() while 1: clock.tick(22) for event in pygame.event.get(): if event.type == QUIT: return elif event.type == KEYDOWN and event.key == K_ESCAPE: return background.fill((0,0,0)) for star in stars: pygame.draw.line(background, (255, 255, 255), (star, star), (star, star)) star = star - 1 if star < 0: star = SCREEN_W star = random.randint(0, SCREEN_H) screen.blit(background, (0,0)) pygame.display.flip() if __name__ == '__main__': main()
My laptop broke and I lose the newest versions of some of my drawing. Fortunately I had backups for most of them. I found out that I had not published the 10th version yet. Here it is.
As usual is just little improvements over the last version. This time I added some geography elements. It’s now possible to create little levels and simple island.
More scenes and tiles for the free and open pixelart tileset. Also new monsters and characters but these will be showed in more details in another post.
Scientists discovery that they can’t keep a Gjelly (one of the new monsters) in cages.
And also a little medieval scene. A naive princess got a Nhamnham monster as her pet.
A new village scene, now with a pier, water, fence and new chars.
There’s a plenty of new tiles. Now that we have a good basic tiles becomes easy to add more tiles.
One more version of the my free tileset for game development. This little world is beautifully growing, now towards medieval themes. Now is already possible to imagine a typical day in a little rpg village:
And here the tileset, eighth version: