小编ran*_*dom的帖子

我怎样才能达到“熔岩”留下痕迹的效果

经过一段时间的JavaScript游戏“开发”,我想到了一个好主意,所以听起来似乎很不错。

我当时正在考虑创建一个代表熔岩的实体。该熔岩将使用以下方式沿特定方向移动:

function Lava(pos, ch) {
  this.pos = pos;
  this.size = new Vector(1, 1);
  if(ch == '-') {
    this.speed = new Vector(3, 0)
  }
}
Run Code Online (Sandbox Code Playgroud)

在哪里var acrotchar = {"-": Lava};

整个代码可以在这里或下面看到:

function Lava(pos, ch) {
  this.pos = pos;
  this.size = new Vector(1, 1);
  if(ch == '-') {
    this.speed = new Vector(3, 0)
  }
}
Run Code Online (Sandbox Code Playgroud)
var LEVELS = [
  ["                                  x  x",
   "                                  xx x",
   "                      xxx         x  x",
   "                     xx!xx        x ox",
   "                     x!!!x        x xx", …
Run Code Online (Sandbox Code Playgroud)

html javascript css game-physics

13
推荐指数
1
解决办法
130
查看次数

How do I make lava drops damage the character?

I am building a JavaScript game, based on Mario.

I have already implemented "physics" for lava, so when the character would fall into it, they would lose 1 life. What I am trying to achieve is that lava drops would act the same, so on contact they would hurt the character and make it respawn at the start of the area / level.

The code can be found here and seen below:

     //////////////////////////////
     // This is only a demo code …
Run Code Online (Sandbox Code Playgroud)

html javascript css game-physics

5
推荐指数
1
解决办法
60
查看次数

标签 统计

css ×2

game-physics ×2

html ×2

javascript ×2