[Python] How to make Terraria's title screen? [closed]

Discussão em 'Python' iniciado por Stack, Agosto 28, 2025.

  1. Stack

    Stack Membro Participativo

    Im trying to make a terraria clone in python using Arcade library but im having problems thinking of ideas on how am i going to recreate the moving background of terraria's title screen. terraria's title screen

    At first i thought that maybe i should just make a class and then create multiple sprite list for different layers of the image like the trees, mountain and clouds, like layer 1 is for clouds behind the mountain, layer 2 is for the mountain, layer 3 is for the clouds infront of the mountain and layer 4 is for the trees, and then i just have to add sprites to each layer.

    But when i tried doing this i got alot of a problems mainly trying to position the sprite and making it look like the background of Terraria's titlescreen.

    for now my code looks like this:

    def _add_backgrounds(self):
    layer = None
    offset = (0,0)

    for image in self.current_backgrounds:
    #Check the background layer and the image layer
    #Image[0] is the image file and Image[1] is the layer index for that image

    layer = self.layer_2 if image[1] == 1 else self.layer_4

    if image[1] == 1: offset = (0,80)
    elif image[1] == 2: offset = (80,100)
    elif image[1] == 3: offset = (120,200)

    sprite = arcade.Sprite(join(ASSETS_DIRECTORY,"sky",image[0]),scale=1.5)

    #This is to get how many times has the lenght of the layer is equal to the lenght of self.current_bgs
    full_layer_count = int(layer.__len__()/len(self.current_backgrounds))

    sprite.center_x = sprite.width * full_layer_count + offset[1]

    if layer == self.layer_4:
    sprite.center_y -= 100

    layer.append(sprite)


    So is there a better way of making the background title screen of terraria?

    Continue reading...

Compartilhe esta Página