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
2fdfec15
Commit
2fdfec15
authored
Jun 26, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wordObject가 생성될 때 자신의 wordText에 따라 wordTyping을 저장하는 기능 구현완료. 테스트 필요함
parent
79aa0c70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
WordObject.js
script/WordObject.js
+52
-0
No files found.
script/WordObject.js
View file @
2fdfec15
...
...
@@ -3,6 +3,16 @@ class WordObject
constructor
(
text
)
{
this
.
wordText
=
text
;
this
.
wordTyping
=
(
function
(
_wordText
)
{
var
temp
=
0
;
for
(
var
i
=
0
;
i
<
_wordText
.
length
;
i
++
)
{
temp
+=
firstSound
(
_wordText
.
charAt
(
i
))
+
middleSound
(
_wordText
.
charAt
(
i
))
+
lastSound
(
_wordText
.
charAt
(
i
));
}
return
temp
;
})(
this
.
wordText
);
//alert(this.wordTyping);
}
generate
(
scene
)
...
...
@@ -20,4 +30,46 @@ class WordObject
this
.
physicsObj
.
setVelocity
(
dist
*
Math
.
cos
(
angle
)
*
wordSpeed
,
dist
*
Math
.
sin
(
angle
)
*
wordSpeed
);
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
}
}
function
firstSound
(
charText
)
{
var
r
=
parseInt
(((
charText
.
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
/
21
);
switch
(
r
)
{
case
1
||
4
||
8
||
19
||
13
:
return
1.3
;
default
:
return
1
;
}
/*var t = String.fromCharCode(r + parseInt('0x1100',16));
console.log("first sound : " + r + " " + t);
return r;*/
}
function
middleSound
(
charText
)
{
var
r
=
parseInt
(((
charText
.
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
%
21
);
switch
(
r
)
{
case
3
||
7
:
return
1.3
;
case
9
||
10
||
11
||
14
||
15
||
16
||
19
:
return
2
;
default
:
return
1
;
}
/*var t = String.fromCharCode(r + parseInt('0x1161',16));
console.log("middle sound : " + r + " " + t);
return r;*/
}
function
lastSound
(
charText
)
{
var
r
=
parseInt
((
charText
.
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
%
28
);
switch
(
r
)
{
case
2
||
20
:
return
1.3
;
case
3
||
5
||
6
||
9
||
10
||
11
||
12
||
13
||
14
||
15
||
18
:
return
2
;
case
0
:
return
0
;
default
:
return
1
;
}
/*var t = String.fromCharCode(r + parseInt('0x11A8') -1);
console.log("last sound : " + r + " " + t);
return r;*/
}
\ No newline at end of file
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