FusionAlpha

My First Python 2D Print Render Engine

Sep 13th, 2020 (edited)
1,264
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Simple 2D Render Engine
  2. #Open Sourced this Because I Don't Have A use For It Maybe You Can Turn This Into Smth
  3. #Contact Me On Discord To Show Me What You Made From it (FlowYT#6079)
  4. #Disclaimer I'm Very New To Python
  5.  
  6. import random
  7. import time
  8.  
  9. from os import system, name
  10.  
  11. class Colors:
  12.     Green = '\033[93m'
  13.     Brown = '\033[47m'
  14.    
  15. MountainColors = Colors.Green
  16. DirtColors = Colors.Brown
  17. Pixel = "▌"
  18.  
  19. def clear():
  20.     if name == 'nt':
  21.         _ = system('cls')
  22.     else:
  23.         _ = system('clear')
  24.    
  25. RandomVal = random.randint(3, 15)
  26.  
  27. class ChunkValues:
  28.     TopLayer = 10-RandomVal+RandomVal
  29.     MidLayer = 30-RandomVal+RandomVal
  30.     BottomLayer = 50-RandomVal+RandomVal
  31.     TopLayer1 = 70-RandomVal+RandomVal
  32.     MidLayer2 = 90-RandomVal+RandomVal
  33.     BottomLayer3 = 100-RandomVal+RandomVal
  34.    
  35. def ChunkTerrainLoad(TopLayer, MidLayer, BottomLayer, TopLayer1, MidLayer2, BottomLayer3): #Function For The Terrain
  36.     print(MountainColors + Pixel*TopLayer) #Top Layer Renders First
  37.     print(MountainColors + Pixel*MidLayer) #Mid Layer Layer Renders First
  38.     print(MountainColors + Pixel*BottomLayer) #Bottom Layer Layer Renders First
  39.     print(MountainColors + Pixel*TopLayer1) #Top Layer Renders First
  40.     print(MountainColors + Pixel*MidLayer2) #Mid Layer Layer Renders First
  41.     print(MountainColors + Pixel*BottomLayer3) #Bottom Layer Layer Renders First
  42.    
  43. while True:
  44.     ChunkTerrainLoad(ChunkValues.TopLayer, ChunkValues.MidLayer, ChunkValues.BottomLayer, ChunkValues.TopLayer1, ChunkValues.MidLayer2, ChunkValues.BottomLayer3)
  45.     clear()
RAW Paste Data