Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
void CGame::CollisionClock() { SDL_Rect RectPlayer = m_pPlayer->GetRect (); list<CClock>::iterator i; for (i=m_lClock.begin (); i != m_lClock.end (); i++) { RectPlayer = m_pPlayer->GetRect (); if (RectPlayer.y < i->GetRect ().y + i->GetRect ().h && RectPlayer.y + RectPlayer.h > i->GetRect ().y && RectPlayer.x < i->GetRect ().x + i->GetRect ().w && RectPlayer.x + 64 > i->GetRect ().x) { //Sound abspielen m_pSoundPing->PlaySound (); cout<<RectPlayer.x<<" "<<RectPlayer.y<<endl; cout<<"Collision witch Item: Clock"<<endl; //Kontroll ausgabe //Der Clock das Leben "entziehen" i->SetALive(false); if(!i->GetALive ()) i = m_lClock.erase(i); cout<<"Delete Item: Clock"<<endl; } } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
void CGame::RenderClock() { list<CClock>::iterator i; for (i=m_lClock.begin (); i != m_lClock.end ();i++) { if (i->GetALive ()) { i->Update (); i->Render (); } else { i->SetALive(false); i=m_lClock.erase (i); } } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
for (i=m_lClock.begin (); i != m_lClock.end ();) { if (i->GetALive ()) { i->Update (); i->Render (); ++i; } else { i->SetALive(false); i=m_lClock.erase (i); } } |
Werbeanzeige