Added some codecomments
This commit is contained in:
@@ -157,19 +157,19 @@ while active == True:
|
||||
PLAYGROUND.blit(surface_text_noplayer, (MAINSCREEN_SIZE[0]/2 - surface_text_noplayer.get_width()/2, 10))
|
||||
PLAYGROUND.blit(surface_text_inputplayername, (MAINSCREEN_SIZE[0]/2 - surface_text_inputplayername.get_width()/2, 40))
|
||||
|
||||
|
||||
if(game.get_state("started")):
|
||||
MAINSCREEN.blit(text_surface_score, (MAINSCREEN_SIZE[0]/2-text_surface_score.get_size()[0]/2,0)) #Paints the Scoreboard in Top/Center
|
||||
MAINSCREEN.blit(text_surface_player, (10, 0))
|
||||
|
||||
#If spawn_fruit is True then create a fruitobject and set spawn_fruit=false
|
||||
if(spawn_fruit == True):
|
||||
fruit = Fruit("Fruit", PLAYGROUND, PLAYGROUND.get_size(), init_pos_x=rand.randint(0, PLAYGROUND.get_size()[0]-40), init_pos_y=rand.randint(0, PLAYGROUND.get_size()[1]-40), color=ROT, rect_size=40, score_points=10, sprite=fruits[rand.randint(0, len(fruits)-1)])
|
||||
spawn_fruit = False
|
||||
|
||||
#Draws a fruit if a fruitobject is instanced
|
||||
if(fruit):
|
||||
fruit.draw()
|
||||
|
||||
|
||||
player.draw()
|
||||
if(game_started == True and player.collide_self() == False):
|
||||
player.move(40)
|
||||
@@ -181,7 +181,6 @@ while active == True:
|
||||
User.update_user_highscore(player.get_player_score())
|
||||
PLAYGROUND.blit(gameovertext, (MAINSCREEN_SIZE[0]/2-gameovertext.get_size()[0]/2, MAINSCREEN_SIZE[1]/2-gameovertext.get_size()[1]/2))
|
||||
|
||||
|
||||
if(player.collide_fruit(fruit.get_rect()) == True and fruit):
|
||||
player.add_body()
|
||||
player.inc_score(fruit.get_score_points())
|
||||
|
||||
Reference in New Issue
Block a user