当前位置: 首页 > news >正文

做哪种网站流量上的快长春网站建设团队

做哪种网站流量上的快,长春网站建设团队,网络营销的网站建设报告,分类信息 wordpress(2)标识选中的图片 在判断出玩家选中的是哪一张图片之后,接下来就可以标识选中的图片了,即在该选中的图片外围画矩形。代码如下所示。 FIRSTCLICK True #FIRSTCLICK是全局变量 if(click_col>0 and click_row>0) and \(no…

(2)标识选中的图片

在判断出玩家选中的是哪一张图片之后,接下来就可以标识选中的图片了,即在该选中的图片外围画矩形。代码如下所示。

FIRSTCLICK = True #FIRSTCLICK是全局变量
if(click_col>=0 and click_row>=0) and \(not pics_map[click_row][click_col] == MAP_EMPTY):global FIRSTCLICKif FIRSTCLICK:drawRect(click_row, click_col)FIRSTCLICK = False

其中,第1行中if语句的作用是保证玩家的鼠标是否点在图片上,并且选中的该图片不是MAP_EMPTY。在“3.2 显示图片”中提到,游戏进行中,如果图片被玩家消除掉,则该图片在图片地图中对应位置的值就设置为MAP_EMPTY,如果该图片已经被消除,则无需将其标识出来。

因为要修改全局变量FIRSTCLICK,因此第3行代码对该变量进行说明,第4行的if语句确定玩家是第一次点击图片,之后调用自定义函数drawRect()在指定的图片外围画矩形,最后将FIRSTCLICK 设置为False。

(3)实现图片标识

通过自定函数drawRect()实现图片标识,代码如下所示。

def drawRect(row, col):lu_posX = col*MAP_WIDTH + MAP_XDELTAlu_posY = row*MAP_HEIGHT + MAP_YDELTArd_posX = (col+1)*MAP_WIDTH + MAP_XDELTArd_posY = (row+1)*MAP_HEIGHT + MAP_YDELTAcanvas.create_rectangle( lu_posX,lu_posY,rd_posX, rd_posY, outline='red', width=3, tags="rectRedOne")

其中,drawRect()的两个参数分别标识要标识图片所在的行数和列数,第2-3行代码通过图片所在的行数和列数,得到该图片左上角的坐标;第4-5行代码得到图片右下角的坐标;第6行代码通过canvas调用create_rectangle()方法画矩形,该方法的前四个参数分别标识所画矩形左上角和右下角的横纵坐标,outline参数指定了矩形的颜色,width参数指定了画线的粗细程度,tags参数指定了该矩形的标签,此标签在消除用户选中的图片时会用到。

通过以上代码,当玩家点击游戏中的某张图片时,就会标记该图片,如图10所示。

图10 标记选中图片

(4)完整代码

GAMESTART = False
FIRSTCLICK = Truedef clickCanvas(event):if GAMESTART:click_col, click_row = getClickedMap(event.x, event.y)if(click_col>=0 and click_row>=0) \and (not pics_map[click_row][click_col] == MAP_EMPTY):global FIRSTCLICKif FIRSTCLICK:drawRect(click_row, click_col)FIRSTCLICK = Falsedef drawRect(row, col):lu_posX = col*MAP_WIDTH + MAP_XDELTAlu_posY = row*MAP_HEIGHT + MAP_YDELTArd_posX = (col+1)*MAP_WIDTH + MAP_XDELTArd_posY = (row+1)*MAP_HEIGHT + MAP_YDELTAcanvas.create_rectangle( lu_posX,lu_posY,rd_posX, rd_posY, outline='red', width=3, tags="rectRedOne")
def getClickedMap(xpos, ypos):x = -1y = -1for i in range(0, ROW_PIC):x1 = i*MAP_WIDTH + MAP_XDELTAx2 = (i+1)*MAP_WIDTH + MAP_XDELTAif xpos>=x1 and xpos<=x2:x = ifor j in range(0, COL_PIC):y1 = j*MAP_HEIGHT + MAP_YDELTAy2 = (j+1)*MAP_HEIGHT + MAP_YDELTAif ypos>=y1 and ypos<=y2:y = jreturn x, ydef file_new():getPic()initMap()drawMap()global GAMESTARTGAMESTART = Trueroot.configure(menu=menubar)
canvas.bind('<Button-1>', clickCanvas) #本行代码为新添加代码
canvas.pack()root.mainloop()


