[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] stumped by basic python



I know this must be a dumb Noob question but I am stumped.

I want to rewrite this so that I can put it all in a loop calling on the data in the list to make the functions and fill in the data. What I don't know if how to come up with "sunModel" and the "mercuryModel" etc in the loop based on the list names and then set the data to that. Make sense? The way I started was to hand code it but that is crazy.

Thanks

Douglas

sol1=(('sun', 'sunmap.jpg', 139),('mercury'. 'mercurymap.jpg', 2.4297), ('earth', 'earthmap1k.png', 6.378), ('moon', 'moonmap1k.png' ,1.738))

sunModel = loader.loadModelCopy("BasicPlanet2.egg")
sunModel.reparentTo(render)
sunModel.setScale(139)
tex = loader.loadTexture('sunmap.jpg')
sunModel.setTexture(tex,1)

mercuryModel = loader.loadModelCopy("BasicPlanet2.egg")
mercuryModel.reparentTo(render)
mercuryModel.setScale(2.4397)
tex = loader.loadTexture('mercurymap.jpg')
mercuryModel.setTexture(tex,1)

earthModel = loader.loadModelCopy("BasicPlanet2.egg")
earthModel.reparentTo(render)
earthModel.setScale(6.378)
tex = loader.loadTexture('earthmap1k.png')
earthModel.setTexture(tex,1)

moonModel = loader.loadModelCopy("BasicPlanet2.egg")
moonModel.reparentTo(render)
moonModel.setScale(1.738)
tex = loader.loadTexture('moonmap1k.png')
moonModel.setTexture(tex,1)