Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors createTileObjects function #33

Merged
merged 1 commit into from
Apr 11, 2016
Merged

Conversation

PenneyGadget
Copy link
Owner

I pulled the shapes out into their own array and eliminated the switch statement in this function, replacing it with one line of dynamic code.
@bethsebian @rrgayhart @afg419

self.objectIndex[location] = (new QuadArc(location, orientation));
break;
}
self.objectIndex[location] = new shapes[shapeType](location, orientation);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool refactor, I'm all about stuffing classes into objects. I think I'd prefer if the object were named 'shape' or even 'shapeOfType' rather than 'shapes' so you can say 'new shape[shapeType]...' or 'new shapeOfType[shapeType]...'.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a neat tip!

@bethsebian bethsebian merged commit 799c87a into master Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants