crystalwindow 3.6.post5__py3-none-any.whl → 3.6.6__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.
crystalwindow/sprites.py CHANGED
@@ -1,3 +1,4 @@
1
+ import random
1
2
  from tkinter import PhotoImage
2
3
 
3
4
  class Sprite:
@@ -21,16 +22,19 @@ class Sprite:
21
22
  else:
22
23
  raise ValueError("Sprite needs either 'size' or 'image'")
23
24
 
25
+ # optional velocity fields for physics
26
+ self.vel_x = 0
27
+ self.vel_y = 0
28
+
24
29
  # === CLASS METHODS ===
25
30
  @classmethod
26
31
  def image(cls, img, pos):
32
+ # fallback if img is missing
27
33
  if isinstance(img, dict) and img.get("fallback"):
28
34
  print("⚠️ Missing image, making RANDOM rect fallback.")
29
35
  w, h = img["size"]
30
36
  color = img["color"]
31
37
  return cls.rect(pos, w, h, color=color)
32
-
33
- # normal image
34
38
  return cls(pos, image=img)
35
39
 
36
40
  @classmethod
@@ -52,11 +56,17 @@ class Sprite:
52
56
  win.draw_rect(self.color, (draw_x, draw_y, self.width, self.height))
53
57
 
54
58
  def move(self, dx, dy):
55
- """Move sprite by dx/dy"""
59
+ """Move sprite manually by dx/dy"""
56
60
  self.x += dx
57
61
  self.y += dy
58
62
  self.pos = (self.x, self.y)
59
63
 
64
+ def apply_velocity(self, dt=1):
65
+ """Apply vel_x/vel_y to x/y for physics"""
66
+ self.x += self.vel_x * dt
67
+ self.y += self.vel_y * dt
68
+ self.pos = (self.x, self.y)
69
+
60
70
  # === COLLISION ===
61
71
  def colliderect(self, other):
62
72
  """Check if self collides with another sprite"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 3.6.post5
3
+ Version: 3.6.6
4
4
  Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
5
5
  Home-page: https://pypi.org/project/crystalwindow/
6
6
  Author: CrystalBallyHereXD
@@ -16,7 +16,7 @@ crystalwindow/gui.py,sha256=D-El18XUaZQR-XZoOr28hnhO7EEoGuypCHxPbPR_yng,3680
16
16
  crystalwindow/gui_ext.py,sha256=ZhNgc5eK6Vzj-jUNeFzimuEbLnTmM7Bx594Z34_N0oM,2856
17
17
  crystalwindow/math.py,sha256=slOY3KQZ99VDMUMxsSJabMyRtJcwVzEyxR2RoXspHho,963
18
18
  crystalwindow/player.py,sha256=4wpIdUZLTlRXV8fDRQ11yVJRbx_cv8Ekpn2y7pQGgAQ,3442
19
- crystalwindow/sprites.py,sha256=Xy8AWkd3guxs4IktqqP5vLNddjG5LfIK1X16jhN-kr0,2237
19
+ crystalwindow/sprites.py,sha256=YVoLnpLsCHlHmTahk8hwWnUtkcI-FC_w4OjZN4YtmLs,2569
20
20
  crystalwindow/tilemap.py,sha256=PHoKL1eWuNeHIf0w-Jh5MGdQGEgklVsxqqJOS-GNMKI,322
21
21
  crystalwindow/ver_warner.py,sha256=qEN3ulc1NixBy15FFx2R3Zu0DhyJTVJwiESGAPwpynM,3373
22
22
  crystalwindow/window.py,sha256=JmWjR0aOm4Q8OoboqDHzGKqUmxlAJbj37KBBY0QPjrs,17779
@@ -31,8 +31,8 @@ crystalwindow/gametests/guitesting.py,sha256=SrOssY5peCQEV6TQ1AiOWtjb9phVGdRzW-Q
31
31
  crystalwindow/gametests/sandbox.py,sha256=Oo2tU2N0y3BPVa6T5vs_h9N6islhQrjSrr_78XLut5I,1007
32
32
  crystalwindow/gametests/squaremove.py,sha256=poP2Zjl2oc2HVvIAgIK34H2jVj6otL4jEdvAOR6L9sI,572
33
33
  crystalwindow/gametests/windowtesting.py,sha256=_9X6wnV1-_X_PtNS-0zu-k209NtFIwAc4vpxLPp7V2o,97
34
- crystalwindow-3.6.post5.dist-info/licenses/LICENSE,sha256=7pvUgvRXL3ED5VVAZPH5oGn1CaIXcyoDC9gqox6sB0g,1079
35
- crystalwindow-3.6.post5.dist-info/METADATA,sha256=eK2r2JEWg_HSzzjRvE4L3KvucBux0FCQVlFXztwcLHo,7344
36
- crystalwindow-3.6.post5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- crystalwindow-3.6.post5.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
38
- crystalwindow-3.6.post5.dist-info/RECORD,,
34
+ crystalwindow-3.6.6.dist-info/licenses/LICENSE,sha256=7pvUgvRXL3ED5VVAZPH5oGn1CaIXcyoDC9gqox6sB0g,1079
35
+ crystalwindow-3.6.6.dist-info/METADATA,sha256=okNZBTtaxrXf1LzZmjfzY7kiXRmwF4ydG8c_MBUbAZs,7340
36
+ crystalwindow-3.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ crystalwindow-3.6.6.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
38
+ crystalwindow-3.6.6.dist-info/RECORD,,