Nana Kwame Dickson
Nana Kwame Dickson

Reputation: 21

How do I get arcade.draw_text to work in my python code for asteroids?

Here is that piece of code.

    'def remove_DeadObjects(self):'
            'for bullet in self.bullets:'
                'if not bullet.alive:'
                    'self.bullets.remove(bullet)'
                
            'for asteroid in self.asteroids:'
                'if not asteroid.alive:'
                    'self.asteroids.remove(asteroid)'
            'if not self.ship.alive:'
                'arcade.draw_text("Sorry, you got hit. Maybe try some spaceship training! See you soon!!", width = 300, height = 300,arcade.color.BLUE,)'

Upvotes: 0

Views: 78

Answers (1)

Alderven
Alderven

Reputation: 8270

You're passing wrong parameters to draw_text method. Here is the small example of how to use draw_text correctly:

import arcade

arcade.open_window(600, 400, 'Text example')
arcade.start_render()
arcade.draw_text(text='Sorry, you got hit. Maybe try some spaceship training!', start_x=20, start_y=200, color=arcade.color.RED, font_size=20)
arcade.finish_render()
arcade.run()

Output:

enter image description here

Upvotes: 2

Related Questions