Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

TB2_Week 1

Starting a code to create random cubes in random places.

import maya.cmds as cmds

import random


#creates a function which randomizes the x and z position of a cube called mycube

def buildings():   

    Inputnumber1 = 70 # prints 70 buildings

    for i in range(0, Inputnumber1 ):

        mycube = cmds.polyCube(h=5, w=1, d=1, n="Object#")

        x = random.uniform(-20.0, 20.0)

        y = 1

        z = random.uniform(-20.0, 20.0)

        cmds.move(x, y, z, mycube)  

buildings()


# Makes a new window

#

window = cmds.window( title="City Maker", iconName='Create a City', widthHeight=(200, 55) )

cmds.columnLayout( adjustableColumn=True )

cmds.button( label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)') )

cmds.setParent( '..' )

cmds.showWindow( window )


#Creates a slider

Inputnumber1 = cmds.intSliderGrp( label="Buildings", field=True, bgc=[.9,0,.2], min=3, max=50, value=1)

Inputnumber2 = cmds.intSliderGrp( label="Streets", field=True, bgc=[.9,0,.2], min=3, max=50, value=1)

Inputnumber3 = cmds.intSliderGrp( label="Cars", field=True, bgc=[.9,0,.2], min=3, max=50, value=1)

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.