Advertisement
DtjiPsimfans

OrteilIGMCodeGenerator.py

Feb 16th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 14.56 KB | None | 0 0
  1. class LetsMakeAGame:
  2.     def __init__(self, name, by, desc, created, updated, version):
  3.         self.name = name
  4.         self.by = by
  5.         self.desc = desc
  6.         self.created = created
  7.         self.updated = updated
  8.         self.version = version
  9.        
  10.     def to_string(self):
  11.         res = "Let's make a game!\n"
  12.         res += "    name:" + str(self.name) + "\n"
  13.         res += "    by:" + str(self.by) + "\n"
  14.         res += "    desc:" + str(self.desc) + "\n"
  15.         res += "    created:" + str(self.created) + "\n"
  16.         res += "    updated:" + str(self.updated) + "\n"
  17.         res += "    version:" + str(self.version) + "\n"
  18.         return str(res)
  19.        
  20.        
  21. class Settings:
  22.     def __init__(self, background, building_cost_increase, building_cost_refund, spritesheet, stylesheet):
  23.         self.background = background
  24.         self.building_cost_increase = building_cost_increase
  25.         self.building_cost_refund = building_cost_refund
  26.         self.spritesheet = spritesheet
  27.         self.stylesheet = stylesheet
  28.        
  29.     def to_string(self):
  30.         res = "Settings\n"
  31.         res += "    background:" + str(self.background) + "\n"
  32.         res += "    building cost increase:" + str(self.building_cost_increase) + "\n"
  33.         res += "    building cost refund:" + str(self.building_cost_refund) + "\n"
  34.         res += "    spritesheet:" + str(self.spritesheet) + "\n"
  35.         res += "    stylesheet:" + str(self.stylesheet) + "\n"
  36.         return str(res)
  37.        
  38.        
  39. class CSS:
  40.     def __init__(self, code):
  41.         self.code = code
  42.        
  43.     def to_string(self):
  44.         res = "CSS\n"
  45.         res += "    " + str(self.code) + "\n"
  46.         return str(res)
  47.  
  48.  
  49. class Layout:
  50.     def __init__(self, code):
  51.         self.code = code
  52.        
  53.     def to_string(self):
  54.         res = "Layout\n"
  55.         res += "    " + str(self.code) + "\n"
  56.         return str(res)
  57.        
  58.        
  59. class Buttons:
  60.     def __init__(self, buttons):
  61.         self.buttons = buttons
  62.        
  63.     def to_string(self):
  64.         res = "Buttons\n"
  65.         res += "    " + str(self.buttons) + "\n"
  66.         return str(res)
  67.  
  68.  
  69. class ButtonObject:
  70.     def __init__(self, label, name, desc, on_click, icon, text, class_name, icon_class, tooltip_origin, tooltip_class):
  71.         self.label = label
  72.         self.name = name
  73.         self.desc = desc
  74.         self.on_click = on_click
  75.         self.icon = icon
  76.         self.text = text
  77.         self.class_name = class_name
  78.         self.icon_class = icon_class
  79.         self.tooltip_origin = tooltip_origin
  80.         self.tooltip_class = tooltip_class
  81.        
  82.     def to_string(self):
  83.         res = "*" + str(self.label) + "\n"
  84.         res += "    name:" + str(self.name) + "\n"
  85.         res += "    desc:" + str(self.desc) + "\n"
  86.         res += "    on click:" + str(self.on_click) + "\n"
  87.         res += "    icon:" + str(self.icon) + "\n"
  88.         if self.text == "no text":
  89.             res += "    " + str(self.text) + "\n"
  90.         else:
  91.             res += "    text:" + str(self.text) + "\n"
  92.         res += "    class:" + str(self.class_name) + "\n"
  93.         res += "    icon class:" + str(self.icon_class) + "\n"
  94.         res += "    tooltip origin:" + str(self.tooltip_origin) + "\n"
  95.         res += "    tooltip class:" + str(self.tooltip_class) + "\n"
  96.         return str(res)
  97.  
  98.  
  99. class Resources:
  100.     def __init__(self, resources):
  101.         self.resources = resources
  102.        
  103.     def to_string(self):
  104.         res = "Resources\n"
  105.         res += "    " + str(self.resources) + "\n"
  106.         return str(res)
  107.  
  108.  
  109. class ResourceObject:
  110.     def __init__(self, label, name, desc, icon, on_tick, class_name, additional_desc):
  111.         self.label = label
  112.         self.name = name
  113.         self.desc = desc
  114.         self.icon = icon
  115.         self.on_tick = on_tick
  116.         self.class_name = class_name
  117.         self.additional_desc = additional_desc
  118.        
  119.     def to_string(self):
  120.         res = "*" + str(self.label) + "\n"
  121.         res += "    name:" + str(self.name) + "\n"
  122.         res += "    desc:" + str(self.desc) + "\n"
  123.         res += "    icon:" + str(self.icon) + "\n"
  124.         res += "    on tick:" + str(self.on_tick) + "\n"
  125.         res += "    class:" + str(self.class_name) + "\n"
  126.         res += str(self.additional_desc) + "\n"
  127.         return str(res)
  128.  
  129.  
  130. class Shinies:
  131.     def __init__(self, shinies):
  132.         self.shinies = shinies
  133.        
  134.     def to_string(self):
  135.         res = "Shinies\n"
  136.         res += "    " + str(self.shinies) + "\n"
  137.         return str(res)
  138.  
  139.  
  140. class ShinyObject:
  141.     def __init__(self, label, movement, frequency, frequency_variation, icon, class_name, on_click):
  142.         self.label = label
  143.         self.movement = movement
  144.         self.frequency = frequency
  145.         self.frequency_variation = frequency_variation
  146.         self.icon = icon
  147.         self.class_name = class_name
  148.         self.on_click = on_click
  149.        
  150.     def to_string(self):
  151.         res = "*" + str(self.label) + "\n"
  152.         res += "    movement:" + str(self.movement) + "\n"
  153.         res += "    frequency:" + str(self.frequency) + "\n"
  154.         res += "    frequency variation:" + str(self.frequency_variation) + "\n"
  155.         res += "    icon:" + str(self.icon) + "\n"
  156.         res += "    class:" + str(self.class_name) + "\n"
  157.         res += "    on click:" + str(self.on_click) + "\n"
  158.         return str(res)
  159.  
  160.  
  161. class Buildings:
  162.     def __init__(self, buildings):
  163.         self.buildings = buildings
  164.        
  165.     def to_string(self):
  166.         res = "Buildings\n"
  167.         res += "    " + str(self.buildings) + "\n"
  168.         return str(res)
  169.  
  170.  
  171. class BuildingObject:
  172.     def __init__(self, label, name, desc, icon, cost, on_tick, req):
  173.         self.label = label
  174.         self.name = name
  175.         self.desc = desc
  176.         self.icon = icon
  177.         self.cost = cost
  178.         self.on_tick = on_tick
  179.         self.req = req
  180.        
  181.     def to_string(self):
  182.         res = "*" + str(self.label) + "\n"
  183.         res += "    name:" + str(self.name) + "\n"
  184.         res += "    desc:" + str(self.desc) + "\n"
  185.         res += "    icon:" + str(self.icon) + "\n"
  186.         res += "    cost:" + str(self.cost) + "\n"
  187.         res += "    on tick:" + str(self.on_tick) + "\n"
  188.         res += "    req:" + str(self.req) + "\n"
  189.         return str(res)
  190.  
  191.  
  192. class Upgrades:
  193.     def __init__(self, upgrades):
  194.         self.upgrades = upgrades
  195.        
  196.     def to_string(self):
  197.         res = "Upgrades\n"
  198.         res += "    " + str(self.upgrades) + "\n"
  199.         return str(res)
  200.  
  201.  
  202. class UpgradeObject:
  203.     def __init__(self, label, name, desc, icon, cost, passive, req):
  204.         self.label = label
  205.         self.name = name
  206.         self.desc = desc
  207.         self.icon = icon
  208.         self.cost = cost
  209.         self.passive = passive
  210.         self.req = req
  211.        
  212.     def to_string(self):
  213.         res = "*" + str(self.label) + "\n"
  214.         res += "    name:" + str(self.name) + "\n"
  215.         res += "    desc:" + str(self.desc) + "\n"
  216.         res += "    icon:" + str(self.icon) + "\n"
  217.         res += "    cost:" + str(self.cost) + "\n"
  218.         res += "    passive:" + str(self.passive) + "\n"
  219.         res += "    req:" + str(self.req) + "\n"
  220.         return str(res)
  221.  
  222.  
  223. class Achievements:
  224.     def __init__(self, achievements):
  225.         self.achievements = achievements
  226.        
  227.     def to_string(self):
  228.         res = "Achievements\n"
  229.         res += "    " + str(self.achievements) + "\n"
  230.         return str(res)
  231.  
  232.  
  233. class AchievementObject:
  234.     def __init__(self, label, name, desc, req):
  235.         self.label = label
  236.         self.name = name
  237.         self.desc = desc
  238.         self.req = req
  239.        
  240.     def to_string(self):
  241.         res = "*" + str(self.label) + "\n"
  242.         res += "    name:" + str(self.name) + "\n"
  243.         res += "    desc:" + str(self.desc) + "\n"
  244.         res += "    req:" + str(self.req) + "\n"
  245.         return str(res)
  246.  
  247.  
  248. def main():
  249.     IGM = ""
  250.     print("You are now in the 'Let's make a game!' part")
  251.     name = input("Please enter name of the game: ")
  252.     by = input("Please enter your name: ")
  253.     desc = input("Please enter some description: ")
  254.     created = input("Please enter the date you create the game: ")
  255.     updated = input("Please enter the datr you update the game: ")
  256.     version = input("Please enter version of the game: ")
  257.     lmag = LetsMakeAGame(name, by, desc, created, updated, version)
  258.     IGM += lmag.to_string()
  259.     print("You are now in the settings part")
  260.     background = input("Please enter path of the background image file: ")
  261.     building_cost_increase = input("Please enter building cost increase: ")
  262.     building_cost_refund = input("Please enter building cost refund: ")
  263.     spritesheet = input("Please enter spritesheet: ")
  264.     stylesheet = input("Please enter stylesheet: ")
  265.     settings = Settings(background, building_cost_increase, building_cost_refund, spritesheet, stylesheet)
  266.     IGM += settings.to_string()
  267.     print("You are now in the CSS part")
  268.     print("Type y, Y  or yes for yes")
  269.     print("Type anything else for no")
  270.     css_code_ask = input("Do you want to include CSS code?")
  271.     if css_code_ask == "y" or css_code_ask == "Y" or css_code_ask == "yes":
  272.         css_code = "" # initial value
  273.         loc = int(input("How many lines of CSS code do you want?"))
  274.         for i in range(loc):
  275.             curr_line = input("Please enter your line of code: ")
  276.             css_code += curr_line + "\n"
  277.             print("Your current CSS code: ")
  278.             print(css_code)
  279.         css_part = CSS(css_code)
  280.         IGM += css_part.to_string()
  281.     else:
  282.         css_code = "\n"
  283.         IGM += css_code
  284.     print("You are now in the layout part")
  285.     print("Type y, Y  or yes for yes")
  286.     print("Type anything else for no")
  287.     layout_code_ask = input("Do you want to include layout code?")
  288.     if layout_code_ask == "y" or layout_code_ask == "Y" or layout_code_ask == "yes":
  289.         layout_code = "" # initial value
  290.         loc = int(input("How many lines of layout code do you want?"))
  291.         for i in range(loc):
  292.             curr_line = input("Please enter your line of code: ")
  293.             layout_code += curr_line + "\n"
  294.             print("Your current layout code: ")
  295.             print(layout_code)
  296.         layout_part = Layout(layout_code)
  297.         IGM += layout_part.to_string()
  298.     else:
  299.         layout_code = "\n"
  300.         IGM += layout_code
  301.     print("You are now in the buttons part")
  302.     btns = Buttons("")
  303.     num_buttons = int(input("How many buttons do you want?"))
  304.     for i in range(num_buttons):
  305.         label = input("Please enter the label you want: ")
  306.         name = input("Please enter name: ")
  307.         desc = input("Please add description: ")
  308.         on_click = ""
  309.         num_on_click_lines = int(input("How many lines of code do you want for on click part of the button?"))
  310.         for j in range(num_on_click_lines):
  311.             curr_line = input("Please enter line of code: ")
  312.             on_click += curr_line + "\n"
  313.             print("Your current on click code: ")
  314.             print(on_click)
  315.         icon = input("Please enter link to the image to be used as the icon: ")
  316.         text = input("Please enter text to be displayed: ")
  317.         class_name = input("Please enter class: ")
  318.         icon_class = input("Please enter icon class: ")
  319.         tooltip_origin = input("Please enter tooltip origin: ")
  320.         tooltip_class = input("Please enter tooltip class: ")
  321.         button_obj = ButtonObject(label, name, desc, on_click, icon, text, class_name, icon_class, tooltip_origin, tooltip_class)
  322.         btns.buttons += button_obj.to_string()
  323.     IGM += btns.to_string()
  324.     print("You are now in the resources part")
  325.     resources_code = Resources("")
  326.     num_resources = int(input("How many resources do you want?"))
  327.     for i in range(num_resources):
  328.         label = input("Please enter the label you want: ")
  329.         name = input("Please enter name of resource: ")
  330.         desc = input("Please enter description: ")
  331.         icon = input("Please enter link to image file which is to be used as the icon: ")
  332.         on_tick = ""
  333.         num_on_tick_lines = int(input("How many lines of code do you want for on tick part of the resource?"))
  334.         for j in range(num_on_tick_lines):
  335.             curr_line = input("Please enter line of code: ")
  336.             on_tick += curr_line + "\n"
  337.             print("Your current on tick code: ")
  338.             print(on_tick)
  339.         class_name = input("Please enter class: ")
  340.         additional_desc = ""
  341.         additional_desc_lines = int(input("How many lines of code for additional description part do you want?"))
  342.         for j in range(additional_desc_lines):
  343.             curr_line = input("Please enter line of code: ")
  344.             additional_desc += curr_line + "\n"
  345.             print("Your current additional description code: ")
  346.             print(additional_desc)
  347.         res_obj = ResourceObject(label, name, desc, icon, on_tick, class_name, additional_desc)
  348.         resources_code.resources += res_obj.to_string()
  349.     IGM += resources_code.to_string()
  350.     print("You are now in the shinies part")
  351.     shinies_code = Shinies("")
  352.     num_shinies = int(input("How many shinies do you want?"))
  353.     for i in range(nun_shinies):
  354.         label = input("Please enter the label you want: ")
  355.         movement = input("Please enter movement: ")
  356.         frequency = input("Please enter frequency: ")
  357.         frequency_variation = input("Please enter frequency variation: ")
  358.         icon = input("Please enter link to image file to be used as the icon: ")
  359.         class_name = input("Please enter class: ")
  360.         on_click = ""
  361.         num_on_click_lines = int(input("How many lines of code do you want for on click part of the shiny?"))
  362.         for j in range(num_on_click_lines):
  363.             curr_line = input("Please enter line of code: ")
  364.             on_click += curr_line + "\n"
  365.             print("Your current on click code: ")
  366.             print(on_click)
  367.         shiny_obj = ShinyObject(label, movement, frequency, frequency_variation, icon, class_name, on_click)
  368.         shinies_code.shinies += shiny_obj.to_string()
  369.     IGM += shinies_code.to_string()
  370.     print("You are now in the buildings part")
  371.     buildings_code = Buildings("")
  372.     num_buildings = int(input("How many buildings do you want?"))
  373.     for i in range(num_buildings):
  374.         label = input("Please enter the label you want: ")
  375.         name = input("Please enter name: ")
  376.         desc = input("Please enter description: ")
  377.         icon = input("Please enter link to the image file to be used as the icon: ")
  378.         cost = input("Please enter cost")
  379.         on_tick = ""
  380.         num_on_tick_lines = int(input("How many lines of code do you want for on tick part of the building?"))
  381.         for j in range(num_on_tick_lines):
  382.             curr_line = input("Please enter line of code: ")
  383.             on_tick += curr_line + "\n"
  384.             print("Your current on tick code: ")
  385.             print(on_tick)
  386.         req = input("Please enter requirements: ")
  387.         building_obj = BuildingObject(label, name, desc, icon, cost, on_tick, req)
  388.         buildings_code.buildings += building_obj.to_string()
  389.     IGM += buildings_code.to_string()
  390.     print("You are now in the upgrades part")
  391.     upgrades_code = Upgrades("")
  392.     num_upgrades = int(input("How many upgrades do you want?"))
  393.     for i in range(num_upgrades):
  394.         label = input("Please enter the label you want: ")
  395.         name = input("Please enter name: ")
  396.         desc = input("Please enter description: ")
  397.         icon = input("Please enter link to the image file to be used as the icon: ")
  398.         cost = input("Please enter cost: ")
  399.         passive = input("Please enter passive: ")
  400.         req = input("Please enter requirements: ")
  401.         upgrade_obj = UpgradeObject(label, name, desc, icon, cost, passive, req)
  402.         upgrades_code.upgrades += upgrade_obj.to_string()
  403.     IGM += upgrades_code.to_string()
  404.     print("You are now in the achievements part")
  405.     achievements_code = Achievements("")
  406.     num_achievements = int(input("How many achievements do you want?"))
  407.     for i in range(num_achievements):
  408.         label = input("Please enter the label you want: ")
  409.         name = input("Please enter name: ")
  410.         desc = input("Please enter description: ")
  411.         req = input("Please enter requirements: ")
  412.         achievement_obj = AchievementObject(label, name, desc, req)
  413.         achievements_code.achievements += achievement_obj.to_string()
  414.     IGM += achievements_code.to_string()
  415.     print("Your Orteil Idle Game Maker code is as below.\n")
  416.     print(IGM)
  417.    
  418.    
  419. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement