我想这里和一般编程都很新,决定向其他人寻求帮助。
import sys,os
import pygame
black = ( 0, 0, 0)
white = ( 255, 255, 255)
green = ( 0, 255, 0)
red = ( 255, 0, 0)
blue = ( 0, 0, 255 )
pygame.init()
# Set the width and height of the screen [width,height]
size=[700,500]
screen=pygame.display.set_mode(size)
pygame.display.set_caption("DN[A]")
#Loop until the user clicks the close button.
done=False
# Used to manage how fast the screen updates
clock=pygame.time.Clock()
FPS=60
#Loading images below.
n=1
z=1
maxint=10
minint=-maxint
# -------- Main Program Loop -----------
while done==False:
for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT:
done=True
# above this, or they will be erased with this command.
screen.fill(black)
x,y=pygame.mouse.get_pos()
for i in range(size[1]):
screen.set_at((x,y),blue)
x+=1
y+=n
n+=z
if n==maxint or n==minint:
z=-z
pygame.display.flip()
clock.tick(FPS)
pygame.quit ()
所以基本上,如果 maxint 为 10,它会得到反映。我的目标是 maxint 为 5 时的结果。有人知道为什么会这样吗?
此外,当它是 6 或任何其他数字时,它会变得更加陌生。