#๐Ÿ”’ these particle thingys (the things drop when enemies die) are kinda jittering

30 messages ยท Page 1 of 1 (latest)

polar hornet
lost bearBOT
lost bearBOT
#

@polar hornet

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.

polar hornet
#

these particle thingys (the things drop when enemies die) are kinda jittering

#

hi

ivory plover
#

Jitter is a well known issue in particle simulations. I can't debug exactly what's going on, but one solution is to dampen the motion or forces after they have reached a certain threshold and just set velocity and position to 0, etc.

polar hornet
#

did you see the vid

ivory plover
#

yes

polar hornet
#

you saw the enemies die right

ivory plover
#

yes

polar hornet
#

you saw what they drop

ivory plover
#

yes

polar hornet
#

they prob not jittering

#

lemme double check

#

i disabled their bounciness and its still the same

#

btw have you checked the code

ivory plover
#

Like I said, I won't be able to debug this. You'll have to dampen the forces or velocity on the particles after they fall below some threshold value. That is how you remove the jitter.

polar hornet
#

ok wait

daring wraith
#

(PhyE.x, PhyE.y), (vx, vy), 0.5, 0.1, 0, (11, 11)),

#

other than that:

#
        tile_y = int(PhyD.y // t_size)
        
        PhyD.on_ground = on_tile_ground(PhyD.x, PhyD.y - h_size)
        if PhyD.on_ground:
            
            PhyD.y = tile_y * t_size - h_size
#

(0, 0) is top left for pygame

#

this is rounding your Y coordinate upwards, resulting in the snap-bounce effect as it gets smaller

#

I suggest building in toggleable slomo so you can see the exact behaviors of each step in non-real-time to understand your physics engine better

#

other tricks you can use is graphing/tracing

#

Since you know the particles are what is misbehaving, what you can do is keep track of their Y coordinate and dump a list on exit. Then you can load that into matplotlib or similar and you'd see the abrubt square shape of the motion and be able to see what's wrong

polar hornet
#

nvm i fixed it

lost bearBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.