【教程】使用BitmapData来管理和进行纸牌游戏【2】

如何实现高校科技成果快速转化?.docx 如何实现高校科技成果快速转化? 立即下载

导读:


还记得前几天说过的用Bitmap来管理纸牌游戏的帖子嘛,作者又发出了他最近的代码,介绍如下



  At the moment the prototype has all messages and a game over screen with the score recap.
  Now I want to include Kongregate's highscores APIand then I'll releae the complete tutorial.


到现在为止,纸牌游戏的内容便告一段落了。下面我们将发布完整的教程,下面是代码
  Meanwhile, here it is the code:
  ACTIONSCRIPT:
  importflash.display.BitmapData
  importflash.geom.Rectangle
  importflash.geom.Point
  importflash.filters.DropShadowFilter
  importflash.filters.GlowFilter
  varcard_shadow:DropShadowFilter = newDropShadowFilter(4, 45, 0x000000, .5, 4, 4, 1, 3, false, false, false)
  vartext_glow:GlowFilter = newGlowFilter(0x000000, .6, 4, 4, 2, 3, false, false)
  big_picture = BitmapData.loadBitmap("cardz")
  _root.attachMovie("table", "table", _root.getNextHighestDepth())
  _root.createEmptyMovieClip("game", _root.getNextHighestDepth())
  game.attachMovie("higher", "higher", game.getNextHighestDepth())
  game.attachMovie("lower", "lower", game.getNextHighestDepth())
  game.createEmptyMovieClip("big_pic_obj", game.getNextHighestDepth())
  big_pic_obj.attachBitmap(big_picture, game.getNextHighestDepth())
  big_pic_obj._visible= false
  sequence = newArray()
  Array.prototype.shuffle= function(){
  for(x=0x<52x++){
  varfrom = Math.floor(Math.random()*52)
  varto = this[x]
  this[x]= this[from]
  this[from]= to;
  }
  }
  for(x=0x<52x++){
  card = game.createEmptyMovieClip("small_pic_obj_"+x, game.getNextHighestDepth())
  sequence[x]= x;
  small_picture = newBitmapData(79, 123)
  card.attachBitmap(small_picture, game.getNextHighestDepth())
  small_picture.copyPixels(big_picture, newRectangle(0+(x%13)*79, 0+Math.floor(x/13)*123, 79, 123), newPoint(0, 0))
  card._visible= false
  card.filters= newArray(card_shadow)
  card.onEnterFrame= function(){
  switch(this.action){
  case"come":
  this._x+= 40
  if(this._x>210){
  this._x= 210
  this.action= "stay"
  if(cards_drawn>1){
  game.ok_ko._visible= true
  }
  }
  break
  case"move":
  this._x+= 20
  if(this._x>310){
  this._x= 310
  this.action= "dissolve"
  }
  break
  case"dissolve":
  this._alpha-= 4
  game.lap_score._alpha-= 4
  if(this._alpha<0){
  can_draw = true
  game.ok_ko._visible= false
  if(cards_drawn == 52){
  endgame()
  }
  this.removeMovieClip()
  }
  break
  }
  }
  }
  game.attachMovie("ok_ko", "ok_ko", game.getNextHighestDepth(), {_x:250, _y:230, _visible:false})
  game.attachMovie("score", "score", game.getNextHighestDepth(), {_x:0, _y:140})
  game.attachMovie("lap_score", "lap_score", game.getNextHighestDepth(), {_x:-50, _y:0, _alpha:0})
  game.score.filters= newArray(text_glow)
  game.lap_score.filters= newArray(text_glow)
  sequence.shuffle()
  cards_drawn = 0
  points = 0
  can_draw = true
  draw_card()
  game.higher.onRelease= function(){
  if(can_draw){
  can_draw = false
  higher = true
  draw_card()
  }
  }
  game.lower.onRelease= function(){
  if(can_draw){
  can_draw = false
  higher = false
  draw_card()
  }
  }
  functiondraw_card(){
  game.ok_ko.gotoAndStop(2)
  lap = 0
  if(((sequence[cards_drawn]%13)<=(sequence[cards_drawn-1]%13)and(!higher))or ((sequence[cards_drawn]%13)>=(sequence[cards_drawn-1]%13)and(higher))){
  game.ok_ko.gotoAndStop(1)
  game.lap_score.lap_text.textColor= 0x40ff40;
  if(cards_drawn>0){
  if(!higher){
  lap = 13-(sequence[cards_drawn-1]%13)
  }else{
  lap = sequence[cards_drawn-1]%13+1
  }
  }
  }else{
  lap = -5
  game.lap_score.lap_text.textColor= 0x900000;
  }
  game.lap_score.lap_text.text= lap;
  if(cards_drawn>0){
  game.lap_score._alpha= 100
  }
  points += lap;
  game["small_pic_obj_"+sequence[cards_drawn]]._x= 0
  game["small_pic_obj_"+sequence[cards_drawn]]._y= 10
  game["small_pic_obj_"+sequence[cards_drawn]]._visible= true
  game["small_pic_obj_"+sequence[cards_drawn]].action= "come"
  game["small_pic_obj_"+sequence[cards_drawn-1]].action= "move"
  cards_drawn++;
  game.score.textscore.text= "Cards left: "+(52-cards_drawn)+" - Score: "+points;
  }
  functionendgame(){
  game.removeMovieClip()
  _root.attachMovie("game_over","game_over",_root.getNextHighestDepth())
  game_over.gameovertext.filters= newArray(text_glow)
  _root.game_over.gameovertext.text= "Your score:/n"+points;
  }
  and this is the result
  When it's game over, at the moment you must reload the page to play again. How much did you score?
  Download the source code, and wait for the full tut...
  >>Flash Templatesprovided by Template Monster are pre-made web design products developed using Flash technology.
  They can be easily customized to meet the unique requirements of your project.


