0
\$\begingroup\$

I'm using the arcade library, and this script keeps crashing. I think it's my function but idk. Definitely the script, I've run it from two IDEs and the file explorer and every time it shows a black screen and then after a second says "not responding". Full script below.

import os
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 2000
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Asteroids.py.gg.bozo.gitgud")
arcade.set_background_color(arcade.color.BLACK)
arcade.start_render()
def loadKraft(x, y):
    arcade.draw_line(x, y + 25, x - 14, y - 18, arcade.color.RED, 6)
    arcade.draw_line(x, y + 25, x + 14, y - 18, arcade.color.RED, 6)
    arcade.draw_line(x - 14, y - 18, x, y - 12, arcade.color.RED, 6)
    arcade.draw_line(x + 14, y - 18, x, y - 12, arcade.color.RED, 6)
loadKraft(0, -59)
arcade.finish_render()
arcade.pause(60)
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Have you tried to identify which line is the culprit? \$\endgroup\$ Commented Nov 10, 2022 at 19:07
  • \$\begingroup\$ @Vaillancourt looks like the arcade wait command, the last line there, is triggering the windows "unresponsive" thing. Any way I can get the script to keep displaying the render without making it seem unresponsive? \$\endgroup\$ Commented Nov 10, 2022 at 19:16
  • \$\begingroup\$ Why do you have arcade.pause(60) there at all? Example Arcade projects I can find do not include this line, and the documentation says this would halt your game for a solid 60 seconds, naturally making it unresponsive. \$\endgroup\$ Commented Nov 10, 2022 at 19:17

1 Answer 1

1
\$\begingroup\$

keeps crashing

Technically, nope.

every time it shows a black screen and then after a second says "not responding"

Your script is technically freezing or stalling.

it shows a black scree

In this piece of code

def loadKraft(x, y):
    arcade.draw_line(x, y + 25, x - 14, y - 18, arcade.color.RED, 6)
    arcade.draw_line(x, y + 25, x + 14, y - 18, arcade.color.RED, 6)
    arcade.draw_line(x - 14, y - 18, x, y - 12, arcade.color.RED, 6)
    arcade.draw_line(x + 14, y - 18, x, y - 12, arcade.color.RED, 6)

try to replace x and y with the values you supply here:

loadKraft(0, -59)

You'll realize that the y coordinates you supply are always negative. This likely means that you try to draw outside your viewport and so, well, you don't see it.

To fix this, try to draw everything using positive coordinates.

arcade.pause(60)

This will pause your game for 60 seconds. I don't know what is the intention here, but if you started your script and did not wait those 60 seconds, it likely means that you ask your game to freeze during this period of time until it finishes.

So to fix this issue, try to make it pause for a smaller amount of time.

Any way I can get the script to keep displaying the render without making it seem unresponsive?

I think what you're missing, from looking at examples (I haven't tried it myself), is to call this

arcade.run()

instead of

arcade.pause(60)
\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.