Discord
Login
Community
DARK THEME

Problem beim laden

def draw():
  screen.clear()
  screen.drawMap( "map", 0, 0, 300, 200 )
  screen.drawSprite( "feind", -120, 100, 32, 32 )
  screen.drawSprite( "hakenverteidigung", 130, 20, 70, 70 )
  screen.drawSprite( "kanone", 130, -20, 70, 70 )
  pass

def update():
  y = 100
  x = -120
  while y != -75:
    screen.clear()
    screen.drawSprite( "feind", x, y, 32, 32 )
    y = y-3

das Programm wird nicht ausgef├╝hrt und ich verstehe nicht wo das problem liegt

Zur info Das wird ein Tower Defense

First, the update function is called.

Here you are constantly cleaning the screen and drawing.

Since the value of y is initially 100, and in each while loop you subtract 3, the value will never be y = -75, the loop will continue indefinitely.

The draw function will never be called and you will not see the image.

Try subtracting 1 from y. y = y - 1

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community