batframework 1.0.8a1__py3-none-any.whl → 1.0.8a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. batFramework/__init__.py +50 -53
  2. batFramework/action.py +105 -116
  3. batFramework/actionContainer.py +11 -53
  4. batFramework/animatedSprite.py +65 -115
  5. batFramework/audioManager.py +26 -70
  6. batFramework/camera.py +68 -253
  7. batFramework/constants.py +54 -16
  8. batFramework/cutscene.py +25 -34
  9. batFramework/cutsceneBlocks.py +42 -37
  10. batFramework/debugger.py +48 -0
  11. batFramework/dynamicEntity.py +7 -9
  12. batFramework/easing.py +71 -0
  13. batFramework/entity.py +98 -42
  14. batFramework/gui/__init__.py +2 -8
  15. batFramework/gui/button.py +79 -7
  16. batFramework/gui/constraints.py +204 -0
  17. batFramework/gui/container.py +31 -155
  18. batFramework/gui/debugger.py +43 -124
  19. batFramework/gui/frame.py +19 -0
  20. batFramework/gui/image.py +17 -41
  21. batFramework/gui/indicator.py +21 -41
  22. batFramework/gui/interactiveWidget.py +13 -116
  23. batFramework/gui/label.py +73 -278
  24. batFramework/gui/layout.py +61 -148
  25. batFramework/gui/root.py +37 -102
  26. batFramework/gui/shape.py +57 -258
  27. batFramework/gui/toggle.py +46 -97
  28. batFramework/gui/widget.py +254 -268
  29. batFramework/manager.py +19 -40
  30. batFramework/particles.py +77 -0
  31. batFramework/scene.py +107 -214
  32. batFramework/sceneManager.py +107 -150
  33. batFramework/stateMachine.py +0 -1
  34. batFramework/time.py +57 -117
  35. batFramework/transition.py +126 -184
  36. batFramework/transitionManager.py +0 -0
  37. batFramework/utils.py +161 -34
  38. batframework-1.0.8a2.dist-info/METADATA +58 -0
  39. batframework-1.0.8a2.dist-info/RECORD +42 -0
  40. {batframework-1.0.8a1.dist-info → batframework-1.0.8a2.dist-info}/WHEEL +1 -1
  41. batFramework/easingController.py +0 -58
  42. batFramework/enums.py +0 -104
  43. batFramework/fontManager.py +0 -65
  44. batFramework/gui/clickableWidget.py +0 -206
  45. batFramework/gui/constraints/__init__.py +0 -1
  46. batFramework/gui/constraints/constraints.py +0 -378
  47. batFramework/gui/dialogueBox.py +0 -96
  48. batFramework/gui/draggableWidget.py +0 -38
  49. batFramework/gui/meter.py +0 -76
  50. batFramework/gui/radioButton.py +0 -62
  51. batFramework/gui/slider.py +0 -220
  52. batFramework/gui/textInput.py +0 -134
  53. batFramework/object.py +0 -115
  54. batFramework/particle.py +0 -101
  55. batFramework/renderGroup.py +0 -62
  56. batFramework/resourceManager.py +0 -84
  57. batFramework/scrollingSprite.py +0 -113
  58. batFramework/sprite.py +0 -45
  59. batFramework/tileset.py +0 -46
  60. batframework-1.0.8a1.dist-info/LICENCE +0 -21
  61. batframework-1.0.8a1.dist-info/METADATA +0 -55
  62. batframework-1.0.8a1.dist-info/RECORD +0 -56
  63. {batframework-1.0.8a1.dist-info → batframework-1.0.8a2.dist-info}/top_level.txt +0 -0
batFramework/camera.py CHANGED
@@ -1,308 +1,123 @@
1
+ import batFramework as bf
1
2
  import pygame
2
3
  from pygame.math import Vector2
3
- import batFramework as bf
4
- from typing import Self
5
4
 
6
5
 
7
6
  class Camera:
