-
Notifications
You must be signed in to change notification settings - Fork 13
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
Converted placeable multidimensional array into object #43
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Entity{ | ||
constructor(imagePath, rotation, direction,width,height,mirrorFlippedHorizontal=0){ | ||
this.imagePath = imagePath; | ||
this.rotation = rotation; | ||
this.direction = direction; | ||
this.width = width; | ||
this.height = height; | ||
this.mirrorFlippedHorizontal = mirrorFlippedHorizontal; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this property name is a bit long, but i'm not sure if there is a better name for this |
||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you want to keep using the array of data, you could create a static method that returns a new Entity: static function fromDataArray(dataArray) {
var name = dataArray[0];
var rotation = dataArray[1];
//etc...
return new Entity(name, rotation, //etc...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll add this. Eventually I'd like to get away from the array format and have a config file somewhere storing all of the entity information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably namespace our stuff at some point instead of overloading the window space. For now this is ok.