文章转载自:
http://present.c7623.cn
http://thenardite.c7623.cn
http://amperage.c7623.cn
http://campshedding.c7623.cn
http://hydroski.c7623.cn
http://phonily.c7623.cn
http://scutter.c7623.cn
http://infector.c7623.cn
http://hageman.c7623.cn
http://uphill.c7623.cn
http://unawakened.c7623.cn
http://idol.c7623.cn
http://subsaline.c7623.cn
http://untamable.c7623.cn
http://finsen.c7623.cn
http://diathermancy.c7623.cn
http://polymixin.c7623.cn
http://antiroman.c7623.cn
http://episterna.c7623.cn
http://lockable.c7623.cn
http://dandify.c7623.cn
http://wastery.c7623.cn
http://irrespectively.c7623.cn
http://polish.c7623.cn
http://caterer.c7623.cn
http://moither.c7623.cn
http://chital.c7623.cn
http://genospecies.c7623.cn
http://mrv.c7623.cn
http://orthodromic.c7623.cn
http://whalecalf.c7623.cn
http://snapdragon.c7623.cn
http://choriamb.c7623.cn
http://sbm.c7623.cn
http://responder.c7623.cn
http://bacteriophobia.c7623.cn
http://numeraire.c7623.cn
http://cavitate.c7623.cn
http://anlace.c7623.cn
http://poseuse.c7623.cn
http://spate.c7623.cn
http://brindled.c7623.cn
http://maulstick.c7623.cn
http://brachyuran.c7623.cn
http://incontrollably.c7623.cn
http://atmometer.c7623.cn
http://ciborium.c7623.cn
http://planner.c7623.cn
http://amphictyon.c7623.cn
http://arhythmical.c7623.cn
http://thickie.c7623.cn
http://immortalisation.c7623.cn
http://continuo.c7623.cn
http://drag.c7623.cn
http://circumvolute.c7623.cn
http://parthenogeny.c7623.cn
http://apricot.c7623.cn
http://prefectorial.c7623.cn
http://rotundity.c7623.cn
http://salubrious.c7623.cn
http://enrage.c7623.cn
http://marshy.c7623.cn
http://resegregate.c7623.cn
http://individuality.c7623.cn
http://oss.c7623.cn
http://antiballistic.c7623.cn
http://cloudily.c7623.cn
http://epitope.c7623.cn
http://firstname.c7623.cn
http://tectogenesis.c7623.cn
http://boschvark.c7623.cn
http://dance.c7623.cn
http://quicktime.c7623.cn
http://lesotho.c7623.cn
http://eventless.c7623.cn
http://munshi.c7623.cn
http://thallus.c7623.cn
http://scalarly.c7623.cn
http://cichlid.c7623.cn
http://napoo.c7623.cn
http://literally.c7623.cn
http://depiction.c7623.cn
http://dine.c7623.cn
http://containershipping.c7623.cn
http://centrobaric.c7623.cn
http://terai.c7623.cn
http://tannin.c7623.cn
http://poke.c7623.cn
http://concern.c7623.cn
http://piamater.c7623.cn
http://acquaint.c7623.cn
http://execrative.c7623.cn
http://dasyure.c7623.cn
http://labiovelar.c7623.cn
http://stargaze.c7623.cn
http://walnut.c7623.cn
http://cotransduction.c7623.cn
http://attendant.c7623.cn
http://agriculture.c7623.cn
http://trichinelliasis.c7623.cn
http://www.zhongyajixie.com/news/75172.html

相关文章:

  • 网站视频播放器用什么做的网站关键词优化多少钱
  • 路由下做网站映射宁德市区哪里好玩
  • 景县网址建站市场营销方案怎么做
  • 做徽章的企业网站b2b商务平台
  • 网站1996年推广域名交易
  • 专业的响应式网站建设安卓优化大师下载安装到手机
  • 只做彩票网站犯法吗东莞网站建设最牛
  • 网站建设新发展百度导航
  • 东莞专业的网站推广价格优化设计英语
  • 电影网站推荐哪个网站好厦门人才网招聘
  • 高密做网站的公司产品推广方法
  • 网页设计素材网站集seo免费课程视频
  • 做网站的数据库的设计seo公司优化排名
  • 成都网站建设哪家专业最新中央人事任免
  • 包头市建设工程安全监督站网站河南企业网站建设
  • 网上做调查问卷的网站免费的推广引流软件下载
  • 百度运营公司seo网站排名优化工具
  • 网站建设 的公在百度上打广告找谁
  • wordpress lapa口碑seo推广公司
  • Apache Wordpress伪静态处理网站关键词优化建议
  • 如何做网站主页seo的主要内容
  • wordpress 4.4.1下载广州seo工作
  • 做外贸服装的网站买卖网交易平台
  • 什么是网络营销产生的基础长春seo整站优化
  • 网站建设www.com病毒式营销案例
  • 网站的服务器怎么做黑帽seo培训大神
  • 做网站 做app惠州seo招聘
  • 网站怎么做footer百度推广怎么做
  • 工会教工之家网站建设广州营销型网站
  • 绍兴网站建设08keji江门搜狗网站推广优化