Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-server-flip-jump
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Gia Vương
game-server-flip-jump
Commits
61c5fdb7
Commit
61c5fdb7
authored
Aug 20, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build
parent
4ed14930
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
networkCtrl.js
dist/Controller/networkCtrl.js
+0
-1
index.js
dist/index.js
+17
-14
socket.js
dist/socket.js
+8
-4
No files found.
dist/Controller/networkCtrl.js
View file @
61c5fdb7
...
@@ -60,7 +60,6 @@ function endGameApi(user) {
...
@@ -60,7 +60,6 @@ function endGameApi(user) {
gameLevel
:
user
.
towerNumber
-
1
,
gameLevel
:
user
.
towerNumber
-
1
,
details
details
};
};
console
.
log
(
'END GAME'
);
const
res
=
yield
callApi
(
URL_END_GAME
,
'POST'
,
params
);
const
res
=
yield
callApi
(
URL_END_GAME
,
'POST'
,
params
);
return
res
;
return
res
;
}
}
...
...
dist/index.js
View file @
61c5fdb7
...
@@ -13,20 +13,23 @@ const io = new socket_io_1.Server(server, {
...
@@ -13,20 +13,23 @@ const io = new socket_io_1.Server(server, {
path
:
'/socket'
,
path
:
'/socket'
,
cors
:
{
cors
:
{
methods
:
[
"GET"
,
"POST"
],
methods
:
[
"GET"
,
"POST"
],
origin
:
(
origin
,
callback
)
=>
{
origin
:
[
console
.
log
(
'origin'
,
origin
);
const
allowed
=
[
"https://play.gamee.vn"
,
"https://play.gamee.vn"
,
"https://dev.gamee.vn"
,
"https://dev.gamee.vn"
,
"http://localhost:7456"
"http://localhost:7456"
];
]
if
(
!
origin
||
allowed
.
includes
(
origin
))
{
// origin: (origin, callback) => {
callback
(
null
,
origin
);
// const allowed = [
}
// "https://play.gamee.vn",
else
{
// "https://dev.gamee.vn",
callback
(
new
Error
(
"Not allowed by CORS"
));
// "http://localhost:7456"
}
// ];
},
// if (!origin || allowed.includes(origin)) {
// callback(null, origin);
// } else {
// callback(new Error("Not allowed by CORS"));
// }
// },
// credentials: true,
// credentials: true,
}
}
});
});
...
...
dist/socket.js
View file @
61c5fdb7
...
@@ -115,10 +115,14 @@ function passTower(socket, data) {
...
@@ -115,10 +115,14 @@ function passTower(socket, data) {
const
{
direction
,
nextBlock
,
towerNumber
,
position
}
=
user
;
const
{
direction
,
nextBlock
,
towerNumber
,
position
}
=
user
;
if
(
towerNumber
>
MAX_TOWER
)
{
if
(
towerNumber
>
MAX_TOWER
)
{
let
speed
=
INIT_SPEED
;
let
speed
=
INIT_SPEED
;
for
(
let
i
=
0
;
i
<
data
.
step
;
i
++
)
{
// data.step = Math.min(data.step, 150);
speed
+=
(
Math
.
min
(
towerNumber
-
MAX_TOWER
,
A_POWER
)
*
DT
);
// for (let i = 0; i < data.step; i++) {
xDistance_
+=
speed
*
DT
;
// speed += (Math.min(towerNumber - MAX_TOWER, A_POWER) * DT);
}
// xDistance_ += speed * DT;
// }
const
acceleration
=
Math
.
min
(
towerNumber
-
MAX_TOWER
,
A_POWER
)
*
DT
;
speed
+=
data
.
step
*
acceleration
;
xDistance_
+=
INIT_SPEED
*
data
.
step
*
DT
+
acceleration
*
DT
*
(
data
.
step
*
(
data
.
step
-
1
))
/
2
;
}
}
else
{
else
{
xDistance_
=
data
.
step
*
INIT_SPEED
*
DT
;
xDistance_
=
data
.
step
*
INIT_SPEED
*
DT
;
...
...
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