-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteractive_object.py
40 lines (31 loc) · 1006 Bytes
/
interactive_object.py
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
33
34
35
36
37
38
39
40
from abc import ABC, abstractmethod
from pygame import Surface
class InteractiveObject( ABC ):
def __init__( self, window: Surface ) -> None:
self.window = window
super().__init__()
''' Draw the surface into the window passed through the constructor '''
@abstractmethod
def draw( self ) -> None:
pass
''' Return True if the coord in parameter collision with this object '''
@abstractmethod
def check_collision( self, coord: tuple[int] ) -> bool:
pass
class MultipleInteractiveObject(InteractiveObject):
def __init__(self, window: Surface) -> None:
super().__init__(window)
'''
Some InteractiveObjects has the function that set a config for the game,
this method set that conf
'''
@abstractmethod
def set_conf( self ) -> None:
pass
'''
Click on a multiple option, has to do internal operations to know what option
the user wants
'''
@abstractmethod
def click_action( self, coord: tuple[int] ) -> None:
pass