#๐ Need help with a small simple game
9 messages ยท Page 1 of 1 (latest)
@past locust
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.
class Demo:
def init(self):
self.g = InteractiveGraphics(frame_rate=5)
self.player = Player(MAP_WIDTH // 2, MAP_HEIGHT // 2)
self.game_map = Map('map_cp.txt')
def update(self):
keys = self.g.get_keys()
new_x, new_y =self.player.x, self.player.y
if 'w' in keys and self.player.y > 0:
new_y -= 1
if 's' in keys and self.player.y < MAP_HEIGHT - 1:
new_y += 1
if 'a' in keys and self.player.x > 0:
new_x -= 1
if 'd' in keys and self.player.x < MAP_WIDTH - 1:
new_x += 1
self.player.x, self.player.y = new_x, new_y
def step(self):
self.update()
self.game_map.draw_map(self.g)
self.g.paint((self.player.x, self.player.y), self.player.color)
if name == 'main':
demo = Demo()
demo.g.run(demo)
Hey @past locust!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
whats this interactive_graphics thing u importing ? 
that is the library our prof gave us
you'll need to ask your prof then
we can't really help you with a library that we know nothing about
This help channel has been closed. 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.