【译者注:这里本来是有一个FLASH的,但是对剪影如何转载FLASH 内容不慎名了,好的是顺着链接也很容易找到了,怎么样,虽然游戏不怎么样,但是这么华丽的UI是不是也为其增添了几分趣味呢?】
  7 Comment(s)
  Marukomu| Dec 28, 2007| Reply
  Good stuff! This is great for work. I think I’m going rebuild one for my wife.
  i scored 74 :P
  I’m the recordman:
  90!
  Awesome!!! 69 btw *_^
  haha 104 winner :D
  54! hurray!!
  limpeh| Dec 29, 2007| Reply
  This game is not bad, but after some time, it’s quite boring since all you need to do is just ‘guessing’. (btw, I got 91)

本文转自
http://www.emanueleferonato.com/2007/12/28/using-bitmapdata-to-manage-a-deck-of-cards-part-2/

vue便利购超市库存信息管理平台(代码+数据库+LW) 摘要 针对便利购超市传统库存管理中人工操作效率低、数据同步滞后、权限边界模糊、流程不规范等问题,为实现库存管理的数字化、规范化与智能化,提升多角色协同效率,本文设计并实现了一套适配中小型超市实际业务的库存信息管理平台。研究以问题为导向,遵循调研分析 - 设计开发 - 测试优化的软件开发流程,先通过文献研究与实地调研梳理核心技术要点与业务需求,明确管理员、库管、一线员工三类角色的功能边界;再基于 Vue+Spring Boot+MyBatis 技术栈搭建前后端分离架构,结合 RBAC 角色权限模型与数据库第三范式完成系统整体设计,涵盖需求分析、架构设计、功能模块设计、接口与权限控制设计、界面原型设计等环节;随后完成平台前后端开发实现,实现商品及类别管理、库存预警、出入库与报损管理、全局库存管控等九大核心功能,同时针对开发中的权限控制、数据一致性、接口交互等问题提出针对性解决策略;最后通过功能、性能、兼容性多维度测试验证系统有效性。测试结果表明,该平台实现了库存管理全流程的线上化,可实现多角色权限的精细化管控、库存数据的实时同步与预警信息的即时推送,有效解决了传统库存管理的痛点,提升了超市库存管理的效率与精准度。系统兼具良好的稳定性、易用性与可扩展性,可为中小型零售超市的库存数字化管理提供技术支撑与实践参考,后续可进一步拓展数据分析、智能补货等功能,提升平台的智能化水平。 关键词:库存预警;超市;MyBatis 立即下载

