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
6a317860
Commit
6a317860
authored
Jun 26, 2019
by
18신대성
Committed by
16이지혜
Jun 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cycle관련해서 함수 압축하고, word에서 generate -> instantiate로 바꿈
parent
d28c495c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
38 deletions
+30
-38
WordObject.js
js/WordObject.js
+2
-2
WordSpace.js
js/WordSpace.js
+25
-32
main.js
js/main.js
+3
-4
No files found.
js/WordObject.js
View file @
6a317860
...
@@ -26,7 +26,7 @@ class WordObject
...
@@ -26,7 +26,7 @@ class WordObject
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
}
gener
ate
(
scene
)
instanti
ate
(
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
);
...
...
js/WordSpace.js
View file @
6a317860
...
@@ -2,7 +2,8 @@ var WordSpace = WordSpace || {};
...
@@ -2,7 +2,8 @@ var WordSpace = WordSpace || {};
WordSpace
.
isImageLoaded
=
false
;
WordSpace
.
isImageLoaded
=
false
;
WordSpace
.
wordGroup
=
null
;
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
WordSpace
.
wordPhysicsGroup
=
null
;
WordSpace
.
wordPhysicsGroup
=
null
;
WordSpace
.
gravityPoint
=
{
x
:
400
,
y
:
300
};
WordSpace
.
gravityPoint
=
{
x
:
400
,
y
:
300
};
...
@@ -10,42 +11,23 @@ WordSpace.gravityPoint = {x: 400, y: 300};
...
@@ -10,42 +11,23 @@ WordSpace.gravityPoint = {x: 400, y: 300};
WordSpace
.
wordCycle
=
null
;
WordSpace
.
wordCycle
=
null
;
WordSpace
.
resetCycle
=
function
(
scene
,
_delay
)
WordSpace
.
resetCycle
=
function
(
scene
,
_delay
)
{
{
if
(
this
.
wordCycle
!=
null
)
var
option
=
{
this
.
wordCycle
=
this
.
wordCycle
.
reset
(
{
{
delay
:
_delay
,
delay
:
_delay
,
callback
:
function
()
callback
:
function
()
{
{
word
=
new
WordObject
(
"
솽젠커
"
);
WordSpace
.
generateWord
(
this
)
word
.
generate
(
this
);
WordSpace
.
wordGroup
.
push
(
word
);
this
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
},
},
callbackScope
:
scene
,
callbackScope
:
scene
,
loop
:
true
loop
:
true
}
};
);
if
(
this
.
wordCycle
!=
null
)
{
this
.
wordCycle
=
this
.
wordCycle
.
reset
(
option
);
}
}
else
else
{
{
this
.
wordCycle
=
scene
.
time
.
addEvent
(
this
.
wordCycle
=
scene
.
time
.
addEvent
(
option
);
{
delay
:
_delay
,
callback
:
function
()
{
word
=
new
WordObject
(
"
솽젠커
"
);
word
.
generate
(
this
);
WordSpace
.
wordGroup
.
push
(
word
);
this
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
this
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
},
callbackScope
:
scene
,
loop
:
true
}
);
}
}
}
}
...
@@ -56,3 +38,14 @@ WordSpace.loadImage = function(scene)
...
@@ -56,3 +38,14 @@ WordSpace.loadImage = function(scene)
scene
.
load
.
image
(
'
wordBackground
'
,
'
assets/wordBackground.png
'
);
scene
.
load
.
image
(
'
wordBackground
'
,
'
assets/wordBackground.png
'
);
}
}
}
}
WordSpace
.
generateWord
=
function
(
scene
)
{
word
=
new
WordObject
(
"
솽젠커
"
);
word
.
instantiate
(
scene
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordForcedGroup
.
push
(
word
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
\ No newline at end of file
js/main.js
View file @
6a317860
...
@@ -30,17 +30,16 @@ function preload()
...
@@ -30,17 +30,16 @@ function preload()
function
create
()
function
create
()
{
{
BackGround
.
drawBrain
(
this
);
BackGround
.
drawBrain
(
this
);
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordPhysicsGroup
=
this
.
physics
.
add
.
group
();
WordSpace
.
wordPhysicsGroup
=
this
.
physics
.
add
.
group
();
WordSpace
.
resetCycle
(
this
,
2000
);
WordSpace
.
resetCycle
(
this
,
2000
);
}
}
function
update
()
function
update
()
{
{
for
(
i
=
0
;
i
<
WordSpace
.
wordGroup
.
length
;
i
++
)
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
{
{
WordSpace
.
wordGroup
[
i
]
.
attract
(
0.3
);
element
.
attract
(
0.3
);
}
}
);
}
}
var
socket
=
io
.
connect
();
var
socket
=
io
.
connect
();
...
...
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