Changeset 5a5f131 in network-game for client/Client


Ignore:
Timestamp:
Jun 19, 2013, 11:54:55 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
5c95436
Parents:
66c4ec4
Message:

Dead players aren't drawn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r66c4ec4 r5a5f131  
    367367            for (it2 = mapProjectiles.begin(); it2 != mapProjectiles.end(); it2++)
    368368            {
    369                cout << "Update projectile position" << endl;
    370369               it2->second.move(mapPlayers);
    371370            }
     
    377376            for (it2 = mapProjectiles.begin(); it2 != mapProjectiles.end(); it2++)
    378377            {
    379                cout << "Draw projectile" << endl;
    380 
    381378               Projectile proj = it2->second;
    382379
     
    532529            case MSG_TYPE_PLAYER:   // kind of hacky to put this here
    533530            {
    534                cout << "Got MSG_TYPE_PLAYER message in STATE_START" << endl;
    535 
    536531               Player p("", "");
    537532               p.deserialize(msg.buffer);
    538533               p.timeLastUpdated = getCurrentMillis();
     534
    539535               mapPlayers[p.id] = p;
    540536
    541                cout << "new player id: " << p.id << endl;
    542                cout << "map size: " << mapPlayers.size() << endl;
    543 
    544537               break;
    545538            }
    546539            case MSG_TYPE_OBJECT:
    547540            {
    548                cout << "Received OBJECT message in STATE_START." << endl;
    549 
    550541               WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0);
    551542               o.deserialize(msg.buffer);
     
    591582            case MSG_TYPE_PLAYER:
    592583            {
    593                //cout << "Got MSG_TYPE_PLAYER message in STATE_LOGIN" << endl;
    594 
    595584               Player p("", "");
    596585               p.deserialize(msg.buffer);
    597586               p.timeLastUpdated = getCurrentMillis();
    598587               p.isChasing = false;
     588               if (p.health <= 0)
     589                  p.isDead = true;
     590               else
     591                  p.isDead = false;
     592
    599593               mapPlayers[p.id] = p;
    600594
     
    603597            case MSG_TYPE_PLAYER_MOVE:
    604598            {
    605                cout << "Got a player move message" << endl;
    606 
    607599               unsigned int id;
    608600               int x, y;
     
    793785   {
    794786      p = &it->second;
     787
     788      if (p->isDead)
     789         continue;
     790
    795791      pos = mapToScreen(p->pos);
    796792
Note: See TracChangeset for help on using the changeset viewer.