py-vpet/vpet.py
2024-12-11 18:31:41 +01:00

122 lines
2.3 KiB
Python

from PIL import Image
class Rotate:
down = 0.0
right = 90.0
up = 180.0
left = 270.0
class Dialogs:
dreaming = []
class Frames:
"""These strings do match to the PNGs of the VPet which are representation the frames of an animation"""
idle_1 = 'idle1'
idle_2 = 'idle2'
idle_3 = 'idle3'
move_1 = 'moving_1'
move_2 = 'moving_2'
hearts_1 = 'heart'
floating = 'floating'
class Animations:
@staticmethod
def idle_1(rotation: float):
pass
@staticmethod
def move_right(rotation: float):
pass
@staticmethod
def move_left(rotation: float):
pass
@staticmethod
def move_up(rotation: float):
pass
@staticmethod
def move_down(rotation: float):
pass
@staticmethod
def sleep(rotation: float):
pass
@staticmethod
def wakeup(rotation: float):
pass
class VPet:
def __init__(self, x=0, y=0, screen=1):
self.screen = screen
self.x_postion = x
self.y_postion = y
self.rotation = Rotate.up
self.is_idle = True
self.is_sleeping = False
self.is_dreaming = False
self.is_moving = False
self.is_talking = False
self.is_thinking = False
def reset_activity_to_idle(self):
self.is_idle = True
self.is_sleeping = False
self.is_dreaming = False
self.is_moving = False
self.is_talking = False
self.is_thinking = False
def choose_walk_destination(self):
"""Decide, where the VPet should move to"""
pass
def choose_activity(self):
"""Decide, what kind of activity should be done"""
pass
def move(self, x: int, y: int):
"""Move the VPet to xy"""
self.is_moving = True
def sleep(self):
"""Set the VPet asleep"""
self.reset_activity_to_idle()
self.is_sleeping = True
Animations.sleep(rotation=self.rotation)
def wakeup(self):
"""Wake up the VPet from sleep"""
if not self.is_sleeping: return
Animations.wakeup(rotation=self.rotation)
self.reset_activity_to_idle()
def blink_eyes(self):
"""Make the VPet blink"""
pass
def detect_orientation(self):
"""Detect the desired rotation based on the postion on the screen, like left border, bottom, etc"""
pass
def talk(self, message: str):
"""Make the VPet talk to the user via a speech bubble"""
pass
def think(self):
"""Make the VPet think"""
pass
def dream(self):
"""Make the VPet dream"""
pass