Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sejong25
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tear of Sejong
sejong25
Commits
f85e100e
Commit
f85e100e
authored
Jun 27, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
단어 무게 총합 구현 및 게임 오버 임시로 구현함. 현재 단어 무게가 뇌 용량을 넘어선 채로 3초간 유지되면 게임 오버됨.
단어를 삭제하는 기능이 없는 관계로 나중에 타이머 리셋하는 기능 구현할 것.
parent
f30281f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
WordObject.js
js/WordObject.js
+4
-1
WordSpace.js
js/WordSpace.js
+22
-0
main.js
js/main.js
+1
-1
No files found.
js/WordObject.js
View file @
f85e100e
...
...
@@ -6,7 +6,7 @@ class WordObject
this
.
wordText
=
text
;
//this.wordText = Input.removeConVow(text);
this
.
wordTyping
=
WordReader
.
getWordTyping
(
this
.
wordText
);
this
.
wordGrade
=
WordReader
.
get
wordWeight
(
this
.
wordTyping
);
this
.
wordGrade
=
WordReader
.
get
WordGrade
(
this
.
wordTyping
);
this
.
wordWeight
=
(
function
(
_wordGrade
)
{
var
temp
=
0
;
...
...
@@ -15,6 +15,9 @@ class WordObject
_wordGrade
==
1
?
7
:
10
;
return
temp
;
})(
this
.
wordGrade
);
WordSpace
.
totalWeight
+=
this
.
wordWeight
;
WordSpace
.
setGameOverTimer
();
console
.
log
(
"
Total weight :
"
+
WordSpace
.
totalWeight
);
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
...
...
js/WordSpace.js
View file @
f85e100e
...
...
@@ -3,6 +3,11 @@ var WordSpace = WordSpace || {};
WordSpace
.
isImageLoaded
=
false
;
WordSpace
.
nextWordCode
=
0
;
WordSpace
.
totalWeight
=
0
;
//현재 단어 무게 총합
WordSpace
.
brainCapacity
=
20
;
//수용 가능한 단어 무게 최대치
WordSpace
.
defeatTime
=
3000
;
WordSpace
.
gameOverTimer
=
null
;
//게임 오버 판정 타이머
WordSpace
.
isTimerOn
=
false
;
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
...
...
@@ -50,4 +55,21 @@ WordSpace.generateWord = function(scene)
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
function
gameOver
()
{
this
.
wordCycle
.
paused
=
true
;
//To Do
}
//게임 오버 판정을 위한 타이머
WordSpace
.
setGameOverTimer
=
function
()
{
//만약 현재 단어 무게 총합이 뇌 용량보다 크다면 타이머를 시작함
if
(
this
.
brainCapacity
<
this
.
totalWeight
&&
!
this
.
isTimerOn
)
{
this
.
gameOverTimer
=
setTimeout
(
gameOver
.
bind
(
this
),
this
.
defeatTime
);
isTimerOn
=
true
;
}
}
\ No newline at end of file
js/main.js
View file @
f85e100e
...
...
@@ -16,7 +16,7 @@ var config = {
}
};
var
game
=
new
Phaser
.
Game
(
config
)
;
var
game
=
new
Phaser
.
Game
(
config
)
// load assets
function
preload
()
...
...
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