8
- def __init__(
9
- self, flags=0, size: tuple[int, int] | None = None, convert_alpha: bool = False
10
- ) -> None:
11
- """
12
- Initialize the Camera object.
13
-
14
- Args:
15
- flags (int): Flags for camera initialization.
16
- size (tuple): Optional size for camera (defaults to window size)
17
- convert_alpha (bool): Convert surface to support alpha values
18
- """
19
- self.cached_surfaces: dict[tuple[int, int], pygame.Surface] = {}
20
-
21
- self.target_size = size if size else bf.const.RESOLUTION
22
- self.should_convert_alpha: bool = convert_alpha
23
- self.rect = pygame.FRect(0, 0, *self.target_size)
24
- self.vector_center = Vector2(0, 0)
25
-
26
- self.surface: pygame.Surface = pygame.Surface((0, 0)) # tmp dummy
27
- self.flags: int = flags | (pygame.SRCALPHA if convert_alpha else 0)
7
+ def __init__(self, flags=0) -> None:
8
+ self.rect = pygame.FRect(0, 0, *bf.const.RESOLUTION)
9
+ self.flags: int = flags
10
+ # self.blit_special_flags : int =pygame.BLEND_PREMULTIPLIED if (flags & pygame.SRCALPHA) else 0
28
11
  self.blit_special_flags: int = pygame.BLEND_ALPHA_SDL2
29
-
30
- self._clear_color: pygame.Color = pygame.Color(0, 0, 0, 0)
31
- if not convert_alpha:
32
- self._clear_color = pygame.Color(0, 0, 0)
33
-
34
- self.follow_point_func = None
35
- self.follow_friction: float = 0.5
36
-
12
+ self._clear_color : pygame.Color = pygame.Color(0, 0, 0, 0)
37
13
  self.zoom_factor = 1
14
+ self.cached_surfaces: dict[float, pygame.Surface] = {}
15
+ self.surface: pygame.Surface = pygame.Surface((0,0))
16
+ self.follow_point_func = None
38
17
  self.max_zoom = 2
39
18
  self.min_zoom = 0.1
40
19
  self.zoom(1)
41
20
 
42
- def set_clear_color(self, color: pygame.Color | tuple | str) -> Self:
43
- """
44
- Set the clear color for the camera surface.
45
-
46
- Args:
47
- color (pygame.Color | tuple): Color to set as the clear color.
48
-
49
- Returns:
50
- Camera: Returns the Camera object.
51
- """
21
+ def set_clear_color(self, color: pygame.Color|tuple):
22
+ if not isinstance(color,pygame.Color):
23
+ color = pygame.Color(color)
52
24
  self._clear_color = color
53
- return self
54
25
 
55
- def set_max_zoom(self, value: float) -> Self:
56
- """
57
- Set the maximum zoom value for the camera.
58
-
59
- Args:
60
- value (float): Maximum zoom value.
61
-
62
- Returns:
63
- Camera: Returns the Camera object.
64
- """
26
+ def set_max_zoom(self,value:float):
65
27
  self.max_zoom = value
66
- return self
67
-
68
- def set_min_zoom(self, value: float) -> Self:
69
- """
70
- Set the minimum zoom value for the camera.
71
-
72
- Args:
73
- value (float): Minimum zoom value.
74
28
 
75
- Returns:
76
- Camera: Returns the Camera object.
77
- """
29
+ def set_min_zoom(self,value:float):
78
30
  self.min_zoom = value
79
- return self
80
31
 
81
- def clear(self) -> None:
32
+ def clear(self):
82
33
  """
83
- Clear the camera surface with the set clear color.
34
+ Clear the camera surface with the set clear color
35
+ (default is tranparent)
84
36
  """
85
37
  self.surface.fill(self._clear_color)
86
38
 
87
- def get_center(self) -> tuple[float, float]:
88
- """
89
- Get the center of the camera's view.
90
-
91
- Returns:
92
- tuple[float,float]: Returns the center coordinates.
93
- """
39
+ def get_center(self):
94
40
  return self.rect.center
95
41
 
