• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python art.spot函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tealight.art.spot函数的典型用法代码示例。如果您正苦于以下问题:Python spot函数的具体用法?Python spot怎么用?Python spot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了spot函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: drawcircle

def drawcircle(player, x, y, grid):
  
  color(player)
  
  xloc = 125 + (x*80)
  yloc = 125 + (y*80)
  
  spot(xloc, yloc, 37.5)
  
  grid[x][y] = player
  
  for i in range(8):
    print grid[i]
  
  return grid
开发者ID:DrSwag,项目名称:tealight-files,代码行数:15,代码来源:connectfour.py


示例17: handle_frame

def handle_frame():
  global x,y,vx,vy,ax,ay
  
  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:Orthoc,项目名称:tealight-files,代码行数:15,代码来源:orbits.py


示例18: handle_frame

def handle_frame():
  global x,y,vx,vy,ax,ay
  
  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:NayfS,项目名称:tealight-files,代码行数:15,代码来源:orbits.py


示例19: handle_frame

def handle_frame():
  global x,y,vx,vy,ax,ay
  
  color("red")
  
  spot (x,y,25)
  vx = vx + ax
  vy = vy + ay
  
  x = x + vx
  y = y + vy
  
  color("black")
  
  spot (x,y,25)
  
开发者ID:chandler6,项目名称:tealight-files,代码行数:15,代码来源:orbits.py


示例20: drawGrid

def drawGrid():
  font("100px arial")
  text(250,55, "Connect 4")

  color("blue")
  box(offset_x,offset_y,700,700)

  
  x=offset_x + 49
  y=offset_y +49

  for i in range(0,7):
    for j in range(0,7):
      color("white")
      spot(x+i*100,y+j*100,35)
  color("black")
开发者ID:BasRegi,项目名称:tealight-files,代码行数:16,代码来源:connect4_grid.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logo.move函数代码示例发布时间:2022-05-27
下一篇:
Python art.line函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap