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
6a968efa
Commit
6a968efa
authored
Jul 07, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
단어 종류에 따라 생성 함수 분리함, 공격 단어 반격 타임 wip
parent
90f702d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
24 deletions
+51
-24
ScenesData.js
js/ScenesData.js
+2
-2
WordObject.js
js/WordObject.js
+13
-4
WordSpace.js
js/WordSpace.js
+36
-18
No files found.
js/ScenesData.js
View file @
6a968efa
...
...
@@ -62,7 +62,7 @@ var gameScene = new Phaser.Class(
WordSpace
.
varAdjustCycle
.
resetCycle
(
this
,
100
);
WordSpace
.
varAdjustCycle
.
resetCycle
(
this
,
100
,
0
,
true
);
WordSpace
.
p
layerTyping
.
initiate
(
this
);
WordSpace
.
setP
layerTyping
.
initiate
(
this
);
},
update
:
function
()
...
...
@@ -71,6 +71,6 @@ var gameScene = new Phaser.Class(
{
element
.
attract
();
});
WordSpace
.
p
layerTyping
.
add
(
''
);
WordSpace
.
setP
layerTyping
.
add
(
''
);
}
});
\ No newline at end of file
js/WordObject.js
View file @
6a968efa
...
...
@@ -67,18 +67,27 @@ class WordObject
class
AttackWord
extends
WordObject
{
constructor
(
text
,
_wordGrade
,
isStrong
)
constructor
(
text
,
_wordGrade
,
_attacker
,
isStrong
)
{
super
(
text
);
this
.
wordGrade
=
_wordGrade
;
this
.
wordWeight
=
WordReader
.
getWordWeight
(
this
.
wordGrade
);
if
(
WordReader
.
getWordTyping
(
playerName
)
<=
9
)
if
(
WordReader
.
getWordTyping
(
_attacker
)
<=
9
)
this
.
wordWeight
+=
this
.
wordWeight
*
0.2
*
(
WordReader
.
getWordTyping
(
playerName
)
-
9
);
this
.
wordWeight
*=
isStrong
?
3
:
2
;
this
.
attacker
=
playerNum
;
this
.
attackedTime
=
WordSpace
.
gameTimer
.
now
;
this
.
attacker
=
_attacker
;
//서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함
this
.
attackedTime
=
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
*
(
WordSpace
.
playerTyping
/
60
)
*
2
:
((
5
-
_wordGrade
)
*
2.5
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
3
)
*
(
WordSpace
.
playerTyping
/
60
)
*
2
;
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Attacked time :
'
+
this
.
attackedTime
);
console
.
log
(
WordSpace
.
playerTyping
);
}
destroy
()
{
//if(this.attackedTim)
super
.
destroy
();
}
}
...
...
js/WordSpace.js
View file @
6a968efa
...
...
@@ -22,7 +22,7 @@ WordSpace.wordPhysicsGroup = null;
WordSpace
.
GradeProb
=
[
0.35
,
0.6
,
0.8
];
WordSpace
.
Phase
=
{
READY
:
0
,
START
:
1
,
MAIN
:
2
,
MUSIC
:
3
};
WordSpace
.
CurrentPhase
=
WordSpace
.
Phase
.
READY
;
WordSpace
.
P
layerTyping
=
0
;
WordSpace
.
p
layerTyping
=
0
;
WordSpace
.
PlayerTypingRate
=
0
;
WordSpace
.
WordSpawnDelay
=
3000
;
...
...
@@ -95,7 +95,8 @@ WordSpace.spaceInitiate = function(scene)
let
lenRate
=
1
;
arr
.
forEach
(
function
(
element
)
{
WordSpace
.
generateWord
(
scene
,
SelectWord
.
selectWord
(
element
),
''
,
lenRate
);
WordSpace
.
generateWord
.
Normal
(
scene
,
element
,
lenRate
);
//WordSpace.generateWord(scene, SelectWord.selectWord(element),'',lenRate);
lenRate
+=
0.2
;
});
}
...
...
@@ -217,7 +218,8 @@ WordSpace.genWordByProb = function(scene)
let
wordIdx
=
wordRnd
<
WordSpace
.
GradeProb
[
0
]
?
3
:
wordRnd
<
WordSpace
.
GradeProb
[
1
]
?
2
:
wordRnd
<
WordSpace
.
GradeProb
[
2
]
?
1
:
0
;
WordSpace
.
generateWord
(
scene
,
SelectWord
.
selectWord
(
wordIdx
));
WordSpace
.
generateWord
.
Normal
(
scene
,
wordIdx
);
//WordSpace.generateWord(scene, SelectWord.selectWord(wordIdx));
}
WordSpace
.
loadImage
=
function
(
scene
)
...
...
@@ -236,15 +238,28 @@ WordSpace.loadImage = function(scene)
WordSpace
.
weightTextObjForTest
=
scene
.
add
.
text
(
100
,
75
,
'
뇌의 무게: (현재) 0 / 100 (전체)
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
}
WordSpace
.
generateWord
=
function
(
scene
,
wordText
,
grade
,
lenRate
,
isStrong
)
WordSpace
.
generateWord
=
{
if
(
isStrong
!=
undefined
)
word
=
new
AttackWord
(
wordText
,
grade
,
isStrong
);
else
word
=
new
WordObject
(
wordText
);
if
(
typeof
grade
==
'
number
'
)
Normal
:
function
(
scene
,
grade
,
lenRate
)
{
word
.
wordGrade
=
grade
;
word
.
wordWeight
=
WordReader
.
getWordWeight
(
grade
);
word
=
new
WordObject
(
SelectWord
.
selectWord
(
grade
));
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
},
Attack
:
function
(
scene
,
wordText
,
grade
,
attacker
,
isStrong
,
lenRate
)
{
word
=
new
AttackWord
(
wordText
,
grade
,
attacker
,
isStrong
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
},
Name
:
function
(
scene
,
isStrong
,
lenRate
)
{
//To do
word
=
new
NameWord
(
playerName
,
isStrong
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
}
}
WordSpace
.
pushWord
=
function
(
scene
,
word
,
lenRate
)
{
word
.
instantiate
(
scene
,
lenRate
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordForcedGroup
.
push
(
word
);
...
...
@@ -307,6 +322,8 @@ WordSpace.findWord = function(wordText)
case
3
:
WordSpace
.
attackGauge
.
add
(
0.5
);
break
;
default
:
console
.
log
(
'
[ERR] wrong grade of word
'
);
break
;
}
//if(typeof(weightest) == 'AttackWord')
console
.
log
(
weightest
instanceof
AttackWord
);
weightest
.
destroy
();
WordSpace
.
nameCycle
.
resetCycle
(
WordSpace
.
gameSceneForTest
,
WordSpace
.
NameSpawnDelay
,
WordSpace
.
nameCycle
.
currentCycle
.
getElapsed
()
+
WordSpace
.
NameSpawnReduce
);
...
...
@@ -315,7 +332,7 @@ WordSpace.findWord = function(wordText)
WordSpace
.
genWordByProb
(
WordSpace
.
gameSceneForTest
);
WordSpace
.
wordCycle
.
resetCycle
(
WordSpace
.
gameSceneForTest
,
WordSpace
.
WordSpawnDelay
,
0
);
}
WordSpace
.
p
layerTyping
.
add
(
wordText
);
WordSpace
.
setP
layerTyping
.
add
(
wordText
);
}
else
if
(
wordText
===
'
공격
'
&&
WordSpace
.
attackGauge
.
value
>=
3
)
// 공격모드 진입.
{
...
...
@@ -324,7 +341,7 @@ WordSpace.findWord = function(wordText)
Input
.
maxInput
=
Input
.
attackOption
.
wordCount
;
Input
.
attackMode
=
true
;
WordSpace
.
attackGauge
.
pauseCycle
(
true
);
WordSpace
.
p
layerTyping
.
add
(
wordText
);
WordSpace
.
setP
layerTyping
.
add
(
wordText
);
}
else
{
...
...
@@ -332,21 +349,20 @@ WordSpace.findWord = function(wordText)
}
}
WordSpace
.
p
layerTyping
=
WordSpace
.
setP
layerTyping
=
{
totalTyping
:
0
,
playerTyping
:
0
,
add
:
function
(
wordText
)
{
this
.
totalTyping
+=
wordText
!=
null
?
WordReader
.
getWordTyping
(
wordText
)
:
0
;
this
.
playerTyping
=
this
.
totalTyping
/
WordSpace
.
gameTimer
.
now
*
1000
;
this
.
text
.
setText
(
'
현재 타수 :
'
+
this
.
playerTyping
.
toFixed
(
1
));
WordSpace
.
playerTyping
=
this
.
totalTyping
/
WordSpace
.
gameTimer
.
now
*
1000
;
this
.
text
.
setText
(
'
현재 타수 :
'
+
WordSpace
.
playerTyping
.
toFixed
(
1
));
},
initiate
:
function
(
scene
)
{
WordSpace
.
gameTimer
=
new
Phaser
.
Time
.
Clock
(
scene
);
WordSpace
.
gameTimer
.
start
();
this
.
text
=
scene
.
add
.
text
(
100
,
200
,
'
현재 타수 :
'
+
this
.
playerTyping
.
toFixed
(
1
)).
setDepth
(
10
).
setColor
(
'
#000000
'
);
this
.
text
=
scene
.
add
.
text
(
100
,
200
,
'
현재 타수 :
'
+
WordSpace
.
playerTyping
.
toFixed
(
1
)).
setDepth
(
10
).
setColor
(
'
#000000
'
);
}
}
...
...
@@ -356,12 +372,14 @@ WordSpace.attack = function(wordText, grade)
if
(
wordText
!=
''
)
{
console
.
log
(
'
attack
'
+
wordText
+
'
, grade:
'
+
grade
);
WordSpace
.
generateWord
(
WordSpace
.
gameSceneForTest
,
wordText
,
grade
,
undefined
,
true
);
// for test
//호패에 따른 isStrong 구분 필요함
WordSpace
.
generateWord
.
Attack
(
WordSpace
.
gameSceneForTest
,
wordText
,
grade
,
playerName
,
true
);
//WordSpace.generateWord(WordSpace.gameSceneForTest, wordText, grade, undefined, true); // for test
// 이부분에서 게이지에 따라 급수 결정
// 이걸 서버로 공격을 보내야 함
// 이부분은 서버 잘써야함
WordSpace
.
attackGauge
.
resetValue
();
WordSpace
.
p
layerTyping
.
add
(
wordText
);
WordSpace
.
setP
layerTyping
.
add
(
wordText
);
}
else
{
...
...
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