96
- def get_position(self) -> tuple[float, float]:
97
- """
98
- Get the center of the camera's view.
42
+
99
43
 
100
- Returns:
101
- tuple[float,float]: Returns the center coordinates.
44
+ def move(self, x, y):
102
45
  """
103
- return self.rect.topleft
104
-
105
- def move_by(self, x: float | int, y: float | int) -> Self:
46
+ Moves the camera rect by the given coordinates (+=)
106
47
  """
107
- Moves the camera rect by the given coordinates.
108
-
109
- Args:
110
- x: X-coordinate to move.
111
- y: Y-coordinate to move.
48
+ self.rect.topleft += Vector2(x, y)
112
49
 
113
- Returns:
114
- Camera: Returns the Camera object.
50
+ def set_position(self, x, y):
115
51
  """
116
- self.rect.move_ip(x, y)
117
- return self
118
-
119
- def set_position(self, x, y) -> Self:
120
- """
121
- Set the camera rect top-left position.
122
-
123
- Args:
124
- x: X-coordinate to set.
125
- y: Y-coordinate to set.
126
-
127
- Returns:
128
- Camera: Returns the Camera object.
52
+ Set the camera rect topleft position
129
53
  """
130
54
  self.rect.topleft = (x, y)
131
55
 
132
- return self
133
-
134
- def set_center(self, x, y) -> Self:
56
+ def set_center(self, x, y):
135
57
  """
136
- Set the camera rect center position.
137
-
138
- Args:
139
- x: X-coordinate for the center.
140
- y: Y-coordinate for the center.
141
-
142
- Returns:
143
- Camera: Returns the Camera object.
58
+ Set the camera rect center position
144
59
  """
145
60
  self.rect.center = (x, y)
146
- return self
147
61
 
148
- def set_follow_point(self, func, follow_speed: float = 0.1) -> Self:
62
+ def set_follow_dynamic_point(self, func):
149
63
  """
150
- Set the following function (returns tuple x y).
151
- Camera will center its position to the center of the given coordinates.
152
-
153
- Args:
154
- func: Function returning coordinates to follow.
155
-
156
- Returns:
157
- Camera: Returns the Camera object.
64
+ Set the following function (returns tuple x y)
65
+ (camera will center its position to the center of the given coordinates)
158
66
  """
159
67
  self.follow_point_func = func
160
- self.follow_speed = follow_speed if func else 0.1
161
- return self
162
-
163
- def set_follow_friction(self,friction:float)->Self:
164
- self.follow_friction = friction
165
- return self
166
-
167
- def zoom_by(self, amount: float) -> Self:
168
- """
169
- Zooms the camera by the given amount.
170
68
 
171
- Args:
172
- amount (float): Amount to zoom.
69
+ def zoom_by(self, amount:float):
70
+ self.zoom(self.zoom_factor + amount)
173
71
 
174
- Returns:
175
- Camera: Returns the Camera object.
176
- """
177
- self.zoom(max(self.min_zoom, min(self.max_zoom, self.zoom_factor + amount)))
178
- return self
179
-
180
- def zoom(self, factor: float) -> Self:
181
- """
182
- Zooms the camera to the given factor.
183
-
184
- Args:
185
- factor: Factor to set for zooming.
186
-
187
- Returns:
188
- Camera: Returns the Camera object.
189
- """
190
- if factor < self.min_zoom or factor > self.max_zoom:
191
- print(
192
- f"Zoom value {factor} is outside the zoom range : [{self.min_zoom},{self.max_zoom}]"
193
- )
194
- return self
195
-
196
- factor = round(factor, 2)
72
+ def zoom(self, factor):
73
+ if factor <self.min_zoom:
74
+ return
75
+ if factor > self.max_zoom:
76
+ return
77
+ factor = round(factor,2)
197
78
  self.zoom_factor = factor
