Exemple #1
0
def update_cell_position(cell, speed):
	x = palgame.get_x(cell)
	y = palgame.get_y(cell)
	xdir = palgame.get_xdir(cell)
	ydir = palgame.get_ydir(cell)

	if x > SCREEN_WIDTH or x < 0:
		xdir = -1 * xdir
	if y > SCREEN_HEIGHT or y < 0:
		ydir = -1 * ydir
	x = x + xdir * speed
	y = y + ydir * speed

	palgame.set_x(cell, x)
	palgame.set_y(cell, y)
	palgame.set_xdir(cell, xdir)
	palgame.set_ydir(cell, ydir)
Exemple #2
0
def update_user_cell_position(cell):
	vx, vy = palgame.get_user_direction(palgame.get_x(cell), palgame.get_y(cell), palgame.get_radius(cell))
	new_x = palgame.get_x(cell) + vx
	palgame.set_x(cell, new_x)
	new_y = palgame.get_y(cell) + vy
	palgame.set_y(cell, new_y)