Skip to content

Tag: Pixelart

Pygame: Running Orcs

Here is a Pygame Sprite animation using the approach presented by Joe Wreschnig and Nicolas Crovatti. It’s not yet exactly what I need but is very suitable.

import pygame, random
from pygame.locals import *
class Char(pygame.sprite.Sprite):
	x,y = (100,0)
	def __init__(self, img, frames=1, modes=1, w=32, h=32, fps=3):
		original_width, original_height = img.get_size()
		self._w = w
		self._h = h
		self._framelist = []
		for i in xrange(int(original_width/w)):
		self.image = self._framelist[0]		
		self._start = pygame.time.get_ticks()
		self._delay = 1000 / fps
		self._last_update = 0
		self._frame = 0
		self.update(pygame.time.get_ticks(), 100, 100)	
	def set_pos(self, x, y):
		self.x = x
		self.y = y
	def get_pos(self):
		return (self.x,self.y)
	def update(self, t, width, height):
		# postion
			self.x = random.randint(0,height-self._w)
			self.y = -self._h
		# animation
		if t - self._last_update > self._delay:
			self._frame += 1
			if self._frame >= len(self._framelist):
				self._frame = 0
			self.image = self._framelist[self._frame]
			self._last_update = t
SCREEN_W, SCREEN_H = (320, 320)
def main():
	screen = pygame.display.set_mode((SCREEN_W, SCREEN_H))
	background = pygame.image.load("field.png")
	img_orc = pygame.image.load("orc.png")
	orc = Char(img_orc, 4, 1, 32, 48)
	while pygame.event.poll().type != KEYDOWN:
		screen.blit(background, (0,0))
		screen.blit(orc.image,  orc.get_pos())
		orc.update(pygame.time.get_ticks(), SCREEN_W, SCREEN_H)
if __name__ == '__main__': main()

Here is it working:

Uptade: I put this source and images at the OpenPixel project in Github

Palestra Pixel Art na Biblioteca Dolor Barreira

Este sábado (22 de Agosto) estarei na Biblioteca/Gibiteca Dolor Barrera para uma palestra sobre Pixel Art.

Horário: 10 am.
Local: Biblioteca Dolor Barreira, Avenida da Universidade, 2572. Fortaleza, Ceará.


O evento é gratuito e faz parte de uma programação semanal de palestras que acontecem no local. Vale a pena comparecer não só pela palestra mas também para conhecer a gibiteca que conta com um excelente acervo de gibis e mangas.

Confira também o blog e o twitter da gibiteca.

Atualizado: Fotos do evento no Flickr.

My Free Tileset, version 10

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.

pixelart free tileset version 10

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.