198
- new_res = tuple(round((i / factor) / 2) * 2 for i in self.target_size)
199
- self.surface = self._get_cached_surface(new_res)
79
+ if factor not in self.cached_surfaces:
80
+ # if factor != 1 : print("creating new surface in cache : ",tuple(i * factor for i in const.RESOLUTION), self.flags)
81
+ self.cached_surfaces[factor] = pygame.Surface(
82
+ tuple(i / factor for i in bf.const.RESOLUTION), flags=self.flags
83
+ ).convert_alpha()
84
+ # c = self.surface.get_colorkey() if self.surface else None
85
+ # if c : self.cached_surfaces[factor].set_colorkey(c)
86
+ self.cached_surfaces[factor].fill((0, 0, 0, 0))
87
+
88
+ self.surface = self.cached_surfaces[self.zoom_factor]
200
89
  self.rect = self.surface.get_frect(center=self.rect.center)
201
- self.clear()
202
- return self
203
-
204
- def _free_cache(self):
205
- self.cached_surfaces = {}
206
-
207
- def _get_cached_surface(self, new_size: tuple[int, int]):
208
- surface = self.cached_surfaces.get(new_size, None)
209
- if surface is None:
210
- surface = pygame.Surface(new_size, flags=self.flags)
211
- if self.flags & pygame.SRCALPHA:
212
- surface = surface.convert_alpha()
213
- self.cached_surfaces[new_size] = surface
214
-
215
- return surface
216
-
217
- def resize(self, size: tuple[int, int] | None = None) -> Self:
218
- if size is None:
219
- size = bf.const.RESOLUTION
220
- self.target_size = size
221
- self.rect.center = (size[0] / 2, size[1] / 2)
222
- self.zoom(self.zoom_factor)
223
-
224
- return self
90
+ # if factor != 1 : print(self.cached_surfaces)
225
91
 
226
92
  def intersects(self, rect: pygame.Rect | pygame.FRect) -> bool:
227
- """
228
- Check if the camera view intersects with the given rectangle.
229
-
230
- Args:
231
- rect (pygame.Rect | pygame.FRect): Rectangle to check intersection with.
232
-
233
- Returns:
234
- bool: True if intersection occurs, False otherwise.
235
- """
236
- return self.rect.colliderect(rect)
237
-
238
- def world_to_screen(
239
- self, rect: pygame.Rect | pygame.FRect
240
- ) -> pygame.Rect | pygame.FRect:
241
- """
242
- world_to_screen the given rectangle coordinates relative to the camera.
243
-
244
- Args:
245
- rect (pygame.Rect | pygame.FRect): Rectangle to world_to_screen.
246
-
247
- Returns:
248
- pygame.FRect: Transposed rectangle.
249
- """
250
- return pygame.FRect(rect[0] - self.rect.left, rect[1] - self.rect.top, rect[2],rect[3])
251
-
252
- def world_to_screen_point(
253
- self, point: tuple[float, float] | tuple[int, int]
254
- ) -> tuple[float, float]:
255
- """
256
- world_to_screen the given 2D point coordinates relative to the camera.
257
-
258
- Args:
259
- point (tuple[float,float] | tuple[int,int]): Point to world_to_screen.
93
+ return (
94
+ self.rect.x < rect.right
95
+ and self.rect.right > rect.x
96
+ and self.rect.y < rect.bottom
97
+ and self.rect.bottom > rect.y
98
+ )
260
99
 
261
- Returns:
262
- tuple[float,float] : Transposed point.
263
- """
264
- return point[0] - self.rect.x, point[1] - self.rect.y
265
100
 
266
- def screen_to_world(
267
- self, point: tuple[float, float] | tuple[int, int]
268
- ) -> tuple[float, float]:
269
- """
270
- Convert screen coordinates to world coordinates based on camera settings.
101
+ def transpose(self, rect: pygame.Rect | pygame.FRect) -> pygame.Rect | pygame.FRect:
102
+ x, y = round(rect.x - self.rect.left), round(rect.y - self.rect.top)
103
+ return pygame.Rect(x, y, *rect.size)
271
104
 
272
- Args:
273
- point (tuple[float,float] | tuple[int,int]): Point to screen_to_world.
274
- Returns:
275
- tuple: Converted world coordinates.
276
- """
277
- return (
278
- point[0] / self.zoom_factor + self.rect.x,
279
- point[1] / self.zoom_factor + self.rect.y,
280
- )
105
+ def convert_screen_to_world(self, x, y):
106
+ return x / self.zoom_factor + self.rect.x, y / self.zoom_factor + self.rect.y
281
107
 
