I need to have it take the current_map variable and add it to the string, ".map_skybox" so it outputs (Not as a string) map1.map_skybox and uses that to display an image on screen. None of the methods I tried work. tau-pt-1_00.py
#imports engine components.
import pygame
import tau_main
import gameinfo
import os
import importlib
current_map = "background1"
#find the cwd and put it into a varible.
Current_Working_Dir = os.getcwd()
#include all maps here.
import map1
import background1
def chapter_start(chapter_name):
print("starting chapter ", chapter_name, "...")
def map_start(map_name):
print("starting map ", map_name, "...")
current_map = map_name
print((current_map).map_layer_1)
#sets some engine info.
screen_height = 720
screen_width = 720
date_updated = "1/15/2023"
#prints engine info.
if gameinfo.debug_mode == True:
print("Debug mode is enabled")
print("Pygame ver. ", pygame.version.ver)
print("Pygame SDL ver.", pygame.version.SDL)
print("Tau Engine Ver. ", tau_main.version)
print("Tau main date updated: ", tau_main.date_updated)
print("Tau updated: ", date_updated)
print("Game is in Development: ", gameinfo.is_indev)
#Initalizes Pygame.
map_start(map1)
maphack = ".map_skybox"
map_skybox_current = (current_map).map_skybox
pygame.init()
X = 831
Y = 791
# create the display surface object
# of specific dimension..e(X, Y).
scrn = pygame.display.set_mode((X, Y))
# set the pygame window name
pygame.display.set_caption('TAU2D DEVELOPMENT VERSION ' + tau_main.version)
# create a surface object, image is drawn on it.
imp = pygame.image.load(map_skybox_current).convert()
# Using blit to copy content from one surface to other
scrn.blit(imp, (0, 0))
# paint screen one time
pygame.display.flip()
status = True
while (status):
# iterate over the list of Event objects
# that was returned by pygame.event.get() method.
for i in pygame.event.get():
# if event object type is QUIT
# then quitting the pygame
# and program both.
if i.type == pygame.QUIT:
status = False
# deactivates the pygame library
pygame.quit()
tau_main.py
#sets engine info.
version = "pt-1_00aa"
dev_stage = "prototype"
date_updated = "12/19/2022"
gameinfo.py
#sets important game info.
game_name = "tau testing game"
date_updated = "12/19/2022"
menu_options_text = "Options"
menu_newgame_text = "New Game"
menu_loadgame_text = "Load Game"
menu_exit_text = "exit Game"
prompt_exitgame_text = ["Are you sure you want to exit the game?", "Yes", "No"]
menu_savegame_text = "Save Game"
debug_mode = True
is_indev = True
#list of all texture directories.
texture_dir = ["assets/resources/textures/", "assets/resources/textures/skybox/",]
#list of maps in each chapter.
chapter1 = ["testmap", "testmap2"]
chapter2 = ["testmap3", "testmap4"]
chapter3 = ["testmap5", "testmap6"]
#list of chapters.
chapters = [chapter1, chapter2, chapter3]
map1.py
#sets map size in tiles.
map_width = 5
map_height = 5
map_playerstart_x = 3
map_playerstart_y = 3
map_tileset = "assets/resources/textures/tilemap1/"
map_skybox = "assets/resources/textures/skybox/skybox2.png"
map_info_layers = 1
map_layer_1 = ["AA","AA","AA","AA,","AA",
"AA","00","00","00","AA",
"AA","00","00","00","AA",
"AA","00","00","00","AA",
"AA","AA","AA","AA","AA",]
map_layer_obj = ["00","00""00","00","00",
"00","00""00","00","00",
"00","00""00","00","00",
"00","00""00","00","00",
"00","00""00","00","00",]
map_layer_hitbox = ["AA","AA","AA","AA,","AA",
"AA","00","00","00","AA",
"AA","00","00","00","AA",
"AA","00","00","00","AA",
"AA","AA","AA","AA","AA",]
I tried add the string like
map_skybox_current = (current_map.map_skybox)
and
map_skybox_current = current_map + ".map_skybox"
But all returned errors, or crashed Pygame.