I wanted to make and indie RPG game put I have come to a problem which is that the screen(surface) doesn't blit the txt onto the speech box i have searched for the reason why it would not blit text on youtube but they say i need to fill the screen with black constantly through a loop and I understand that, it's just that I have already got it in my draw function in the Game class so I don't know what to do.. I hope that you excellent developers could find out what I did wrong.
Thanks for helping when the time does come!
This is my Definitives.py where game Variables(Containers), game Colors and game Tilemaps are stored
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 510
TILESIZE = 32
FPS = 60
PLAYER_SPEED = 3 # used for camera speed as well
ENEMY_SPEED =2
SECOND_FLOOR = 6
PLAYER_LAYER = 5
ENEMY_LAYER = 4
ITEM_LAYER = 3
BLOCK_LAYER = 2
GROUND2_LAYER = 1
GROUND_LAYER = 0
RED GREEN BLUE
R G B
white = 255,255,255
grey = 128,128,128
dgrey = 64, 64, 64
black = 0, 0, 0
llblue= 192,255,255
lblue = 128,255,255
pink = 255,0, 255
red = 255,0, 0
blue = 0, 255,255
green = 0, 255,0
dblue = 0, 128,255
ddblue =0, 0, 128
dyellow=128,128,0
yellow =255,192,0
https://drive.google.com/file/d/1Auh08wT7VcpJtUyw1s_jB-3K43RRvzjI/view?usp=sharing <-- this will send you to my Tilemap3 that the key and screwdriver refer to in the function CreateTilemap in the Game class
This is my Main.py! It includes all the game events, game functions, drawing sprites, and upoaded files
imports are done here for main.py
import pygame.display
from Sprites import *
from Definitives import *
import pygame as pg
displaying paragraph onto the screen function is made here
def display_text( window, txt, pos, font, color, color2):
collection = [word.split(' ') for word in txt.splitlines()] <------ word is the words inach line which is in the variable txt
space = font.size(' ')[0]
x, y = pos
for lines in collection:
for words in lines:
word_surface = font.render(words, False, color, color2)
word_width, word_height = word_surface.get_size()
if x + word_width >= 580:
x = pos[0]
y += word_height
window.blit(word_surface, (x, y))
x += word_width + space
x = pos[0]
y += word_height
Game Class starts here
class Game:
def __init__(self): initialization function for the game class
super().__init__()
pg.init()
# simple containers or lists (Boolean or not)
self.column = None
self.row = None
self.num = None
self.num2 = None
self.running = True
self.screen = pg.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
self.clock = pg.time.Clock()
self.font_list = ['LucySaid', 'AnandaBlack', 'Dirtyboy', 'MotleyForces', 'EmotionalRescue', 'HelloKetta']
self.font = pg.font.SysFont(self.font_list[0], 32)
self.font2 = pg.font.SysFont(self.font_list[0], 56)
def draw(self):
self.screen.fill(black)
self.all.draw(self.screen)
self.life.draw(self.screen)
def main(self):
Speech 4 Variables
self.speech4 = 0
self.speech_disabled4 = False
self.txtcount4 = 0
self.namecount4 = 0
self.count4 = 0
self.notice4 = 0
self.msg4_complete = 0
self.comeback4 = 0
self.stopwatch4 = 0
self.left4 = 0
self.leave4 = False
Speech 5 Variables
self.speech5 = 0
self.speech_disabled5 = False
self.txtcount5 = 0
self.namecount5 = 0
self.count5 = 0
self.notice5 = 0
self.msg5_complete = 0
self.comeback5 = 0
self.stopwatch5 = 0
self.left5 = 0
self.leave5 = False
while self.playing:
key = pg.key.get_pressed()
self.screen.fill(black)
this checks to see if all conditions is met for Speech 5
print('self.bed pos = ',self.bed.rect[:2])
print('txtcount5 =', self.txtcount5)
print('self.speech5 =', self.speech5)
print(' self.screwdriver has frozen? ', self.screwdriver.freeze)
print('Is screwdriver has collected? ', self.screwdriver.collected)
print('Is speech5 disabled? =', self.speech_disabled5)
print('count5 =', self.count5)
The setup for speech 4
self.img = self.vent_background
self.solution = ["I dont have a screw driver yet.. It must be here somewhere... ",
"probably I can chat with the others and see what they can do?"
]
self.relief = ['Ok, now lets unscrew this...',
'Time to move out'
]
if self.screwdriver.collected is True:
speech4 = self.relief
else:
speech4 = self.solution
if (self.bed.rect.x == 1440 and self.bed.rect.y == 576 or self.bed.rect.x == 1443 and self.bed.rect.y == 576 or self.bed.rect.x == 1446 and self.bed.rect.y == 576 or self.bed.rect.x == 1449 and self.bed.rect.y == 576 or self.bed.rect.x == 1452 and self.bed.rect.y == 576 or self.bed.rect.x == 1455 and self.bed.rect.y == 576or self.bed.rect.x == 1458 and self.bed.rect.y == 576 or self.bed.rect.x == 1461 and self.bed.rect.y == 576 or self.bed.rect.x == 1464 and self.bed.rect.y == 576 or self.bed.rect.x == 1437 and self.bed.rect.y == 576or self.bed.rect.x == 1434 and self.bed.rect.y == 576or self.bed.rect.x == 1431 and self.bed.rect.y == 576 or self.bed.rect.x == 1428 and self.bed.rect.y == 576 or self.bed.rect.x == 1425 and self.bed.rect.y == 576or self.bed.rect.x == 1422 and self.bed.rect.y == 576) or (self.bed.rect.x == 1440 and self.bed.rect.y == 584 or self.bed.rect.x == 1443 and self.bed.rect.y == 584 or self.bed.rect.x == 1446 and self.bed.rect.y == 584 or self.bed.rect.x == 1449 and self.bed.rect.y == 584 or self.bed.rect.x == 1452 and self.bed.rect.y == 584 or self.bed.rect.x == 1455 and self.bed.rect.y == 584or self.bed.rect.x == 1458 and self.bed.rect.y == 584 or self.bed.rect.x == 1461 and self.bed.rect.y == 584 or self.bed.rect.x == 1464 and self.bed.rect.y == 584 or self.bed.rect.x == 1437 and self.bed.rect.y == 584or self.bed.rect.x == 1434 and self.bed.rect.y == 584or self.bed.rect.x == 1431 and self.bed.rect.y == 584 or self.bed.rect.x == 1428 and self.bed.rect.y == 584 or self.bed.rect.x == 1425 and self.bed.rect.y == 584or self.bed.rect.x == 1422 and self.bed.rect.y == 584) and self.screwdriver.freeze is True:
self.notice4 = 1
else:
self.notice4 = 0
if self.notice4 == 0 and self.msg4_complete > 0 and self.screwdriver.freeze is True:
self.left4 += 1
if self.left4 >= (max_time // 20) + 1:
self.left4 = max_time // 20
if self.left4 == max_time // 20:
self.leave4 = True
if self.notice4 == 0 and self.msg4_complete >= 1 and math.floor(
self.count4) == 1 and self.leave4 is True and self.screwdriver.freeze is True:
self.stopwatch4 += 1
if self.stopwatch4 >= max_time + 1:
self.stopwatch4 = 0
if self.leave4 is True and self.notice4 == 1 and self.stopwatch4 <= max_time and self.screwdriver.freeze is True:
self.comeback4 = self.msg4_complete
self.leave4 = False
self.left4 = 0
self.stopwatch4 = 0
if key[
pg.K_SPACE] and self.speech4 == 1 and self.speech_disabled4 is False and self.screwdriver.freeze is True:
self.count4 += 0.1333
self.txtcount4 += 0.1333
self.namecount4 += 0.1333
if self.count4 > 1:
self.count4 = 1
if self.txtcount4 >= 1:
self.txtcount4 = 1
if math.floor(self.namecount4) > 1:
self.namecount4 = 0
#if self.notice4 == 1 and key[pg.K_SPACE] and (
# self.count4 > 0.9000 and self.count4 < 1.0) and self.speech4 == 0 and self.screwdriver.freeze is True:
# self.count4 = 1
if (self.notice4 == 1 and key[
pg.K_SPACE]) and self.speech_disabled4 is False and self.screwdriver.freeze is True:
self.speech4 = 1
self.speech_box4 = Speech_Box2(self, 608, 125, black, 0.5, 11.5)
self.speech_box_outline4 = Speech_Box2(self, 625, 142, white, 0.25, 11.25)
self.character_names4 = Names2(self, 'Senyti',
(self.speech_box_outline2.rect.x, self.speech_box_outline2.rect.y),
green, None)
if self.notice4 == 1 and self.speech4 == 1 and self.speech_disabled4 is False and self.screwdriver.freeze is True:
self.screen.blit(self.img, (0,0))
self.screen.blit(self.speech_box_outline4.image, self.speech_box_outline2.rect)
self.screen.blit(self.speech_box4.image, self.speech_box4.rect)
self.screen.blit(self.character_names4.image, self.character_names4.rect)
display_text(self.speech_box4.image, speech4[math.floor(self.txtcount4)], (20, 20),
pg.font.SysFont('Hello Ketta', 40), white, black)
if math.floor(
self.count4) == 1 and self.speech_disabled4 is False and self.leave4 is False and self.screwdriver.freeze is True:
self.speech_disabled4 = True
self.speech4 = 0
self.msg4_complete = 0
self.txtcount4 = 0
self.namecount4 = 0
self.msg4_complete += 1
if self.notice4 == 1 and self.speech4 == 0 and math.floor(self.count4) == 1 and key[
pg.K_SPACE] and self.speech_disabled4 is True and self.msg4_complete == 1 and self.comeback4 > 0 and self.speech4 == 0 and self.speech_disabled3 is True and self.screwdriver.freeze is True:
self.speech_disabled4 = False
self.speech_disabled3 = False
self.msg4_complete = 0
self.txtcount4 = 0
self.namecount4 = 0
self.count4 = 0
the set up for Speech 5
self.suggestion = ["All those people may not survive tomorrow.\nSome of them are my brothers.",
"They may know a way out of this place,\nI need more than just myself to end all of our suffering"
]
self.guilt = ['No! I am sure they can find their own way out, they will be saved!',
"But what if they can't...."
]
if self.screwdriver.collected is True:
speech5 = self.suggestion
if (self.bed.rect.x == -66 and self.bed.rect.y == 33 or self.bed.rect.x == -69 and self.bed.rect.y == 33 or self.bed.rect.x == -72 and self.bed.rect.y == 33 or self.bed.rect.x == -75 and self.bed.rect.y == 33 or self.bed.rect.x == -78 and self.bed.rect.y == 33 or self.bed.rect.x == -81 and self.bed.rect.y == 33or self.bed.rect.x == -84 and self.bed.rect.y == 33 or self.bed.rect.x == -87 and self.bed.rect.y == 3 or self.bed.rect.x == -90 and self.bed.rect.y == 33 or self.bed.rect.x == -63 and self.bed.rect.y == 33or self.bed.rect.x == -60 and self.bed.rect.y == 33or self.bed.rect.x == -57 and self.bed.rect.y == 33 or self.bed.rect.x == -54 and self.bed.rect.y == 33 or self.bed.rect.x == -51 and self.bed.rect.y == 33or self.bed.rect.x == -48 and self.bed.rect.y == 33) or (self.bed.rect.x == -66 and self.bed.rect.y == 39 or self.bed.rect.x == -69 and self.bed.rect.y == 39 or self.bed.rect.x == -72 and self.bed.rect.y == 39 or self.bed.rect.x == -75 and self.bed.rect.y == 39 or self.bed.rect.x == -78 and self.bed.rect.y == 39 or self.bed.rect.x == -81 and self.bed.rect.y == 39or self.bed.rect.x == -84 and self.bed.rect.y == 39 or self.bed.rect.x == -87 and self.bed.rect.y == 39 or self.bed.rect.x == -90 and self.bed.rect.y == 39 or self.bed.rect.x == -63 and self.bed.rect.y == 39or self.bed.rect.x == -60 and self.bed.rect.y == 39or self.bed.rect.x == -57 and self.bed.rect.y == 39 or self.bed.rect.x == -54 and self.bed.rect.y == 39 or self.bed.rect.x == -51 and self.bed.rect.y == 39or self.bed.rect.x == -48 and self.bed.rect.y == 39) and self.screwdriver.freeze is True:
self.notice5 = 1
else:
self.notice5 = 0
if key[
pg.K_SPACE] and self.speech5 == 1 and self.speech_disabled5 is False and self.screwdriver.freeze is True:
self.count5 += 0.1333
self.txtcount5 += 0.1333
self.namecount5 += 0.1333
if self.count5 > 1:
self.count5 = 1
if self.txtcount5 >= 1:
self.txtcount5 = 1
if math.floor(self.namecount5) > 1:
self.namecount5 = 0
if self.notice5 == 1 and key[pg.K_SPACE] and (
self.count5 > 0.9000 and self.count5 < 1.0) and self.speech5 == 0:
self.count5 = 1
if self.notice5 == 1 and self.speech_disabled5 is False:
self.speech5 = 1
self.speech_box5 = Speech_Box3(self, 608, 125, black, 0.5, 11.5)
self.speech_box_outline5 = Speech_Box3(self, 625, 142, white, 0.25, 11.25)
self.character_names5 = Names2(self, 'Senyti',
(self.speech_box_outline5.rect.x, self.speech_box_outline5.rect.y),
green, None)
if self.notice5 == 1 and self.speech5 == 1 and self.speech_disabled5 is False:
self.screen.blit(self.speech_box_outline5.image, self.speech_box_outline5.rect)
self.screen.blit(self.speech_box5.image, self.speech_box5.rect)
self.screen.blit(self.character_names5.image, self.character_names5.rect)
display_text(self.speech_box5.image, speech5[math.floor(self.txtcount5)], (0, 0),
pg.font.SysFont('Hello Ketta', 40), white, white)
pg.display.flip() <--- This is what I tried to do but still the text for speech 5 won't show up
if math.floor(
self.count5) == 1 and self.speech_disabled5 is False:<---- this is saying if the message is finished but showing then restart all of its variables and change the variable speech_diasbled5 to True
self.speech_disabled5 = True < -- this means that speech 5 is not showing anymore
self.speech5 = 0 <--- this means that the speech is able to be restablished
self.msg5_complete = 0 ----------------------I
self.txtcount5 = 0 the rest just I
self.namecount5 = 0 restarts I
self.msg5_complete += 1 ---------------------I
if self.notice5 == 1 and self.speech5 == 0 and math.floor(self.count5) == 1 and key[
pg.K_SPACE] and self.speech_disabled5 is True and self.msg5_complete == 1 and self.comeback5 > 0 and self.speech5 == 0:<--- This is saying if the player is noticed and speech can be rekindled while it is finished restart all of its variables
self.speech_disabled5 = False <-- this means the speech is not gone
self.msg5_complete = 0 ----------------------I
self.txtcount5 = 0 the rest just I
self.namecount5 = 0 restarts I
self.count5 = 0 -----------------------------I
pg.display.update() <----- this updates pygame
self.clock.tick(FPS) <----- this sets the speed back to 60 FPS
self.running = False <--- whenb it is false tthe game is not running
End of Game loop
g = Game()
g.showgame_menu()
g.intro_screen()
g.new()
while g.running:
g.main()
g.game_over()
g.clock.tick(FPS)
pg.display.update()
This is the Sprites.py, where Sprite classes, Sprite functions and their attributes are made
imports start here
import math
import pygame as pg
from Definitives import *zx
class Speech_Box(pg.sprite.Sprite):
def __init__(self, game, w, h, color, x, y):
self.game = game
self.groups = self.game.life
self._layer = PLAYER_LAYER
pg.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILESIZE
self.y = y * TILESIZE
self.image = pg.Surface([w, h])
self.image.fill(color)
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
def update(self):
key = pg.key.get_pressed()
if key[pg.K_SPACE] and math.floor(self.game.count) > 3.997 and self.game.speech == 0:
self.remove(self.game.life)
# for speech in between cells
if (self.game.speech_disabled3 is True and key[pg.K_SPACE]) and math.floor(self.game.count3) == 2 and self.game.speech3 == 0 and self.game.shout != self.game.phrase3:
self.remove(self.game.life)
if (self.game.speech_disabled3 is True and key[pg.K_SPACE]) and math.floor(self.game.count3) == 3 and self.game.speech3 == 0 and self.game.shout == self.game.phrase3:
self.remove(self.game.life)
class Names(pg.sprite.Sprite):
def __init__(self, game, txt, pos, color, color2):
self.pos = pos
self.font = pg.font.SysFont('Hello Ketta', 40)
self.color = color
self.color2 = color2
self.game = game
self.groups = self.game.life
self._layer = PLAYER_LAYER
self.namecount = 0
pg.sprite.Sprite.__init__(self, self.groups)
self.image = self.font.render(txt, False, self.color, self.color2)
self.rect = self.image.get_rect()
self.rect.x = pos[0]
self.rect.y = pos[1]
def update(self):
key = pg.key.get_pressed()
if math.floor(self.game.txtcount) == 4:
self.namecount = 1
if self.game.notice == 1 and key[pg.K_SPACE] and math.floor(self.game.count) > 3.997 and self.game.speech == 0:
self.remove(self.game.life)
# for speech in between cells
if (self.game.speech_disabled3 is True and key[pg.K_SPACE]) and math.floor(self.game.count3) == 2 and self.game.speech3 == 0 and self.game.shout != self.game.phrase3:
self.remove(self.game.life)
if (self.game.speech_disabled3 is True and key[pg.K_SPACE]) and math.floor(self.game.count3) == 3 and self.game.speech3 == 0 and self.game.shout == self.game.phrase3:
self.remove(self.game.life)
# for speech 2
class Speech_Box2(pg.sprite.Sprite):
def __init__(self, game, w, h, color, x, y):
self.game = game
self.groups = self.game.life
self._layer = PLAYER_LAYER
pg.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILESIZE
self.y = y * TILESIZE
self.image = pg.Surface([w, h])
self.image.fill(color)
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
def update(self):
pg.key.get_pressed()
if self.game.msg2_complete > 0 and math.floor(self.game.count2) == 4 and self.game.speech2 == 0:
self.remove(self.game.life)
self.game.comeback2 = 0
if math.floor(self.game.count2) == 4 and self.game.msg2_complete >= 1 and self.game.comeback2 == 1:
self.game.msg2_complete = 0
if self.game.msg4_complete >= 1 and math.floor(self.game.count4) == 1 and self.game.speech4 == 0:
self.remove(self.game.life)
self.game.comeback4 = 0
class Names2(pg.sprite.Sprite):
def __init__(self, game, txt, pos, color, color2):
self.pos = pos
self.font = pg.font.SysFont('Hello Ketta', 40)
self.color = color
self.color2 = color2
self.game = game
self.groups = self.game.life
self._layer = PLAYER_LAYER
self.namecount = 0
pg.sprite.Sprite.__init__(self, self.groups)
self.image = self.font.render(txt, False, self.color, self.color2)
self.rect = self.image.get_rect()
self.rect.x = pos[0]
self.rect.y = pos[1]
def update(self):
if math.floor(self.game.txtcount) == 4:
self.namecount = 1
if self.game.msg2_complete >= 1 and math.floor(self.game.count2) == 4 and self.game.speech2 == 0:
self.remove(self.game.life)
self.game.comeback2 = 0
if math.floor(self.game.count2) == 4 and self.game.msg2_complete >= 1 and self.game.comeback2 == 1:
self.game.msg2_complete = 0
self.remove(self.game.life)
if self.game.msg4_complete >= 1 and math.floor(self.game.count4) == 1 and self.game.speech4 == 0:
self.remove(self.game.life)
self.game.comeback4 = 0
class Speech_Box3(pg.sprite.Sprite):
def __init__(self, game, w, h, color, x, y):
self.game = game
self.groups = self.game.life
self._layer = PLAYER_LAYER
pg.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILESIZE
self.y = y * TILESIZE
self.image = pg.Surface([w, h])
self.image.fill(color)
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
def update(self):
pg.key.get_pressed()
if self.game.msg5_complete > 0 and math.floor(self.game.count5) == 1 and self.game.speech5 == 0:
self.remove(self.game.life)
self.game.comeback5 = 0
class ScrewDriver(pg.sprite.Sprite):
def __init__(self, game, x, y, color, layer, group) -> object:
self.game = game
self.groups = group
self._layer = layer
pg.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILESIZE
self.y = y * TILESIZE
self.image = self.game.tools_spritesheet.get_sprite(0, 0, 16, 16, color)
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
self.x_change = 0
self.y_change = 0
self.go_up = False
self.freeze = False
self.collected = False
self.move_up_limit = 51
self.movement_loop = 0
def update(self):
self.movement()
key = pg.key.get_pressed()
self.player_collide()
self.rect.x += self.x_change
self.rect.y += self.y_change
if self.game.count3 == 3 and key[pg.K_SPACE]:
self.go_up = True
self.x_change = 0
self.y_change = 0
def movement(self):
key = pg.key.get_pressed()
if self.go_up is True and self.freeze is False:
self.y_change -= PLAYER_SPEED
self.movement_loop -= 1
if self.movement_loop <= -self.move_up_limit:
self.freeze = True
self.go_up = False
self.y_change = 0
self.movement_loop = 0
def player_collide(self):
key = pg.key.get_pressed()
hits = pg.sprite.spritecollide(self, self.game.all, False)
if hits and key[pg.K_a] and self.collected is False:
self.collected = True
self.remove(self.groups)
class Key(pg.sprite.Sprite):
def __init__(self, game, x, y, color, layer, group):
self.game = game
self.groups = group
self._layer = layer
pg.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILESIZE
self.y = y * TILESIZE
self.image = self.game.tools_spritesheet.get_sprite(48, 0, 16, 24, color)
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
self.x_change = 0
self.y_change = 0
self.go_up = False
self.freeze = False
self.collected = False
self.move_up_limit = 51
self.movement_loop = 0
def update(self):
self.player_collide()
def player_collide(self):
key = pg.key.get_pressed()
if (self.game.bed.rect.x == 1689 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1686 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1683 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1692 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1695 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1698 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1701 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1704 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1707 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1710 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1713 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1716 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1719 and self.game.bed.rect.y == 798 or self.game.bed.rect.x == 1722 and self.game.bed.rect.y == 798) or (self.game.bed.rect.x == 1689 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1686 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1683 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1692 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1695 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1698 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1701 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1704 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1707 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1710 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1713 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1716 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1719 and self.game.bed.rect.y == 804 or self.game.bed.rect.x == 1722 and self.game.bed.rect.y == 804):
self.notice = 1
else:
self.notice = 0
if self.notice == 1 and key[pg.K_a] and self.collected is False:
self.collected = True
self.remove(self.groups)