I am currently working on a small project, which is a platform type game. I had designed the platform sets, in which the player has the ability to jump on the platform and stay on it and can jump of it. However when the player decides to jump off from one platform to another, the program forces the player to jump onto the 'ground' before the platform. Here is the code for collision between Player and Platform:
def collision(self):
if knight1.hitbox[1] < self.hit[1] + self.hit[3] and knight1.hitbox[1] + knight1.hitbox[3] >
self.hit[1]:
if knight1.hitbox[0] + knight1.hitbox[2] > self.hit[0] and knight1.hitbox[0] < self.hit[0] +
self.hit[2]:
knight1.jump = True
knight1.jumpcount = 0
knight1.jumpheight = 8
knight1.y = self.y - 85
self.inAir = True
if knight1.x + 30 > (self.x + self.width) and self.inAir == True:
knight1.y = 410
self.inAir = False
knight1.jump = True
Any help would be much appreciated.