- Timestamp:
- May 18, 2013, 7:21:55 PM (12 years ago)
- Branches:
- master
- Children:
- 876add0
- Parents:
- 7d91bbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r7d91bbe r74b8e79 383 383 cout << "valid terrain" << endl; 384 384 385 //cout << "orig x: " << mapPlayers[id].pos.x << endl;386 //cout << "orig y: " << mapPlayers[id].pos.y << endl;387 // first we get the correct vector388 385 mapPlayers[id].target.x = x; 389 386 mapPlayers[id].target.y = y; 390 387 int xDiff = mapPlayers[id].target.x - mapPlayers[id].pos.x; 391 388 int yDiff = mapPlayers[id].target.y - mapPlayers[id].pos.y; 392 //cout << "xDiff: " << xDiff << endl;393 //cout << "yDiff: " << yDiff << endl;394 395 // then we get the correct angle396 double angle = atan2(yDiff, xDiff);397 cout << "angle: " << angle << endl;398 399 // finally we use the angle to determine400 // how much the player moves401 // the player will move 50 pixels in the correct direction402 //mapPlayers[id].pos.x += cos(angle)*50;403 //mapPlayers[id].pos.y += sin(angle)*50;404 389 405 390 serverMsg.type = MSG_TYPE_PLAYER_MOVE; … … 408 393 memcpy(serverMsg.buffer+4, &mapPlayers[id].target.x, 4); 409 394 memcpy(serverMsg.buffer+8, &mapPlayers[id].target.y, 4); 410 //memcpy(serverMsg.buffer, clientMsg.buffer, 12);411 395 412 396 broadcastResponse = true;
Note:
See TracChangeset
for help on using the changeset viewer.