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
6f871788
Commit
6f871788
authored
Jun 27, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
코드 간략화
parent
2d389e71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
27 deletions
+19
-27
WordObject.js
js/WordObject.js
+19
-27
No files found.
js/WordObject.js
View file @
6f871788
...
@@ -2,7 +2,10 @@ class WordObject
...
@@ -2,7 +2,10 @@ class WordObject
{
{
constructor
(
text
)
constructor
(
text
)
{
{
this
.
generationCode
=
WordSpace
.
nextWordCode
++
;
this
.
wordText
=
text
;
this
.
wordText
=
text
;
//this.wordText = Input.removeConVow(text);
this
.
wordTyping
=
(
function
(
_wordText
)
this
.
wordTyping
=
(
function
(
_wordText
)
{
{
var
temp
=
0
;
var
temp
=
0
;
...
@@ -23,17 +26,27 @@ class WordObject
...
@@ -23,17 +26,27 @@ class WordObject
_wordGrade
==
1
?
7
:
10
;
_wordGrade
==
1
?
7
:
10
;
return
temp
;
return
temp
;
})(
this
.
wordGrade
);
})(
this
.
wordGrade
);
//
alert
("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
//
console.log
("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
}
gener
ate
(
scene
)
instanti
ate
(
scene
)
{
{
var
randomX
=
Phaser
.
Math
.
Between
(
100
,
5
00
);
var
randomX
=
Phaser
.
Math
.
Between
(
100
,
7
00
);
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
randomX
,
100
,
'
wordBackground
'
).
setScale
(
0.
5
);
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
randomX
,
100
,
'
wordBackground
'
).
setScale
(
0.
3
);
this
.
wordObj
=
scene
.
add
.
text
(
randomX
,
100
,
this
.
wordText
,
{
fontFamily
:
'
"궁서", 궁서체, serif
'
}).
setColor
(
'
#000000
'
);
this
.
wordObj
=
scene
.
add
.
text
(
randomX
,
100
,
this
.
wordText
,
{
fontFamily
:
'
"궁서", 궁서체, serif
'
}).
setColor
(
'
#000000
'
);
this
.
wordObj
.
setOrigin
(
0.5
,
0.5
);
this
.
wordObj
.
setOrigin
(
0.5
,
0.5
);
}
}
destroy
()
{
this
.
wordObj
.
destroy
();
const
groupIdx
=
WordSpace
.
wordGroup
.
findIndex
(
function
(
item
)
{
return
this
.
isEqualObject
(
item
.
generationCode
)},
this
);
if
(
groupIdx
>
-
1
)
WordSpace
.
wordGroup
.
splice
(
groupIdx
,
1
);
const
forceIdx
=
WordSpace
.
wordForcedGroup
.
findIndex
(
function
(
item
)
{
return
this
.
isEqualObject
(
item
.
generationCode
)},
this
);
if
(
forceIdx
>
-
1
)
WordSpace
.
wordForcedGroup
.
splice
(
forceIdx
,
1
);
WordSpace
.
wordPhysicsGroup
.
remove
(
this
.
physicsObj
,
true
,
true
);
}
attract
(
wordSpeed
)
attract
(
wordSpeed
)
{
{
var
dist
=
Phaser
.
Math
.
Distance
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
var
dist
=
Phaser
.
Math
.
Distance
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
...
@@ -42,30 +55,9 @@ class WordObject
...
@@ -42,30 +55,9 @@ class WordObject
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
}
}
getWordWeight
()
getWordWeight
()
{
return
this
.
wordWeight
;
}
{
return
this
.
wordWeight
;
}
removeConVow
(
_wordText
)
isEqualObject
(
_generationCode
)
{
return
_generationCode
===
this
.
_generationCode
;
}
{
var
temp
=
0
;
for
(
var
i
=
0
;
i
<
_wordText
.
length
;
i
++
)
{
}
return
temp
;
}
//***********ToDo*************
isEqual
(
inputWord
)
{
if
(
inputWord
===
this
.
wordText
)
{
this
.
destroy
();
}
}
//****************************
}
}
function
firstSound
(
charText
)
function
firstSound
(
charText
)
...
...
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