I am using PyGame 1.9.2 on Python 3.4.3 (Win8.1).
My game window consists of a tiled map using 48x48px tiles. The game frame moves the tiles according to the input of the player using the following method of the game framework class:
def moveTiles(self):
xmove = self.parent.dt * self.panning[0] * self.panning_speed
ymove = self.parent.dt * self.panning[1] * self.panning_speed
for tile in self.game_map:
tile.x += xmove
tile.y += ymove
tile.rect.x = int(tile.x)
tile.rect.y = int(tile.y)
tile.pos = (tile.rect.x, tile.rect.y)
While self.panning_speed is pretty straightforward, self.panning is a list containing two values for x and y pan (for example, [0, 0] = no pan, [-1, 1] = pan down - left and t .d.).
The values of tile.x / tile.y then "int'ed" are used as the x- / y-values of rect and pos (the latter is used for blitting).
x/y , "int", , , float int. , x/y , / .
: ! , , , , , .
:
( - , - )
?