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
a26aaa71
Commit
a26aaa71
authored
Jul 09, 2019
by
18신대성
Committed by
Chae Ho Shin
Jul 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
호패 플레이스홀더 적용
parent
2f2575b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
22 deletions
+38
-22
WordObject.js
js/WordObject.js
+26
-10
WordSpace.js
js/WordSpace.js
+12
-12
No files found.
js/WordObject.js
View file @
a26aaa71
class
WordObject
{
constructor
(
text
)
constructor
(
text
,
isNameWord
=
false
)
{
this
.
generationCode
=
WordSpace
.
nextWordCode
++
;
this
.
wordText
=
text
;
...
...
@@ -9,21 +9,35 @@ class WordObject
this
.
wordWeight
=
WordReader
.
getWordWeight
(
this
.
wordGrade
);
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
this
.
wordSpeed
=
0.5
;
this
.
isNameWord
=
isNameWord
;
}
instantiate
(
scene
,
lenRate
)
instantiate
(
scene
,
lenRate
)
{
let
p
=
[{
x
:
3
,
y
:
0.7
},
{
x
:
20
,
y
:
1.8
}];
let
scale
=
((
p
[
1
].
y
-
p
[
0
].
y
)
/
(
p
[
1
].
x
-
p
[
0
].
x
))
*
(
this
.
wordWeight
-
p
[
0
].
x
)
+
p
[
0
].
y
;
let
fontscale
=
25
;
var
random
=
WordSpace
.
getSpawnPoint
(
lenRate
);
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
random
.
x
,
random
.
y
,
'
wordBgr
'
+
this
.
wordGrade
+
'
_
'
+
Math
.
min
(
Math
.
max
(
2
,
this
.
wordText
.
length
),
6
))
.
setMass
(
this
.
wordWeight
*
10
)
.
setScale
(
scale
)
.
setFrictionX
(
0
)
.
setFrictionY
(
0
)
.
setBounce
(
0.5
);
if
(
!
this
.
isNameWord
)
{
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
random
.
x
,
random
.
y
,
'
wordBgr
'
+
this
.
wordGrade
+
'
_
'
+
Math
.
min
(
Math
.
max
(
2
,
this
.
wordText
.
length
),
6
))
.
setMass
(
this
.
wordWeight
*
10
)
.
setScale
(
scale
)
.
setFrictionX
(
0
)
.
setFrictionY
(
0
)
.
setBounce
(
0.5
);
}
else
{
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
random
.
x
,
random
.
y
,
'
nameBgr
'
+
Math
.
min
(
Math
.
max
(
2
,
this
.
wordText
.
length
),
6
))
.
setMass
(
this
.
wordWeight
*
10
)
.
setScale
(
scale
)
.
setFrictionX
(
0
)
.
setFrictionY
(
0
)
.
setBounce
(
0.5
);
}
let
dist
=
Phaser
.
Math
.
Distance
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
let
angle
=
Phaser
.
Math
.
Angle
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
...
...
@@ -37,7 +51,9 @@ class WordObject
fontSize
:
(
scale
*
fontscale
)
+
'
pt
'
,
fontFamily
:
'
"궁서", 궁서체, serif
'
,
fontStyle
:
(
this
.
wordWeight
>
5
?
'
bold
'
:
''
)
}).
setColor
(
'
#000000
'
).
setOrigin
(
0.5
,
0.5
);
});
if
(
!
this
.
isNameWord
)
this
.
wordObj
.
setColor
(
'
#000000
'
).
setOrigin
(
0.5
,
0.5
);
else
this
.
wordObj
.
setColor
(
'
#ffffff
'
).
setOrigin
(
0.45
,
0.5
);
WordSpace
.
totalWeight
+=
this
.
wordWeight
;
WordSpace
.
totalWordNum
+=
1
;
WordSpace
.
setGameOverTimer
();
...
...
@@ -148,7 +164,7 @@ class NameWord extends WordObject
{
constructor
(
text
,
_isStrong
=
false
)
{
super
(
text
);
super
(
text
,
true
);
this
.
wordWeight
=
2
;
this
.
isStrong
=
_isStrong
;
console
.
log
(
'
Name :
'
+
text
+
'
, Strong :
'
+
this
.
isStrong
+
'
, Weight :
'
+
this
.
wordWeight
);
...
...
js/WordSpace.js
View file @
a26aaa71
...
...
@@ -5,8 +5,6 @@ WordSpace.gameSceneForTest = null;
WordSpace
.
weightTextObjForTest
=
null
;
WordSpace
.
nameWordTextForTest
=
null
;
WordSpace
.
isImageLoaded
=
false
;
WordSpace
.
nextWordCode
=
0
;
WordSpace
.
totalWeight
=
0
;
//현재 단어 무게 총합
WordSpace
.
totalWordNum
=
0
;
...
...
@@ -220,20 +218,22 @@ WordSpace.genWordByProb = function(scene)
WordSpace
.
loadImage
=
function
(
scene
)
{
if
(
!
this
.
isImageLoaded
)
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
for
(
let
i
=
0
;
i
<
4
;
i
++
)
for
(
let
j
=
2
;
j
<
7
;
j
++
)
{
for
(
let
j
=
2
;
j
<
7
;
j
++
)
{
scene
.
load
.
image
((
'
wordBgr
'
+
i
+
'
_
'
+
j
),
(
'
assets/placeholder/
'
+
i
+
'
_
'
+
j
+
'
.png
'
));
}
}
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
scene
.
load
.
image
(
'
attackAlert
'
+
i
,
'
assets/placeholder/attackalert
'
+
(
i
+
1
)
+
'
.png
'
);
scene
.
load
.
image
((
'
wordBgr
'
+
i
+
'
_
'
+
j
),
(
'
assets/placeholder/
'
+
i
+
'
_
'
+
j
+
'
.png
'
));
}
}
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
scene
.
load
.
image
(
'
attackAlert
'
+
i
,
'
assets/placeholder/attackalert
'
+
(
i
+
1
)
+
'
.png
'
);
}
for
(
let
i
=
2
;
i
<
7
;
i
++
)
{
scene
.
load
.
image
(
'
nameBgr
'
+
i
,
'
assets/placeholder/name
'
+
i
+
'
.png
'
);
}
WordSpace
.
gameSceneForTest
=
scene
;
// for test
WordSpace
.
weightTextObjForTest
=
scene
.
add
.
text
(
100
,
75
,
'
뇌의 무게: (현재) 0 / 100 (전체)
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
}
...
...
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