当前位置: 首页>>代码示例>>Python>>正文


Python art.spot函数代码示例

本文整理汇总了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)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:31,代码来源:physicsQuestion.py

示例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)
开发者ID:LizzTebbutt,项目名称:tealight-files,代码行数:26,代码来源:orbits.py

示例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)
  
  
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:29,代码来源:orbits.py

示例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)
开发者ID:jonathan-dilorenzo,项目名称:tealight-files,代码行数:34,代码来源:orbits.py

示例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")
开发者ID:AimeeH,项目名称:tealight-files,代码行数:7,代码来源:Minesweeper.py

示例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)
  
  

  
  
开发者ID:BasRegi,项目名称:tealight-files,代码行数:20,代码来源:orbits.py

示例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)
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:28,代码来源:orbits.py

示例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)
开发者ID:jackm110,项目名称:tealight-files,代码行数:10,代码来源:Project.py

示例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
开发者ID:chloea,项目名称:tealight-files,代码行数:10,代码来源:connect4.py

示例10: handle_keydown

def handle_keydown(keychar, keyval):
  global x,y
  x += 10
  y += 10
  
  
  
  
  
  spot(x,y,5)
  print keychar
开发者ID:daviesian,项目名称:tealight-files,代码行数:11,代码来源:keyboard_test.py

示例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

  
  
开发者ID:GriffithsBen,项目名称:tealight-files,代码行数:8,代码来源:DetectionGrid.py

示例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)
开发者ID:pb471,项目名称:tealight-files,代码行数:13,代码来源:Ising1.py

示例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)
开发者ID:NayfS,项目名称:tealight-files,代码行数:13,代码来源:Minesweeper.py

示例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)
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:14,代码来源:shapes.py

示例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
开发者ID:chandler6,项目名称:tealight-files,代码行数:15,代码来源:connectcountersgravity.py


注:本文中的tealight.art.spot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。