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

Character Entities #3

Open
loganwm opened this issue Mar 5, 2012 · 4 comments
Open

Character Entities #3

loganwm opened this issue Mar 5, 2012 · 4 comments
Assignees
Labels

Comments

@loganwm
Copy link
Contributor

loganwm commented Mar 5, 2012

Character entities need to be added. Character entities should be able to occupy map tiles that aren't occupied by other entities or that are prohibited (IE: water tiles)

@Quillwerth
Copy link
Member

Pretty new to this language; does Javascript have some sort of class inheritance feature, or perhaps the ability to create Java-like interfaces?

@loganwm
Copy link
Contributor Author

loganwm commented Mar 6, 2012

There's a prototype system that allows a sort of hacky inheritance, but it's kind of... odd. Generally I'd think the Javascript way of doing things would be to populate a generic character entity's properties accordingly. What do you have in mind? We've got a few javascript wizards who can answer js-specific logistical questions better than I can.

@Quillwerth
Copy link
Member

I'm thinking that it's more efficient to have a few things every entity needs to have, and define them, at least in concept, all in the same file. For example, every entity needs to have a location on the map, needs a mouse-over / mouse-click function (I assume they have some sort of functionality), most probably need some sort of material / money cost, and so on. Organizing it in one place makes subsequent updates much easier as well, and code maintenance is where the majority of work comes from.

In short, is there a way to organize a bunch of general traits of entities into some sort of high-level structure?

@loganwm
Copy link
Contributor Author

loganwm commented Mar 6, 2012

It's tricky with javascript. Objects are functions. And you can nest functions in function objects to create methods. Inheritance works, but it's really stupid.

Right now entities are classed in two disjoint groups: map entities and character entities. They're technically not related in the class hierarchy, but that's because there is no class hierarchy.

That being said, we can probably define a standard interface then use it as a prototype, but that kind of abstraction is costly within the scope of javascript from what I understand.

@ghost ghost assigned Quillwerth Mar 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants