#๐Ÿ”’ Need help with a small simple game

9 messages ยท Page 1 of 1 (latest)

vernal roseBOT
#

@past locust

Python help channel opened

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.

past locust
#

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)

vernal roseBOT
#

Hey @past locust!

Please edit your message to use a code block

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
brisk kiln
#

whats this interactive_graphics thing u importing ? pithink

past locust
blissful musk
#

we can't really help you with a library that we know nothing about

vernal roseBOT
#
Python help channel closed using Discord native close action

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.