#๐ help with street fighter style ai opponent
24 messages ยท Page 1 of 1 (latest)
@oak granite
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.
I would start by turning some of those really long lines into variables and such
will make reading and understanding what is going wrong easier
the stuff I noticed was above the character class
balrog_walking_flip=[pygame.transform.flip(pygame.image.load('balrogwalking1.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking2.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking3.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking4.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking1.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking2.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking3.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking4.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking1.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking2.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking3.png'),True,False),pygame.transform.flip(pygame.image.load('balrogwalking4.png'),True,False)]
this is a single line for example
image_name = pygame.image.load('balrogwalking3.png')
then you can just call image_name
way more readeable
Just hard to see what is going wrong, when the code is hard to read is all
sorry i dont really understand how that would work
balrog_walking_flip = [
pygame.transform.flip(pygame.image.load('balrogwalking1.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking2.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking3.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking4.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking1.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking2.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking3.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking4.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking1.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking2.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking3.png'), True, False),
pygame.transform.flip(pygame.image.load('balrogwalking4.png'), True, False)
]
this was ai genned but is very easy to read in comparison
you could also make a function to simply this futher but that is probably best left to future you if you wanna do that
Hey @lean kindle!
It looks like you pasted Python code without syntax highlighting.
Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.
To do this, use the following method:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
so you just reordered it?
Yeah, you could make it cleaner as well with a little math and stuff, since it is just adding 1 to the image name but that might be a bit much for you rn
but if you make stuff cleaner like that is helps people help you way faster
ok cool thank you
I took a look around trying to discern your bug but I can't seem to fully understand the flow at a glance
would you like me to upload a video of the error?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.