Skip to content

Commit

Permalink
feat(main): ✨ Removed over 70% of the demos that were broken or depra…
Browse files Browse the repository at this point in the history
…cated and fixed a small bug with the collisions stuff
  • Loading branch information
Tsunami014 (Max) authored and Tsunami014 (Max) committed Oct 11, 2024
1 parent e56195e commit 02f90b0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 476 deletions.
2 changes: 1 addition & 1 deletion BlazeSudio/collisions/lib/collisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def handleCollisionsVel(self,
"""
o = self.handleCollisionsPos(self, (self.x+vel[0], self.y+vel[1]), objs, vel, False, precision, verbose)
if replaceSelf:
self.x, self.y = o[0], o[1]
self.x, self.y = o[0]
if verbose:
return o[0], o[1], o[2]
return o[0], o[1]
Expand Down
1 change: 0 additions & 1 deletion BlazeSudio/ldtk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from BlazeSudio.ldtk.application import *
from BlazeSudio.ldtk.Pyldtk import *
from BlazeSudio.ldtk.sync import *
41 changes: 0 additions & 41 deletions BlazeSudio/ldtk/application.py

This file was deleted.

24 changes: 12 additions & 12 deletions demoFiles/collisionsDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
2: (collisions.Shape)
}
typ = 0
curObj = collisions.Point(0, 0)
curObj: collisions.Shape = collisions.Point(0, 0)
objs = collisions.Shapes()
dir = [0, 0, 0]
combineTyp = 0
pos = [0, 0]
accel = [0, 0]
vel = [0, 0]
maxcombinetyps = 3
combineCache = [None, None]

Expand Down Expand Up @@ -266,13 +266,13 @@ def offsetColour(obj, col):
dir[2] += 5

if btns[pygame.K_w]:
accel[1] -= 1
vel[1] -= 1
if btns[pygame.K_s]:
accel[1] += 1
vel[1] += 1
if btns[pygame.K_a]:
accel[0] -= 1
vel[0] -= 1
if btns[pygame.K_d]:
accel[0] += 1
vel[0] += 1

if btns[pygame.K_LEFTBRACKET]:
curObj.bounciness = max(0.1, curObj.bounciness-0.05)
Expand Down Expand Up @@ -306,22 +306,22 @@ def offsetColour(obj, col):
gravity = [0, 0.2]
else:
gravity = [0, 0]
accel = [accel[0] + gravity[0], accel[1] + gravity[1]]
accellLimits = [10, 10]
accel = [min(max(accel[0], -accellLimits[0]), accellLimits[0]), min(max(accel[1], -accellLimits[1]), accellLimits[1])]
vel = [vel[0] + gravity[0], vel[1] + gravity[1]]
vellLimits = [10, 10]
vel = [min(max(vel[0], -vellLimits[0]), vellLimits[0]), min(max(vel[1], -vellLimits[1]), vellLimits[1])]
friction = [0.02, 0.02]
def fric_eff(x, fric):
if x < -fric:
return x + fric
if x > fric:
return x - fric
return 0
accel = [fric_eff(accel[0], friction[0]), fric_eff(accel[1], friction[1])]
_, accel = curObj.handleCollisionsVel(accel, objs)
vel = [fric_eff(vel[0], friction[0]), fric_eff(vel[1], friction[1])]
_, vel = curObj.handleCollisionsVel(vel, objs)

else:
pos = pygame.mouse.get_pos()
accel = [0, 0]
vel = [0, 0]
curObj = moveCurObj(curObj)

for i in objs:
Expand Down
Loading

0 comments on commit 02f90b0

Please sign in to comment.