vendredi 3 avril 2015

Python v2.7. PyGame. Difference in pixels size between image.load and image.fill

I'm trying make a simple game on Python v2.7 (something like a danmaku shooter)


I've got problem with this part



import os
from pygame import *

MOVE_SPEED = 3
WIDTH = 10
HEIGHT = 10
COLOR = "#F52525"

class Player(sprite.Sprite):
def __init__(self, x, y):
sprite.Sprite.__init__(self)
self.xvel = 0
self.yvel = 0
self.startX = x
self.startY = y
self.image = Surface((WIDTH,HEIGHT))
#self.image.fill(Color(COLOR))
self.image = image.load("images/player.png")
self.rect = Rect(x, y, WIDTH, HEIGHT)


"player.png" size is 40x60, but I need in actual size 10x10 rectangle at the center of image which will interact with the game logic (with option to display over or not).


Aucun commentaire:

Enregistrer un commentaire