282
108
  def update(self, dt):
283
- """
284
- Update the camera position based on the follow point function.
285
-
286
- Args:
287
- dt: Time delta for updating the camera position.
288
- """
289
109
  if self.follow_point_func:
290
- self.vector_center.update(*self.rect.center)
291
- amount = pygame.math.clamp(self.follow_friction,0,1)
292
- self.set_center(*self.vector_center.lerp(self.follow_point_func(), amount))
110
+ target = self.follow_point_func()
111
+ self.rect.center = Vector2(self.rect.center).lerp(target, ((dt * 60) * 0.1))
293
112
 
294
113
  def draw(self, surface: pygame.Surface):
295
- """
296
- Draw the camera view onto the provided surface with proper scaling.
297
-
298
- Args:
299
- surface (pygame.Surface): Surface to draw the camera view onto.
300
- """
114
+ # pygame.draw.circle(surface,bf.color.ORANGE,self.surface.get_rect().center,4)
301
115
  if self.zoom_factor == 1:
302
116
  surface.blit(self.surface, (0, 0), special_flags=self.blit_special_flags)
303
- # surface.blit(self.surface, (0, 0))
304
117
  return
305
-
306
- # Scale the surface to match the resolution
307
- scaled_surface = pygame.transform.scale(self.surface, self.target_size)
308
- surface.blit(scaled_surface, (0, 0), special_flags=self.blit_special_flags)
118
+ # print("From",self.surface,"Target RESOLUTION",const.RESOLUTION,"Destination",surface)
119
+ surface.blit(
120
+ pygame.transform.scale(self.surface, bf.const.RESOLUTION),
121
+ (0, 0),
122
+ special_flags=self.blit_special_flags,
123
+ )
batFramework/constants.py CHANGED
@@ -1,37 +1,75 @@
1
1
  import pygame
2
+ from enum import Enum
2
3
 
3
4
 
4
5
  class Constants:
5
- SCREEN: pygame.Surface = None
6
- RESOLUTION: tuple[int, int] = (1280, 720)
6
+ SCREEN = None
7
+ RESOLUTION: tuple[int, int] = (1280,720)
7
8
  VSYNC = 0
8
9
  FLAGS: int = pygame.SCALED | pygame.RESIZABLE
9
10
  FPS: int = 60
11
+ RESOURCE_PATH = "."
12
+
13
+ @staticmethod
14
+ def init_screen(resolution:tuple[int,int],flags:int= 0, vsync:int= 0):
15
+ Constants.RESOLUTION = resolution
16
+ Constants.FLAGS = flags
17
+ Constants.VSYNC = vsync
18
+ Constants.SCREEN = pygame.display.set_mode(Constants.RESOLUTION, Constants.FLAGS,vsync=Constants.VSYNC)
19
+ print(f"Window : {resolution[0]}x{resolution[1]}px | flags:{flags.bit_count()}, vsync:{pygame.display.is_vsync()}")
10
20
  MUSIC_END_EVENT = pygame.event.custom_type()
11
21
 
12
- DEFAULT_CURSOR = pygame.cursors.Cursor(pygame.SYSTEM_CURSOR_ARROW)
13
- DEFAULT_HOVER_CURSOR = pygame.cursors.Cursor(pygame.SYSTEM_CURSOR_ARROW)
14
- DEFAULT_CLICK_CURSOR = pygame.cursors.Cursor(pygame.SYSTEM_CURSOR_ARROW)
22
+ # ------------GUI SPECIFIC
23
+ DEFAULT_TEXT_SIZE: int = 8
15
24
 
16
- BF_INITIALIZED: bool = False
25
+ GUI_SCALE: int = 1
26
+ # ---------------------
17
27
 
