1 Replies - 163 Views - Last Post: 14 February 2019 - 12:39 AM Rate Topic: -----

#1 jgrimmie   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 18-August 14

object from list

Posted 14 February 2019 - 12:22 AM

Ok so I want to have a list of objects, "levels" this list is going to be shuffled to make the level a random one. Now I am trying to call the object after saving it in the variable randomLevel thinking that is would then work as Level1.level1.startScreenlvl1()
However this is not the case, can anyone tell me how I could accomplish this? I could work around this with if if-else statements, but think the way I am trying to go about it is better for now.


levels = [Level1.level1.startScreenlvl1(), ] #list of level objects
randomLevel = random.shuffle(levels) #randomizing level selection list

#clear the terminal
clearscreen()

Level1.level1.startScreenlvl1()
#randomLevel

input()






This however this does work

randomLevl = Level1.level1.startScreenlvl1()
randomLevel




so it has to be the list part or shuffle that braking it

This post has been edited by jgrimmie: 14 February 2019 - 12:35 AM


Is This A Good Question/Topic? 0
  • +

Replies To: object from list

#2 jgrimmie   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 18-August 14

Re: object from list

Posted 14 February 2019 - 12:39 AM

You know what I am retarded, this did and does work it was that the clear screen function was lagging so it was clearing the screen after it was supposed to ill add a delay to fix the issue.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1