i want to less
hidden #10559160
Level 3
is there any shortcut way?
Under discussion
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Shawn
14 December 2019, 00:36
easiest way is to just create each object on a new line. I'm sure there are more advanced short ways to do this but at this part of the learning we haven't learned enough to do that. I originally was going to try to do it using a for loop but it wouldn't have worked. So I just went with the newbie approach.
Also, try creating all the objects of one type first, then naming all objects of that type, then doing the same for the 2nd and 3rd object types. This was a fun one for me since I've actually played Starcraft a lot and know actual hero names from the game.
0
Wilson Meals
4 December 2019, 13:05
Yes there is, instead of creating objects and then adding their names, like this:
.. you can write a constructor which will then automatically make object name as a object.name.
0
Anthony Chalk
3 December 2019, 16:16
I assume what you have done is something on the lines of:
In this circumstance, that's probably the best way to +1