18
28
  @staticmethod
19
- def set_resolution(resolution: tuple[int, int]):
29
+ def set_resolution(resolution : tuple[int,int]):
20
30
  Constants.RESOLUTION = resolution
21
31
 
22
32
  @staticmethod
23
- def set_default_cursor(cursor: pygame.Cursor):
24
- Constants.DEFAULT_CURSOR = cursor
33
+ def set_resource_path(path: str):
34
+ print("set resource path :", path)
35
+ Constants.RESOURCE_PATH = path
25
36
 
26
37
  @staticmethod
27
- def set_default_hover_cursor(cursor: pygame.Cursor):
28
- Constants.DEFAULT_HOVER_CURSOR = cursor
38
+ def set_fps_limit(value: int):
39
+ Constants.FPS = value
40
+ print("FPS limit to : ", value)
29
41
 
30
42
  @staticmethod
31
- def set_default_click_cursor(cursor: pygame.Cursor):
32
- Constants.DEFAULT_CLICK_CURSOR = cursor
43
+ def set_gui_scale(value: int):
44
+ Constants.GUI_SCALE = value
45
+ print("GUI_SCALE to : ", value)
33
46
 
34
47
  @staticmethod
35
- def set_fps_limit(value: int):
36
- Constants.FPS = value
37
- print("FPS limit to : ", value)
48
+ def set_default_text_size(size:int):
49
+ Constants.DEFAULT_TEXT_SIZE = size
50
+
51
+ class Colors:
52
+ LIGHT_CYAN = (179, 229, 252)
53
+ WASHED_BLUE = (52, 73, 94)
54
+ RIVER_BLUE = (52, 152, 219)
55
+ DARK_INDIGO = (40, 53, 147)
56
+ LIGHT_BLUE = (3, 169, 244)
57
+ DEEP_BLUE = (41, 121, 255)
58
+ DARK_BLUE = (44, 62, 80)
59
+ GREEN = (67, 160, 71)
60
+ DARK_GREEN = (39, 174, 96)
61
+ BROWN = (109, 76, 65)
62
+ DARK_RED = (192, 57, 43)
63
+ ORANGE = (251, 140, 0)
64
+ CLOUD_WHITE = (236, 240, 241)
65
+ SILVER = (189, 195, 199)
66
+ DARK_GRAY = (66, 66, 66)
67
+
68
+ DARK_GB = (27, 42, 9)
69
+ SHADE_GB = (14, 69, 11)
70
+ BASE_GB = (73, 107, 34)
71
+ LIGHT_GB = (154, 158, 63)
72
+
73
+ class Axis(Enum):
74
+ HORIZONTAL = 1
75
+ VERTICAL = 2
batFramework/cutscene.py CHANGED
@@ -10,13 +10,10 @@ class Cutscene:
10
10
 
11
11
 
12
12
  class CutsceneManager(metaclass=bf.Singleton):
13
- def __init__(self) -> None:
13
+ def __init__(self, manager) -> None:
14
14
  self.current_cutscene: Cutscene = None
15
- self.cutscenes: list[bf.Cutscene] = []
16
- self.manager: bf.Manager = None
17
-
18
- def set_manager(self, manager):
19
- self.manager = manager
15
+ self.cutscenes : list[bf.Cutscene] = []
16
+ self.manager: bf.Manager = manager
20
17
 
21
18
  def get_flag(self, flag):
22
19
  return None
@@ -25,11 +22,11 @@ class CutsceneManager(metaclass=bf.Singleton):
25
22
  if self.current_cutscene:
26
23
  self.current_cutscene.process_event(event)
27
24
 
28
- def queue(self, *cutscenes):
25
+ def queue(self,*cutscenes):
29
26
  self.cutscenes.extend(cutscenes)
30
27
  if self.current_cutscene is None:
31
28
  self.play(self.cutscenes.pop(0))
32
-
29
+
33
30
  def play(self, cutscene: Cutscene):
34
31
  if self.current_cutscene is None:
