A simple pygame-based text scroller.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

# Scroller object within which the base text string is stored, and the current
# list of visible characters is maintained and updated.
from . import character
class Scroller:
def __init__(self, text):
self.text = text
self.next_char = 0
self.sheet_chars = []
# obtains the next character adds it to the list of characters to render.
def get_next_char(self,
x=0,
y=0,
x_speed=0.1,
y_speed=0.1,
angle=0,
radius=20):
self.sheet_chars.append(character.Character(x,
y,
x_speed,
y_speed,
angle,
radius,
self.text[self.next_char]))
if (self.next_char < (len(self.text) - 1)):
self.next_char += 1
else:
self.next_char = 0
# Removes a character from the render list, usually as a result of leaving
# the screen.
def delete_first_char(self):
self.sheet_chars.pop(0)