Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int actCollision( SDL_Rect offender, SDL_Rect defender, int offenderType, int defenderType )
- {
- //if the one moving into the space is a zombie
- if ( offender.y == defender.y && offender.x == defender.x && offenderType == 3 && defenderType == 2 )
- {
- defenderType = 3;// the one occupying the space is now a zombie
- return (defenderType);
- }
- // if player
- else if ( offender.y == defender.y && offender.x == defender.x && offenderType == 3 && defenderType == 1 )
- {
- stop(); // game over
- }
- }
- int checkCollision()
- {
- int compare1 = 1;
- int compare2 = 1;
- while( compare1 < 49 )
- {
- if( compare2 == 49 )
- {
- compare1 ++;
- }
- else
- {
- if( compare1 != compare2 )
- {
- actCollision( object[compare1], object[compare2], type[compare1], type[compare2] );
- compare2 ++;
- }
- else
- {
- compare2 ++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement