A friend of mine and me are just starting to learn to program with pygame on repl.it and for our first "real" project we want to make an old school like point'n'click adventure.
However, we have a problem with the movement of the character, if we click somewhere on the screen the character just "teleports" there but we want it to look as smooth as possible.
So basically, we want to get rid of the "teleporting" of the character and instead have a smooth frame-by-frame transition from the characters current position to the mouse position.
We've already tried to slow down the while loops so that we could project the character each time the while loop is executed but that just crashes the whole site, we also tried to do it outside of repl.it in case it was a problem with the website but it didn't work there either.
#PMC = Character
#mpos = the mouse position
#mstate= the state of the mouse buttons (0 if nothing is pressed, 1 if a mouse
#button is pressed)
#charspeed = the speed at which the character moves (=1px)
```
#---PMC movement when mouse click-----------------------
#---x,y = mpos x2,y2 = characterpos
if mstate == (1,0,0):
#print('x: ', x, ' y: ', y, ' x2: ', x2, ' y2: ', y2) #debugging_positions
while x2 != x:
if x2>x:
x2-=charspeed
screen.blit(pmc, (x2-46, y2-184))
if x2<x:
x2+=charspeed
screen.blit(pmc, (x2-46, y2-184))
while y2 != y:
if y2>y:
y2 -= charspeed
screen.blit(pmc, (x2-46, y2-184))
if y2<y:
y2 += charspeed
screen.blit(pmc, (x2-46, y2-184))