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
30b700e5
Commit
30b700e5
authored
Jun 27, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
단어끼리 부딪히면 가운데로 뭉치는 힘을 없게 해봄
parent
9a631207
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
WordObject.js
js/WordObject.js
+8
-4
WordSpace.js
js/WordSpace.js
+5
-1
No files found.
js/WordObject.js
View file @
30b700e5
...
...
@@ -25,6 +25,7 @@ class WordObject
_wordGrade
==
1
?
7
:
10
;
return
temp
;
})(
this
.
wordGrade
);
this
.
isForced
=
true
;
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
...
...
@@ -32,6 +33,7 @@ class WordObject
{
var
randomX
=
Phaser
.
Math
.
Between
(
100
,
700
);
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
randomX
,
100
,
'
wordBackground
'
).
setScale
(
0.3
);
this
.
physicsObj
.
body
.
bounce
.
set
(
0.5
);
this
.
wordObj
=
scene
.
add
.
text
(
randomX
,
100
,
this
.
wordText
,
{
fontFamily
:
'
"궁서", 궁서체, serif
'
}).
setColor
(
'
#000000
'
);
this
.
wordObj
.
setOrigin
(
0.5
,
0.5
);
}
...
...
@@ -47,12 +49,14 @@ class WordObject
WordSpace
.
wordPhysicsGroup
.
remove
(
this
.
physicsObj
,
true
,
true
);
}
attract
(
wordSpeed
)
{
var
dist
=
Phaser
.
Math
.
Distance
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
var
angle
=
Phaser
.
Math
.
Angle
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
this
.
physicsObj
.
setVelocity
(
dist
*
Math
.
cos
(
angle
)
*
wordSpeed
,
dist
*
Math
.
sin
(
angle
)
*
wordSpeed
);
if
(
this
.
isForced
)
{
var
dist
=
Phaser
.
Math
.
Distance
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
var
angle
=
Phaser
.
Math
.
Angle
.
Between
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
WordSpace
.
gravityPoint
.
x
,
WordSpace
.
gravityPoint
.
y
);
this
.
physicsObj
.
setVelocity
(
dist
*
Math
.
cos
(
angle
)
*
wordSpeed
,
dist
*
Math
.
sin
(
angle
)
*
wordSpeed
);
}
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
}
...
...
js/WordSpace.js
View file @
30b700e5
...
...
@@ -86,7 +86,11 @@ WordSpace.generateWord = function(scene)
word
.
instantiate
(
scene
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordForcedGroup
.
push
(
word
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
word
.
physicsObj
.
topObj
=
word
;
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
,
function
(
object1
)
{
if
(
object1
.
topObj
.
isForced
)
object1
.
topObj
.
isForced
=
false
;
});
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
...
...
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