35
32
  self.current_cutscene = cutscene
@@ -38,33 +35,25 @@ class CutsceneManager(metaclass=bf.Singleton):
38
35
  self.current_cutscene.play()
39
36
  self.manager.set_sharedVar("in_cutscene", True)
40
37
 
41
- def enable_player_control(self) -> None:
42
- self.manager.set_sharedVar("player_has_control", True)
43
-
44
- def disable_player_control(self) -> None:
45
- self.manager.set_sharedVar("player_has_control", False)
46
-
47
38
  def update(self, dt):
48
39
  if not self.current_cutscene is None:
49
40
  self.current_cutscene.update(dt)
50
41
  # print("cutscene manager update")
51
42
  if self.current_cutscene.has_ended():
52
43
  self.current_cutscene.on_exit()
53
- self.current_cutscene = None
44
+ self.current_cutscene =None
54
45
  if self.cutscenes:
55
46
  self.play(self.cutscenes.pop(0))
56
47
  else:
57
48
  self.current_cutscene = None
58
49
  self.manager.set_sharedVar("in_cutscene", False)
59
50
 
60
-
61
51
  class Cutscene:
62
- def __init__(self) -> None:
63
- self.cutscene_blocks = []
52
+ def __init__(self,*blocks) -> None:
53
+ self.cutscene_blocks: list[CutsceneBlock] = list(blocks)
64
54
  self.block_index = 0
65
- self.end_blocks: list[CutsceneBlock] = []
55
+ self.end_blocks : list[CutsceneBlock] = []
66
56
  self.ended = False
67
-
68
57
  def on_enter(self):
69
58
  pass
70
59
 
@@ -74,26 +63,23 @@ class Cutscene:
74
63
  def init_blocks(self):
75
64
  pass
76
65
 
77
- def add_blocks(self, *blocks: CutsceneBlock):
78
- self.cutscene_blocks.extend(blocks)
66
+ def add_end_block(self,block):
67
+ block.set_parent_cutscene(self)
68
+ self.end_blocks.append(block)
79
69
 
80
- def add_end_blocks(self, *blocks: CutsceneBlock):
81
- _ = [block.set_parent_cutscene(self) for block in blocks]
82
- self.end_blocks.extend(blocks)
83
-
84
- def get_scene_at(self, index):
85
- return bf.CutsceneManager().manager.scenes[index]
70
+ def get_scene_at(self,index):
71
+ return bf.CutsceneManager().manager._scenes[index]
86
72
 
87
73
  def get_current_scene(self):
88
74
  return bf.CutsceneManager().manager.get_current_scene()
75
+
76
+ def set_scene(self,name,index=0):
77
+ return bf.CutsceneManager().manager.set_scene(name,index)
89
78
 
90
- def set_scene(self, name, index=0):
91
- return bf.CutsceneManager().manager.set_scene(name, index)
92
-
93
- def get_scene(self, name):
79
+ def get_scene(self,name):
94
80
  return bf.CutsceneManager().manager.get_scene(name)
95
-
96
- def add_block(self, *blocks: CutsceneBlock):
81
+
82
+ def add_block(self, *blocks: list[CutsceneBlock]):
97
83
  for block in blocks:
98
84
  block.set_parent_cutscene(self)
99
85
  self.cutscene_blocks.append(block)
@@ -112,6 +98,7 @@ class Cutscene:
112
98
  def update(self, dt):
113
99
  if self.ended:
114
100
  return
101
+ # print("cutscene update",self.cutscene_blocks[self.block_index])
115
102
  self.cutscene_blocks[self.block_index].update(dt)
116
103
  if self.cutscene_blocks[self.block_index].has_ended():
117
104
  self.block_index += 1
@@ -124,5 +111,9 @@ class Cutscene:
124
111
  self.end_blocks = []
125
112
  self.cutscene_blocks[self.block_index].start()
126
113
 
114
+ # print("NEXT BLOCK")
115
+
127
116
  def has_ended(self):
128
117
  return self.ended
118
+
119
+