#๐Ÿ”’ i don't uderstand this pygame problem

42 messages ยท Page 1 of 1 (latest)

charred forge
#

i always have the fighters go to the left faster than right and i don't understand why the code is in : https://paste.pythondiscord.com/QKLA
answer asap please because i'm now coding in my break i don't have a lot of time.

opaque pecanBOT
#

@charred forge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

charred forge
#

anyone for help?

flint knot
#

Yeah wait lemme see it

charred forge
#

ok

#

just try to implement any pictures if you want

#

i just started so the program is not that good

flint knot
#

UR good bro its clean

lethal canopy
#

it does look clean, yes

charred forge
#

but the fighters are going a litlle fast to the left

lethal canopy
#

I noticed you have no clock

charred forge
#

should i send a video?

flint knot
#

use this code

#

clock = pygame.time.Clock()

#

clock.tick(FPS)

charred forge
#

wait i don't understand this i did never used a clock

lethal canopy
#

it limits your framerate

charred forge
#

(i changed something in the code but only to not go a lot down in the ground)

lethal canopy
#

and it also returns a "delta" in milliseconds since the last frame, ande helps you actually run everything frame rate independent

charred forge
#

where should i put it and what does it exactly do

#

ah ok

#

very interesting

flint knot
#

i think u should use it before the screen updates

charred forge
#

ok

lethal canopy
#

and you might need to increase your player speed after wards.

charred forge
#

should i import clock?

flint knot
#

no

charred forge
#

i think the speed is good or it's gonna be so cursed

lethal canopy
#

I usually do something like:

delta = clock.tick(60) / 1000
``` at the top of the while loop, and then multiply delta with all player_speed occurences.
flint knot
lethal canopy
#

no, that's wrong

flint knot
#

it works

lethal canopy
#

it should be early, so you actually can use the result

#

you recreate the clock every frame, that's silly ๐Ÿ™‚

#

(might be a singleton, I guess, so maybe it works)

flint knot
#

yeah yeah my bad๐Ÿ˜…

#

im new to pygame

lethal canopy
#

@charred forge
after all that, another thing I noticed: the diagonal movements appear faster than horizontal/vertical movement ๐Ÿ˜‰
But we can talk about that later, if you can't figure that out yourself. don't hesitate to ping me.

flint knot
lethal canopy
#

create a help channel if you have a specific problems

opaque pecanBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.