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
1fad648a
Commit
1fad648a
authored
Jun 27, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test1'
# Conflicts: # js/WordObject.js
parents
c230443d
6d3b8c47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
WordObject.js
js/WordObject.js
+6
-3
WordSpace.js
js/WordSpace.js
+5
-1
main.js
js/main.js
+1
-1
No files found.
js/WordObject.js
View file @
1fad648a
...
@@ -19,12 +19,15 @@ class WordObject
...
@@ -19,12 +19,15 @@ class WordObject
WordSpace
.
setGameOverTimer
();
WordSpace
.
setGameOverTimer
();
console
.
log
(
"
Total weight :
"
+
WordSpace
.
totalWeight
);
console
.
log
(
"
Total weight :
"
+
WordSpace
.
totalWeight
);
//console.log("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');
this
.
wordSpeed
=
1
;
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
}
instantiate
(
scene
)
instantiate
(
scene
)
{
{
var
randomX
=
Phaser
.
Math
.
Between
(
100
,
700
);
var
randomX
=
Phaser
.
Math
.
Between
(
100
,
700
);
this
.
physicsObj
=
scene
.
physics
.
add
.
sprite
(
randomX
,
100
,
'
wordBackground
'
).
setScale
(
0.3
);
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
=
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
);
}
}
...
@@ -39,12 +42,12 @@ class WordObject
...
@@ -39,12 +42,12 @@ class WordObject
if
(
forceIdx
>
-
1
)
WordSpace
.
wordForcedGroup
.
splice
(
forceIdx
,
1
);
if
(
forceIdx
>
-
1
)
WordSpace
.
wordForcedGroup
.
splice
(
forceIdx
,
1
);
WordSpace
.
wordPhysicsGroup
.
remove
(
this
.
physicsObj
,
true
,
true
);
WordSpace
.
wordPhysicsGroup
.
remove
(
this
.
physicsObj
,
true
,
true
);
}
}
attract
(
wordSpeed
)
attract
()
{
{
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
);
var
angle
=
Phaser
.
Math
.
Angle
.
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
.
physicsObj
.
setVelocity
(
dist
*
Math
.
cos
(
angle
)
*
this
.
wordSpeed
,
dist
*
Math
.
sin
(
angle
)
*
this
.
wordSpeed
);
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
this
.
wordObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
}
}
...
...
js/WordSpace.js
View file @
1fad648a
...
@@ -91,7 +91,11 @@ WordSpace.generateWord = function(scene)
...
@@ -91,7 +91,11 @@ WordSpace.generateWord = function(scene)
word
.
instantiate
(
scene
);
word
.
instantiate
(
scene
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordForcedGroup
.
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
.
wordSpeed
>
0.5
)
object1
.
topObj
.
wordSpeed
=
0.05
;
});
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
}
...
...
js/main.js
View file @
1fad648a
...
@@ -39,7 +39,7 @@ function update()
...
@@ -39,7 +39,7 @@ function update()
{
{
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
{
{
element
.
attract
(
0.3
);
element
.
attract
();
});
});
}
}
...
...
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