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
8c831d63
Commit
8c831d63
authored
Jun 27, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wordspace'
# Conflicts: # js/WordObject.js # js/WordSpace.js
parents
3226ce18
9a631207
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
388 additions
and
22 deletions
+388
-22
index.html
index.html
+1
-1
Input.js
js/Input.js
+306
-2
WordObject.js
js/WordObject.js
+2
-1
WordSpace.js
js/WordSpace.js
+77
-17
main.js
js/main.js
+2
-1
No files found.
index.html
View file @
8c831d63
...
...
@@ -4,7 +4,7 @@
<meta
charset=
"utf-8"
/>
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"js/phaser.js"
></script>
<script
src=
"js/Background.js"
></script>
]
<script
src=
"js/Background.js"
></script>
<script
src=
"js/Input.js"
></script>
<script
src=
"js/WordSpace.js"
></script>
<script
src=
"js/WordObject.js"
></script>
...
...
js/Input.js
View file @
8c831d63
This diff is collapsed.
Click to expand it.
js/WordObject.js
View file @
8c831d63
...
...
@@ -31,6 +31,7 @@ class WordObject
destroy
()
{
console
.
log
(
this
.
generationCode
+
'
:
'
+
this
.
wordText
+
'
destroyed
'
);
this
.
wordObj
.
destroy
();
const
groupIdx
=
WordSpace
.
wordGroup
.
findIndex
(
function
(
item
)
{
return
this
.
isEqualObject
(
item
.
generationCode
)},
this
);
if
(
groupIdx
>
-
1
)
WordSpace
.
wordGroup
.
splice
(
groupIdx
,
1
);
...
...
@@ -49,5 +50,5 @@ class WordObject
getWordWeight
()
{
return
this
.
wordWeight
;
}
isEqualObject
(
_generationCode
)
{
return
_generationCode
===
this
.
_
generationCode
;
}
isEqualObject
(
_generationCode
)
{
return
_generationCode
===
this
.
generationCode
;
}
}
\ No newline at end of file
js/WordSpace.js
View file @
8c831d63
...
...
@@ -15,9 +15,47 @@ WordSpace.wordPhysicsGroup = null;
WordSpace
.
gravityPoint
=
{
x
:
400
,
y
:
300
};
WordSpace
.
wordCycle
=
null
;
WordSpace
.
resetCycle
=
function
(
scene
,
_delay
)
WordSpace
.
attackGauge
=
{
value
:
0
,
add
:
function
(
plus
)
{
if
(
this
.
value
+
plus
>
11
)
this
.
value
=
11
;
else
this
.
value
+=
plus
;
this
.
text
.
setText
(
'
게이지:
'
+
this
.
value
.
toFixed
(
1
));
},
sub
:
function
(
minus
)
{
if
(
this
.
value
-
minus
<
0
)
this
.
value
=
0
;
else
this
.
value
-=
minus
;
this
.
text
.
setText
(
'
게이지:
'
+
this
.
value
.
toFixed
(
1
));
},
resetValue
:
function
()
{
this
.
value
=
0
;},
cutValue
:
function
(
cutOut
)
{
this
.
value
*=
(
1
-
cutOut
);},
resetCycle
:
function
(
scene
)
{
var
option
=
{
delay
:
300
,
callback
:
function
()
{
WordSpace
.
attackGauge
.
sub
(
0.1
);
},
loop
:
true
};
this
.
currentCycle
=
scene
.
time
.
addEvent
(
option
);
this
.
text
=
scene
.
add
.
text
(
100
,
100
,
'
게이지:
'
+
this
.
value
.
toFixed
(
1
)).
setColor
(
'
#ffffff
'
);
},
pauseCycle
:
function
(
bool
)
{
this
.
currentCycle
.
paused
=
bool
;}
// showValue: 아래쪽에 바의 길이로 게이지 표시, 색으로 게이지의 강도 표현
}
WordSpace
.
wordCycle
=
{
currentCycle
:
null
,
resetCycle
:
function
(
scene
,
_delay
)
{
var
option
=
{
delay
:
_delay
,
...
...
@@ -28,13 +66,14 @@ WordSpace.resetCycle = function(scene, _delay)
callbackScope
:
scene
,
loop
:
true
};
if
(
this
.
word
Cycle
!=
null
)
if
(
this
.
current
Cycle
!=
null
)
{
this
.
wordCycle
=
this
.
word
Cycle
.
reset
(
option
);
this
.
currentCycle
=
this
.
current
Cycle
.
reset
(
option
);
}
else
{
this
.
wordCycle
=
scene
.
time
.
addEvent
(
option
);
this
.
currentCycle
=
scene
.
time
.
addEvent
(
option
);
}
}
}
...
...
@@ -59,8 +98,9 @@ WordSpace.generateWord = function(scene)
function
gameOver
()
{
this
.
wordCycle
.
paused
=
true
;
this
.
wordCycle
.
currentCycle
.
paused
=
true
;
//To Do
console
.
log
(
'
defeat
'
);
}
//게임 오버 판정을 위한 타이머
...
...
@@ -73,3 +113,23 @@ WordSpace.setGameOverTimer = function()
isTimerOn
=
true
;
}
}
WordSpace
.
findWord
=
function
(
word
)
{
var
found
=
WordSpace
.
wordGroup
.
find
(
function
(
element
)
{
return
Input
.
isEqual
(
word
,
element
.
wordText
);
});
if
(
found
!=
undefined
)
{
switch
(
found
.
wordGrade
)
// 이부분 나중에 더 효율적으로 바꿀수있지 않을까
{
case
0
:
WordSpace
.
attackGauge
.
add
(
2.5
);
break
;
case
1
:
WordSpace
.
attackGauge
.
add
(
1.5
);
break
;
case
2
:
WordSpace
.
attackGauge
.
add
(
0.9
);
break
;
case
3
:
WordSpace
.
attackGauge
.
add
(
0.5
);
break
;
default
:
console
.
log
(
'
[ERR] wrong grade of word
'
);
break
;
}
found
.
destroy
();
}
}
\ No newline at end of file
js/main.js
View file @
8c831d63
...
...
@@ -31,7 +31,8 @@ function create()
BackGround
.
drawBrain
(
this
);
Input
.
inputField
.
generate
(
this
);
WordSpace
.
wordPhysicsGroup
=
this
.
physics
.
add
.
group
();
WordSpace
.
resetCycle
(
this
,
2000
);
WordSpace
.
wordCycle
.
resetCycle
(
this
,
2000
);
WordSpace
.
attackGauge
.
resetCycle
(
this
);
}
function
update
()
...
...
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