python - How do I blit specific indexes of text to the screen in pygame -


import pygame import math  def storyline():      pygame.init()      width = 1104     height = 644      white = 255,255,255     red = 255,0,0     color = 255,0,0     black = 0,0,0     cyan = 0,255,255      gamedisplay = pygame.display.set_mode((width,height))     pygame.display.set_caption('war games 3')      map = pygame.image.load('map3cut.png')     map = pygame.transform.scale(map, (1104,644))      stop = false      while not stop:          gamedisplay.blit(map, (0,0))          storytext = pygame.font.sysfont("monospace",25)          storyfont = storytext.render('click enter continue...',5,(red))         gamedisplay.blit(storyfont,(50,500))         event in pygame.event.get():              if event.type == pygame.keydown:                  if event.key == pygame.k_return:                      maingame()              if event.type == pygame.quit:                 pygame.quit()                 quit()          pygame.display.update() 

here have text tells user click enter continue. wondering how blit 1 index of string example blit
storyfont[1] , blit 'l' screen. did try , did not work. thank help.

as far know, can't edit pygame render instance. however, create variable contains normal string, render that. instance:

while not stop:         original_txt = 'click enter continue...'         text_to_be_displayed = original_txt[1]         gamedisplay.blit(map, (0,0))          storytext = pygame.font.sysfont("monospace",25)          storyfont = storytext.render(text_to_be_displayed,5,(red))         gamedisplay.blit(storyfont,(50,500)) 

hope helped.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -