-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessages.py
More file actions
32 lines (29 loc) · 966 Bytes
/
messages.py
File metadata and controls
32 lines (29 loc) · 966 Bytes
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
"""
Author Paul Brace March 2025
PacMan game developed using arcade
Disappearing messages
"""
import arcade
from constants import *
class Message():
""" A disappearing message class
will remain on screen for time and then fly up to top of screen """
def __init__(self, text, pos, color, size, time, center):
if center:
self.message = arcade.Text(text, pos[0], pos[1],
color, size, WINDOW_WIDTH, align="center")
else:
self.message = arcade.Text(text, pos[0], pos[1],
color, size, WINDOW_WIDTH)
self.time = time
self.done = False
self.remove = False
def draw(self):
self.time -= 1
if self.time < 1:
self.remove = True
if self.remove:
self.message.y += 10
if self.message.y > WINDOW_HEIGHT:
self.done = True
self.message.draw()