本文整理汇总了Python中tealight.art.spot函数的典型用法代码示例。如果您正苦于以下问题:Python spot函数的具体用法?Python spot怎么用?Python spot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_frame
def handle_frame():
global x,y,vx,vy,constant,n
n = n + 1
for i in range(0,len(x)):
color("white")
spot(x[i],y[i],2)
vx[i] = vx[i] + constant[i]
angle = math.atan2(-vy[i],vx[i]) + (math.pi / 2)
fx = 1 * math.cos(angle)
fy = -1 * math.sin(angle)
vxa = vx[i] + fx
vya = vy[i] + fy
factor = math.sqrt(vx[i]**2 + vy[i]**2) / math.sqrt(vxa**2 + vya**2)
vx[i] = vxa * factor
vy[i] = vya * factor
x[i] = x[i] + vx[i]
y[i] = y[i] + vy[i]
color("black")
spot(x[i],y[i],2)
示例2: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
if 1000 < y:
vy=-vy
elif y < 1:
vy=-vy
if 910 < x:
vx=-vx
elif x < 1:
vx=-vx
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
x = x + vx
y = y + vy
color("blue")
spot(x,y,8)
示例3: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
#gravity
vy = vy + gravity
apply_gravity()
#friction
vx = apply_friction(vx)
vy = apply_friction(vy)
x = x + vx
y = y + vy
color("blue")
spot(x,y,8)
示例4: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
x2 = x + vx
y2 = y + vy
if x2 < 0:
x=-x2
vx=-vx
elif x2 > screen_width:
x=screen_width*2-x2
vx=-vx
else:
x=x2
if y2 < 0:
y=-y2
vy=-vy
elif y2 > screen_height:
y=screen_height*2-y2
vy=-vy
else:
y=y2
color("blue")
spot(x,y,8)
示例5: flag
def flag(i,j):
color("red")
tx = startx + size/2 + i * size
ty = starty + size/2 + j * size
spot(tx, ty, size/3)
color("black")
text(tx - size/10, ty - size/10, "F")
示例6: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = (vx*0.95) + ax
vy = (vy*0.95) + ay + 0.1
x = x + vx
y = y + vy
color("blue")
if x<=0 or x>=900:
vx = -vx
ax = (-0.8*ax)
elif y<=0 or y>=1000:
vy = -vy
ay = (-0.8*ay)
spot(x,y,8)
示例7: handle_frame
def handle_frame():
global x,y,vx,vy
color("white")
spot(x,y,8)
rx = x - screen_width / 2
ry = y - screen_height / 2
magsq = rx**2 + ry**2
if magsq != 0:
# normalise
mag = sqrt(magsq)
rx /= mag
ry /= mag
# apply inverse square rule
rx *= g/magsq
ry *= g/magsq
vx -= rx / m
vy -= ry / m
x = x + vx
y = y + vy
color("blue")
drawship(x, y, 0)
示例8: DrawBomb
def DrawBomb(x,y):
color("red")
box(x*34+182,y*34+202,32,32)
centrex = 199 + 34 * x
centrey = 219 + 34 * y
color("black")
spot(centrex,centrey,10)
示例9: handle_mousedown
def handle_mousedown(x,y,button):
global turn
if button == "left" and turn ==1:
color("red")
spot(x,y,45)
turn =2
elif button == "left" and turn ==2:
color("yellow")
spot (x,y,45)
turn =1
示例10: handle_keydown
def handle_keydown(keychar, keyval):
global x,y
x += 10
y += 10
spot(x,y,5)
print keychar
示例11: handle_mousedown
def handle_mousedown(x,y):
global Array_X
global Array_y
spot(x,y,10)
Array_X = x
Array_Y = y
print x
print y
示例12: AddPoint
def AddPoint(self, px, py, pz):
#Get fractional co-ords
frac_px = float(px)/self.x_lim[1]
frac_py = float(py)/self.y_lim[1]
#Convert to pixels
pixel_x = self.pos[0] + 0.5*(1.0+frac_px)*self.width[0]
pixel_y = self.pos[1] + 0.5*(1.0+frac_py)*self.width[1]
coloffset_z = 40
col = [255-int(abs(pz)*coloffset_z), 0,0 + int(abs(pz)*coloffset_z), 0.1]
color(coltostr(col))
spot(pixel_x, pixel_y, 3)
示例13: handle_mousedown
def handle_mousedown(x, y,button):
global score
boxX = floor(x/60)
boxY = floor(y/60)
if boxX<10:
if boxY<10:
if ingame == 1:
if button=="left":
uncover(boxX, boxY)
if button=="right"and get(mine, boxX, boxY)!=2:
color("green")
spot(boxX*60 +25 ,boxY*60 + 25,10)
示例14: handle_mousemove
def handle_mousemove(x, y, button):
ox = (x - 300) / 15
oy = (y - 200) / 15
if ox**2 + oy**2 > (50-20)**2:
ratio = float(ox**2 + oy**2) / (50-20)**2
ox /= ratio
oy /= ratio
color("white")
spot(300, 200, 49)
color("black")
spot(300 + ox, 200 + oy, 20)
示例15: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
box(0,0,screen_width,screen_height)
color("black")
spot(x, y, 20)
vx = (vx+ax)*0.97
vy = vy + ay +0.12
if vy > 10:
vy =10
x = x + vx
y = y + vy