Similar Posts

Subscribe
Notify of
8 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Suiram1
11 months ago

Python works with entering lines. Since the code in line 17 is not moved further, it is not recognized that it belongs to the else.

Edit: If not marked, but line 15 would have to be moved further so that it is in the if and the condition in the if itself does not look quite right.

Suiram1
11 months ago
Reply to  Lando240

I mean by entering how far the beginning is from the code from the left line edge. The easiest way is to use the cursor to start from the code in the respective lines and press Tab.

Suiram1
11 months ago

You don’t have to enter the If and the else but the code that belongs to them. So the part would be right:

if abs(velocity.x) > 1:
   sprite_2d.animation = "running"
else:
   sprite_2d.animation = "default"
Suiram1
11 months ago

With the If condition, I can only guess a little what this is intended because if one assumes these are both conditions and these should be fulfilled the left would be necessary. Pure from context, I would like to tap

abs(velocity.x) > 1
ILoveCode
11 months ago

Under the IF or Else, the code must also be correctly drawn in.