Commit 42bdea7c authored by 邱旭's avatar 邱旭

10.FlppyBird-创建障碍

parent 6d64c30a
...@@ -137,6 +137,14 @@ ...@@ -137,6 +137,14 @@
const dis = Math.random() * 80 + 100; const dis = Math.random() * 80 + 100;
this.down.top = this.up.size.height + dis; this.down.top = this.up.size.height + dis;
} }
// 这里重写一下size,因为子节点使用绝对定位的不计算入包围盒内,真尴尬
get size() {
return {
width: this.up.size.width,
height: this.down.top + this.down.size.height
}
}
} }
/** /**
......
...@@ -34,6 +34,14 @@ class Pie extends GameObject { ...@@ -34,6 +34,14 @@ class Pie extends GameObject {
const dis = Math.random() * 80 + 100; const dis = Math.random() * 80 + 100;
this.down.top = this.up.size.height + dis; this.down.top = this.up.size.height + dis;
} }
// 这里重写一下size,因为子节点使用绝对定位的不计算入包围盒内,真尴尬
get size() {
return {
width: this.up.size.width,
height: this.down.top + this.down.size.height
}
}
} }
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment