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
0541c50e
Commit
0541c50e
authored
Jul 23, 2019
by
18손재민
Committed by
18류지석
Jul 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
모든 공격자한테 단어 공격모션 보이기 wip
parent
6052d290
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
38 deletions
+50
-38
GameServer.js
GameServer.js
+2
-1
Background.js
js/Background.js
+2
-2
Client.js
js/Client.js
+3
-0
WordObject.js
js/WordObject.js
+1
-1
WordSpace.js
js/WordSpace.js
+39
-31
server.js
server.js
+3
-3
No files found.
GameServer.js
View file @
0541c50e
...
...
@@ -76,7 +76,7 @@ class GameRoom
{
this
.
roomId
=
GameServer
.
getRoomNumber
();
this
.
roomIndex
=
-
1
;
this
.
startCount
=
2
;
this
.
startCount
=
4
;
this
.
maxPlayer
=
100
;
this
.
nextRank
=
100
;
...
...
@@ -288,6 +288,7 @@ class Player
this
.
gameRoomId
=
gameRoom
.
roomId
;
this
.
index
=
gameRoom
.
currentPlayer
.
length
;
this
.
nickname
=
playerData
.
nickname
;
this
.
playerImage
=
null
;
this
.
position
=
null
;
this
.
isAlive
=
true
;
...
...
js/Background.js
View file @
0541c50e
var
BackGround
=
BackGround
||
{}
BackGround
.
brainGroup
=
null
;
BackGround
.
myCharacter
=
null
;
BackGround
.
characterPos
=
[
new
Phaser
.
Math
.
Vector2
(
100
,
99
),
new
Phaser
.
Math
.
Vector2
(
248
,
198
),
new
Phaser
.
Math
.
Vector2
(
412
,
144
),
new
Phaser
.
Math
.
Vector2
(
124
,
393
),
new
Phaser
.
Math
.
Vector2
(
368
,
336
),
new
Phaser
.
Math
.
Vector2
(
272
,
453
),
new
Phaser
.
Math
.
Vector2
(
100
,
595
),
new
Phaser
.
Math
.
Vector2
(
284
,
678
),
...
...
@@ -21,7 +20,8 @@ BackGround.loadImage = function(scene)
BackGround
.
drawCharacter
=
function
(
scene
)
{
BackGround
.
myCharacter
=
scene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
*
41
/
48
,
'
pyeongminWrite
'
).
setScale
(
0.45
).
setDepth
(
2
);
RoomData
.
myself
.
playerImage
=
scene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
*
41
/
48
,
'
pyeongminWrite
'
).
setScale
(
0.45
).
setDepth
(
2
);
RoomData
.
myself
.
position
=
new
Phaser
.
Math
.
Vector2
(
RoomData
.
myself
.
playerImage
.
x
,
RoomData
.
myself
.
playerImage
.
y
);
BackGround
.
characterPos
=
BackGround
.
characterPos
.
sort
(
function
(){
return
0.5
-
Math
.
random
()});
RoomData
.
players
.
forEach
(
function
(
element
){
if
(
element
.
id
!=
RoomData
.
myself
.
id
)
...
...
js/Client.js
View file @
0541c50e
...
...
@@ -161,6 +161,9 @@ socket.on('attacked', function(msg) // object attackData
attackedEvent
.
resetCycle
(
ScenesData
.
gameScene
,
4000
,
0
,
false
);
WordSpace
.
attackedEvents
.
push
(
attackedEvent
);
console
.
log
(
msg
.
attacker
);
console
.
log
(
msg
.
victim
);
WordSpace
.
makeAttackPaper
(
ScenesData
.
gameScene
,
msg
.
victim
.
position
,
msg
.
attacker
.
position
);
//console.log(timeout);
});
socket
.
on
(
'
defeat
'
,
function
(
msg
)
// object player
...
...
js/WordObject.js
View file @
0541c50e
...
...
@@ -80,7 +80,7 @@ class WordObject
this
.
wordObj
.
destroy
();
this
.
physicsObj
.
destroy
();
}
BackGround
.
myCharacter
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
write
]);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
write
]);
}
attract
()
...
...
js/WordSpace.js
View file @
0541c50e
...
...
@@ -330,8 +330,8 @@ WordSpace.findWord = function(wordText)
Input
.
attackMode
=
true
;
WordSpace
.
attackGauge
.
pauseCycle
(
true
);
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
BackGround
.
myCharacter
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
attackWrite
]);
BackGround
.
myCharacter
.
anims
.
msPerFrame
/=
(
4
-
WordSpace
.
attackGauge
.
getAttackOption
().
wordGrade
);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
attackWrite
]);
RoomData
.
myself
.
playerImage
.
anims
.
msPerFrame
/=
(
4
-
WordSpace
.
attackGauge
.
getAttackOption
().
wordGrade
);
}
else
// 오타 체크
{
...
...
@@ -403,47 +403,24 @@ WordSpace.attack = function(wordText, grade)
}
else
{
let
target
=
RoomData
.
players
.
find
(
function
(
_element
)
{
return
_element
.
id
==
element
.
ownerId
;
});
let
attackData
=
{
roomNum
:
RoomData
.
roomId
,
attacker
:
RoomData
.
myself
,
target
:
element
.
ownerId
,
victim
:
target
,
text
:
wordText
,
grade
:
grade
,
isStrong
:
element
.
isStrong
,
multiple
:
1
}
WordSpace
.
makeAttackPaper
(
ScenesData
.
gameScene
,
RoomData
.
myself
.
position
,
target
.
position
);
toSend
.
push
(
attackData
);
}
element
.
physicsObj
.
destroy
();
element
.
wordObj
.
destroy
();
var
attackPaper
=
ScenesData
.
gameScene
.
add
.
sprite
(
BackGround
.
myCharacter
.
x
,
BackGround
.
myCharacter
.
y
,
'
attackPapaer
'
).
setScale
(
0.5
).
setDepth
(
3
);
attackPaper
.
throwTarget
=
RoomData
.
players
.
find
(
function
(
_element
)
{
return
_element
.
id
==
element
.
ownerId
;
}).
playerImage
;
attackPaper
.
follower
=
{
t
:
0
,
vec
:
new
Phaser
.
Math
.
Vector2
()
};
attackPaper
.
path
=
new
Phaser
.
Curves
.
Spline
([
BackGround
.
myCharacter
.
x
,
BackGround
.
myCharacter
.
y
,
(
BackGround
.
myCharacter
.
x
+
attackPaper
.
throwTarget
.
x
)
/
2
,
Math
.
min
(
BackGround
.
myCharacter
.
y
,
attackPaper
.
throwTarget
.
y
)
-
100
,
attackPaper
.
throwTarget
.
x
,
attackPaper
.
throwTarget
.
y
-
10
]);
ScenesData
.
gameScene
.
tweens
.
add
({
targets
:
attackPaper
.
follower
,
t
:
1
,
ease
:
'
Linear
'
,
duration
:
4000
,
repeat
:
0
,
onComplete
:
function
()
{
attackPaper
.
destroy
();
WordSpace
.
attackPaperGroup
=
[];
}
});
attackPaper
.
moveObject
=
function
(
obj
)
{
obj
.
path
.
getPoint
(
obj
.
follower
.
t
,
obj
.
follower
.
vec
);
obj
.
setPosition
(
obj
.
follower
.
vec
.
x
,
obj
.
follower
.
vec
.
y
);
}
WordSpace
.
attackPaperGroup
.
push
(
attackPaper
);
});
toSend
.
forEach
(
function
(
element
)
{
...
...
@@ -456,7 +433,7 @@ WordSpace.attack = function(wordText, grade)
WordSpace
.
attackGauge
.
resetValue
();
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
BackGround
.
myCharacter
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
throw
]);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
throw
]);
}
else
WordSpace
.
attackGauge
.
cutValue
(
0.3
);
Input
.
maxInput
=
6
;
...
...
@@ -464,6 +441,37 @@ WordSpace.attack = function(wordText, grade)
WordSpace
.
attackGauge
.
pauseCycle
(
false
);
}
WordSpace
.
makeAttackPaper
=
function
(
scene
,
attackFrom
,
attackTo
)
{
var
attackPaper
=
scene
.
add
.
sprite
(
attackFrom
.
x
,
attackFrom
.
y
,
'
attackPapaer
'
).
setScale
(
0.5
).
setDepth
(
3
);
attackPaper
.
throwTarget
=
attackTo
;
console
.
log
(
attackTo
);
attackPaper
.
follower
=
{
t
:
0
,
vec
:
new
Phaser
.
Math
.
Vector2
()
};
attackPaper
.
path
=
new
Phaser
.
Curves
.
Spline
([
attackFrom
.
x
,
attackFrom
.
y
,
(
attackFrom
.
x
+
attackPaper
.
throwTarget
.
x
)
/
2
,
Math
.
min
(
attackFrom
.
y
,
attackPaper
.
throwTarget
.
y
)
-
100
,
attackPaper
.
throwTarget
.
x
,
attackPaper
.
throwTarget
.
y
-
10
]);
scene
.
tweens
.
add
({
targets
:
attackPaper
.
follower
,
t
:
1
,
ease
:
'
Linear
'
,
duration
:
4000
,
repeat
:
0
,
onComplete
:
function
()
{
attackPaper
.
destroy
();
WordSpace
.
attackPaperGroup
=
[];
}
});
attackPaper
.
moveObject
=
function
(
obj
)
{
obj
.
path
.
getPoint
(
obj
.
follower
.
t
,
obj
.
follower
.
vec
);
obj
.
setPosition
(
obj
.
follower
.
vec
.
x
,
obj
.
follower
.
vec
.
y
);
obj
.
angle
=
720
*
obj
.
follower
.
t
;
}
WordSpace
.
attackPaperGroup
.
push
(
attackPaper
);
}
WordSpace
.
nameQueue
=
{
queue
:
[],
...
...
server.js
View file @
0541c50e
...
...
@@ -94,12 +94,12 @@ io.on('connection', function(socket)
socket
.
on
(
'
attack
'
,
function
(
msg
)
{
socket
.
playerData
.
currentRoom
.
announceToTarget
(
msg
.
target
,
'
attacked
'
,
msg
);
socket
.
playerData
.
currentRoom
.
announceToRoom
(
'
attack
'
,
{
attackerId
:
msg
.
attacker
.
id
,
targetId
:
msg
.
target
});
socket
.
playerData
.
currentRoom
.
announceToTarget
(
msg
.
victim
.
id
,
'
attacked
'
,
msg
);
socket
.
playerData
.
currentRoom
.
announceToRoom
(
'
attack
'
,
{
attackerId
:
msg
.
attacker
.
id
,
targetId
:
msg
.
victim
.
id
});
//console.log('attack ' + msg.target + ' by ' + msg.attacker.id + ' with ' + msg.text);
setTimeout
(
function
()
{
let
target
=
GameServer
.
findPlayerSocket
(
msg
.
target
);
let
target
=
GameServer
.
findPlayerSocket
(
msg
.
victim
.
id
);
if
(
target
!=
null
)
{
let
dataToPush
=
...
...
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