相关推荐

故障重构改进深度优先搜索算法配合二进制粒子群的配电网故障恢复重构研究(Matlab代码实现)

内容概要:本文研究了改进深度优先搜索算法与二进制粒子群优化算法相结合在配电网故障恢复重构中的应用,旨在提升故障后网络重构的效率与供电可靠性。通过引入改进的深度优先搜索算法高效生成满足辐射状约束的可行拓扑结构,并结合二进制粒子群算法进行全局优化,实现对开关操作序列的智能决策。文中系统阐述了两种算法的协同机制、适应度函数构建、配电网约束处理(如潮流平衡、电压限值、容量限制)以及孤岛与环网的规避策略,提出了一套完整的故障恢复重构流程。基于Matlab平台的仿真验证表明,该方法能在较短时间内找到高质量的恢复方案,有效恢复失电负荷,避免不合理的网络结构,具有较强的实用性和鲁棒性。; 适合人群:具备电力系统分析基础和Matlab编程能力,从事智能电网、配电自动化、故障诊断与恢复、电力系统优化等方向的科研人员及工程技术人员。; 使用场景及目标:①应对配电网突发故障,快速制定最优网络重构方案以最大化恢复供电范围;②优化故障后开关操作策略,降低停电损失和运行风险;③为配电管理系统(DMS)和自愈控制系统提供高效的算法支撑;④研究启发式算法与图搜索算法在复杂电力网络优化中的融合应用; 阅读建议:建议读者结合Matlab代码深入理解算法实现细节,重点关注深度优先搜索在拓扑可行性校验中的作用以及粒子群算法在离散空间优化中的编码与更新策略,可通过调整网络模型、故障场景和算法参数进行对比实验,以全面掌握其性能特点与适用边界。

心灵鸡汤 (Chicken Soup for the Soul) - sixth (6th)

心灵鸡汤 (Chicken Soup for the Soul) - sixth (6th)

程永强 1449

政府科技管理部门如何优化科技创新服务体系?.docx

科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。

心灵鸡汤 (Chicken Soup for the Soul) - tenth (10th)

心灵鸡汤 (Chicken Soup for the Soul) - tenth (10th)

程永强 1299

生成代码越廉价,理解代码越珍贵!

生成代码越廉价,理解代码越珍贵!

程永强 1147

心灵鸡汤 (Chicken Soup for the Soul) - second (2nd)

心灵鸡汤 (Chicken Soup for the Soul) - second (2nd)

程永强 725

顺其自然,为所当为!

顺其自然,为所当为!

程永强 682

心灵鸡汤 (Chicken Soup for the Soul) - eighth (8th)

心灵鸡汤 (Chicken Soup for the Soul) - eighth (8th)

程永强 646

心灵鸡汤 (Chicken Soup for the Soul) - fifth (5th)

心灵鸡汤 (Chicken Soup for the Soul) - fifth (5th)

程永强 643

心灵鸡汤 (Chicken Soup for the Soul) - ninth (9th)

心灵鸡汤 (Chicken Soup for the Soul) - ninth (9th)

程永强 641

心灵鸡汤 (Chicken Soup for the Soul) - seventh (7th)

心灵鸡汤 (Chicken Soup for the Soul) - seventh (7th)

程永强 595

心灵鸡汤 (Chicken Soup for the Soul) - third (3rd)

心灵鸡汤 (Chicken Soup for the Soul) - third (3rd)

程永强 592

心灵鸡汤 (Chicken Soup for the Soul) - first (1st)

心灵鸡汤 (Chicken Soup for the Soul) - first (1st)

程永强 587

浮躁的中国 IT 行业

浮躁的中国 IT 行业

程永强 534

成年人的世界是你想不到的心酸

成年人的世界是你想不到的心酸

程永强 507

总有人偷偷爱着你

总有人偷偷爱着你

程永强 414

政府科技管理部门如何提升科技成果转化效率?.docx

科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。

上一篇: 【来自JOVEY】Delegate 类的用法
下一篇: 命令行的妙用
zinking3
博客等级 码龄19年 262粉丝 215原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值