-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb3c1e4
commit 80dc87d
Showing
4 changed files
with
55 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
import pygame | ||
|
||
def platform_collision(screen,character_pos, character_img): | ||
# def platform_collision(screen,character_pos, character_img): | ||
def platform_collision(): | ||
platform_list = [] | ||
lamp = pygame.Rect(1002, 748, 185, 1) | ||
floor = pygame.Rect(0, 900, 1792, 1) | ||
|
||
lamp = pygame.Rect(1002, 700, 185, 10) | ||
platform_list.append(lamp) | ||
|
||
floor = pygame.Rect(0, 892, 1792, 10) | ||
platform_list.append(floor) | ||
|
||
character_rect = character_img.get_rect(topleft=character_pos) | ||
|
||
for collide_point in platform_list: | ||
if character_rect.colliderect(collide_point): | ||
if collide_point == floor: | ||
pygame.draw.rect(screen, (255, 0, 0,), floor) | ||
elif collide_point == lamp: | ||
pygame.draw.rect(screen, (255, 0, 0,), lamp) | ||
else: | ||
pygame.draw.rect(screen, (0, 0, 0,), floor) | ||
pygame.draw.rect(screen, (0, 0, 0,), lamp) | ||
return platform_list | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters