title screen

sprite, player root animation calm down
This commit is contained in:
Neal Finger
2023-02-05 15:59:55 -07:00
parent b743e61b10
commit 5acb279226
5 changed files with 35 additions and 54 deletions

View File

@@ -103,8 +103,8 @@ class Camera:
class PlayerAnimation:
# width and height of range bounding box
RANDOM_RANGE = int(7)
# width and height of range bounding box must be odd
RANDOM_RANGE = int(5)
POS_RANGE = int(3)
POS_X = int(0)
POS_Y = int(1)
@@ -115,26 +115,6 @@ class PlayerAnimation:
self.debugposrange = self.POS_RANGE
def update_phys(self, plworldx, plworldy, camera):
#print(plworldx, plworldy, plscreeny, current_depth)
### exit if player y pos less than random range
# # debug change random range
# inp = int(0)
# if thumby.buttonD.justPressed():
# inp -= 1
# if thumby.buttonU.justPressed():
# inp += 1
# if inp != 0:
# self.debugposrange = max(self.debugposrange + inp * 2, 1)
# print('debugposrange: ', self.debugposrange)
# # if plworldy < self.poslist[-1][self.POS_Y] + random.randint(1, self.debugposrange):
# # return
# if plworldy < self.poslist[-1][self.POS_Y] + self.debugposrange:
# return
if plworldy < self.poslist[-1][self.POS_Y] + self.POS_RANGE:
return
@@ -142,23 +122,6 @@ class PlayerAnimation:
### get new position
rad = self.RANDOM_RANGE // 2
# # debug change random range
# inp = int(0)
# if thumby.buttonB.justPressed():
# inp -= 1
# if thumby.buttonA.justPressed():
# inp += 1
# if inp != 0:
# self.debugrandomrange = max(self.debugrandomrange + inp * 2, 1)
# print('debugrandomrange:', self.debugrandomrange)
# rad = max(self.debugrandomrange // 2, 1)
# vector int
# self.poslist.append((plworldx + random.randrange(-rad, rad),
# plworldy + random.randrange(-rad, rad)))
# move last pos
self.poslist[-1] = (
plworldx + random.randrange(-rad, rad),
@@ -168,20 +131,13 @@ class PlayerAnimation:
# new pos is perfectly on player
self.poslist.append((plworldx, plworldy))
# # debug
# self.poslist.append((plworldx, plworldy))
### remove the fist item in the list if its full line is off screen
if not camera.entity_in_camera(self.poslist[1][self.POS_X], self.poslist[1][self.POS_Y]):
self.poslist.pop(0)
#print(len(self.poslist))
def update_draw(self, camera, isdecend=1):
### draw line from first position to next
#print(topleft)
for i in range(len(self.poslist) - 1):
x1, y1 = camera.relative_to_camera(self.poslist[i][self.POS_X], self.poslist[i][self.POS_Y])
x2, y2 = camera.relative_to_camera(self.poslist[i + 1][self.POS_X], self.poslist[i + 1][self.POS_Y])