- Home /
Question by
Archonn · Sep 22, 2012 at 10:22 PM ·
coordinatesconstructor
Writing constructor to take coordinates
Im making a map class to make a map of cubes. It takes Height, Width, start coordinate and end coordinate. I could just make the constructor accept 6 integers, but calling it would be so messy: map = new Map(4,4,1,1,2,3)
Instead i'd like to call it like
map = new Map((4,4),(1,1),(2,3))
How do i write a constructor for that?
Comment
I guess you could go like this,
.. new $$anonymous$$ap(Vector2(4,4), Vector2(1,2), Vector2(2.3) )
don't forget you can simply use newlines.
.. new $$anonymous$$ap(
4,4
2,2,
2,3 );
Just add some spaces.
map = new $$anonymous$$ap(4,4, 1,1, 2,3)
Aah, I feel a bit tempted to tell you to make a singleton factory class to take care of it for you. And then you wouldn't have to pass any variables at all! :D
But no, that's overly complicated. . . go with Fattie's normal. . .boring. . . answer :(
:P
Your answer
