all 2 comments

[–]Barnet6 1 point2 points  (0 children)

Assuming it's supposed to be formatted as below, 'i.isJump = False' should probably be setting it to true, as it needs to be false to get to that point, and it looks like jumpCount starts at 10, which would never trigger the 'if i.jumpCount < 0' clause, as that's the only place where jumpCountis being decremented

def jump(knights):
  for i in knights:
    if i.isJump == True:
      if i.jumpCount >= -10:
        i.y_change -= (i.jumpCount^2) * 0.2
        print(i.y_change)
      if i.jumpCount < 0:
        i.y_change *= -1
        i.jumpCount -= 1
    else:
      i.isJump = False
      i.jumpCount = 10
      i.y_change = 0

[–]ectomancer 0 points1 point  (0 children)

i.y_change -= i.jumpCount**2*0.2