0

I have below python script that detects collision (not fully tested out) but since it's in a forever loop, nothing else can run

import time

p_s = 100
e_s = 100

px = 0
py = 0
ex = 0
ey = 0

while True:
    pupc = px + p_s / 2
    pdownc = px - p_s / 2
    pupcy = py + p_s / 2
    pdowncy = py - p_s / 2

    if ex == px or ex > px and ex < pupc or ex == px or ex < px and ex > pdownc:
        if ey == py or ey > py and ey < pupcy or ey == py or ey < py and ey > pdowncy:
            pec = 1
        else:
            pec = 0
    else:
        pec = 0

while True:
    if pec == 1:
        print('collision')
    else:
        print('nope')

mujjiga
  • 16,186
  • 2
  • 33
  • 51
itsanantk
  • 264
  • 1
  • 9

0 Answers0