I am pretty new to Pymunk so I am having some trouble with kinematic bodies. In this program, I set the velocity of the shape, but it still doesn't move.
Full code below:
import pygame
import pymunk
import time
pygame.init()
Screen = pygame.display.set_mode((800,800))
BG_Color = (255,255,210)
Space = pymunk.Space()
class Player:
def __init__(self):
self.x = 400
self.y = 60
self.body = pymunk.Body(1,1666, pymunk.Body.KINEMATIC)
self.shape = pymunk.Segment(self.body, (self.x,self.y), (self.x+32, self.y), 20)
self.shape.position= self.x,self.y
self.shape.body.velocity = (10, 10)
def move(self):
self.pos = self.shape.body.position
self.x = self.pos[0]
self.y = self.pos[1]
print(self.x)
Player = Player()
Cont = True
while Cont:
#Screen.fill(BG_Color)
for event in pygame.event.get():
if event.type == pygame.QUIT:
Cont = False
Player.move()
Space.step(120)
pygame.display.update()
time.sleep(1/120)
Do you have any idea how this could be happening?
I Just want to move this object diagonally by the way.