打怪物^^

欢迎来到程序小院

打怪物

玩法:30秒内看到怪物点击鼠标左键敲打怪物,看看你能打掉多少个怪物,快去打怪物吧^^。

开始游戏icon-default.png?t=N7T8https://www.ormcc.com/play/gameStart/215

html

  <canvas width="800" height="600"></canvas>

css

canvas {
  display: block; 
  touch-action: none; 
  user-select: none; 
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 
  width: 733px; 
  height: 550px;
  }

js

function countobj(){
 this.text;
 this.create = function(){
  var style = { font: "bold 28px Arial", fill: "#ffffff",boundsAlignH: "left"};
  var x = 0;
  var y =30;
  var str = '打中'+score+'个怪物';
  this.text = game.add.text(x,y,str,style);
  this.text.setTextBounds(30, 0, 800, 600);
 }
 this.update = function(){
  var str = '打中'+score+'个怪物';
  this.text.setText(str);
 }
 this.create();
}
function overobj(){
 this.s;
 this.child;
 this.g;
 var me = this;

 this.create = function(){
  this.g = game.add.graphics(0,0);
  this.g.beginFill(0x000000);
  this.g.drawRect(0,0,800,600);
  this.s = game.add.sprite(0,0,this.g.generateTexture());
  this.g.kill();
  this.s.alpha = 0;
  this.child = game.add.sprite(0,0,"over");
  this.child.anchor.set(0.5);
  this.child.x = w/2;
  this.child.y = h/2;
  this.s.inputEnabled = true;
  this.s.events.onInputDown.add(function(){
   me.gameInit();
  });
  this.child.events.onInputDown.add(function(){
   me.gameInit();
  })
 }
 this.update = function(){

 }
 this.gameInit = function(){
  time = 30;
  score = 0;
  me.s.kill();
  me.child.kill();
 }
 this.create();
}

源码

需要源码请关注添加好友哦^ ^

转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

相关推荐

  1. unity 2d范围检测:怪物检测范围

    2023-12-11 11:54:04       41 阅读
  2. Unity3D 基于ECS的AI思考与怪物同步详解

    2023-12-11 11:54:04       44 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-11 11:54:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-11 11:54:04       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-11 11:54:04       87 阅读
  4. Python语言-面向对象

    2023-12-11 11:54:04       96 阅读

热门阅读

  1. Redis

    Redis

    2023-12-11 11:54:04      42 阅读
  2. 如何在Go中定义和调用函数

    2023-12-11 11:54:04       71 阅读
  3. C++随记

    C++随记

    2023-12-11 11:54:04      49 阅读
  4. 中国移动公网IP申请过程

    2023-12-11 11:54:04       135 阅读
  5. vs提示warning导致error的问题

    2023-12-11 11:54:04       65 阅读
  6. 【UE】UEC++ DataTable数据表

    2023-12-11 11:54:04       43 阅读
  7. Django多对多ManyToManyField字段

    2023-12-11 11:54:04       55 阅读
  8. EtherCAT主站程序代码详解

    2023-12-11 11:54:04       54 阅读