Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-stydy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
谌继荃
game-stydy
Commits
df10e635
Commit
df10e635
authored
Mar 10, 2021
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10.FlppyBird-创建障碍
parent
38d1a0d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
11_1.png
images/11_1.png
+0
-0
flppyBirdLib.js
lib/flppyBirdLib.js
+24
-0
No files found.
images/11_1.png
0 → 100644
View file @
df10e635
658 KB
lib/flppyBirdLib.js
View file @
df10e635
...
...
@@ -184,3 +184,27 @@ function loadImgAsync(src) {
img
.
src
=
src
;
});
}
/**
* 一个简单的通用对象池
*/
class
ObjectPool
{
static
objs
=
{};
static
put
(
name
,
obj
)
{
const
pool
=
ObjectPool
.
objs
[
name
]
||
(
ObjectPool
.
objs
[
name
]
=
[]);
pool
.
push
(
obj
);
}
static
get
(
name
)
{
const
pool
=
ObjectPool
.
objs
[
name
]
||
(
ObjectPool
.
objs
[
name
]
=
[]);
if
(
pool
.
length
<=
0
)
{
return
null
;
}
return
pool
.
shift
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment