|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
position是获取图片位置矩形,实现效果是图片绕着窗口移动
if position.right > width:
photo = photo_right
position = photo_rect = photo.get_rect()
position.left = width - photo_rect.width
speed = [0, 5]
if position.bottom > height:
photo = photo_bottom
position = photo_rect = photo.get_rect()
position.left = width - photo_rect.width
position.top = heigth - photo_rect.height
speed = [-5, 0]
if position.left < 0:
photo = photo_left
position = photo_rect = photo.get_rect()
position.top = height - photo_rect.height
speed = [0, -5]
if position.top < 0:
photo = photo_top
position = photo_rect = photo.get_rect()
speed = [5, 0]
在这四个if里面为什么要分别修改position的left和top啊 |
|