Very interesting concept, I could see this turning into a "Pimp my Ride" game. A few things before this is sent off to gamers:
##OOP##
OOP
It seems like you've kind of misunderstood what OOP is about. As it is, you have a lot of variables (not objects) which then are smushed together into a final concept (the car).
If you want this to be more OOP oriented, here's some things I suggest:
Get rid of all the variables, except car
. Keep this, as it will represent your "object". Instead of the manufacturer having his own variable (who knows, maybe some car will be custom built or have various manufacturers), use getters and setters to define a property of car. Picture it this way:
Car object {
Initialize the object here
get manufacturer() {
}
set manufacturer(string or array or object) {
}
}
Now your code might get a big here if you implement each detail with a getter and setter. Sometimes you can manage this, other times not, which then you might break things apart: have the manufacturer get/set in an engine object, and the car will only have the get/set for engines.
Like one of the comments said, you should research object prototyping. For a fresh start on JavaScript programming in an object oriented style, read Mozilla's documentation.
##Misc.##
Misc.
I'm not convinced having a Ferrari
variable and a lotus
variable are the best way to accomplish creating cars. I suggest a new object, maybe CarColection
or Garage
and create/retrieve/store/pimp your cars their. It will allow for later changes, or dynamic modification of the cars.
Purely for fun and for homework: add in the ability to specify exhaust, transmission, tires, driving skill, etc. and then compute horsepower/car level. Pretty soon you could challenge cars up against each other in races! :)
Very interesting concept, I could see this turning into a "Pimp my Ride" game. A few things before this is sent off to gamers:
##OOP##
It seems like you've kind of misunderstood what OOP is about. As it is, you have a lot of variables (not objects) which then are smushed together into a final concept (the car).
If you want this to be more OOP oriented, here's some things I suggest:
Get rid of all the variables, except car
. Keep this, as it will represent your "object". Instead of the manufacturer having his own variable (who knows, maybe some car will be custom built or have various manufacturers), use getters and setters to define a property of car. Picture it this way:
Car object {
Initialize the object here
get manufacturer() {
}
set manufacturer(string or array or object) {
}
}
Now your code might get a big here if you implement each detail with a getter and setter. Sometimes you can manage this, other times not, which then you might break things apart: have the manufacturer get/set in an engine object, and the car will only have the get/set for engines.
Like one of the comments said, you should research object prototyping. For a fresh start on JavaScript programming in an object oriented style, read Mozilla's documentation.
##Misc.##
I'm not convinced having a Ferrari
variable and a lotus
variable are the best way to accomplish creating cars. I suggest a new object, maybe CarColection
or Garage
and create/retrieve/store/pimp your cars their. It will allow for later changes, or dynamic modification of the cars.
Purely for fun and for homework: add in the ability to specify exhaust, transmission, tires, driving skill, etc. and then compute horsepower/car level. Pretty soon you could challenge cars up against each other in races! :)
Very interesting concept, I could see this turning into a "Pimp my Ride" game. A few things before this is sent off to gamers:
OOP
It seems like you've kind of misunderstood what OOP is about. As it is, you have a lot of variables (not objects) which then are smushed together into a final concept (the car).
If you want this to be more OOP oriented, here's some things I suggest:
Get rid of all the variables, except car
. Keep this, as it will represent your "object". Instead of the manufacturer having his own variable (who knows, maybe some car will be custom built or have various manufacturers), use getters and setters to define a property of car. Picture it this way:
Car object {
Initialize the object here
get manufacturer() {
}
set manufacturer(string or array or object) {
}
}
Now your code might get a big here if you implement each detail with a getter and setter. Sometimes you can manage this, other times not, which then you might break things apart: have the manufacturer get/set in an engine object, and the car will only have the get/set for engines.
Like one of the comments said, you should research object prototyping. For a fresh start on JavaScript programming in an object oriented style, read Mozilla's documentation.
Misc.
I'm not convinced having a Ferrari
variable and a lotus
variable are the best way to accomplish creating cars. I suggest a new object, maybe CarColection
or Garage
and create/retrieve/store/pimp your cars their. It will allow for later changes, or dynamic modification of the cars.
Purely for fun and for homework: add in the ability to specify exhaust, transmission, tires, driving skill, etc. and then compute horsepower/car level. Pretty soon you could challenge cars up against each other in races! :)
Very interesting concept, I could see this turning into a "Pimp my Ride" game. A few things before this is sent off to gamers:
##OOP##
It seems like you've kind of misunderstood what OOP is about. As it is, you have a lot of variables (not objects) which then are smushed together into a final concept (the car).
If you want this to be more OOP oriented, here's some things I suggest:
Get rid of all the variables, except car
. Keep this, as it will represent your "object". Instead of the manufacturer having his own variable (who knows, maybe some car will be custom built or have various manufacturers), use getters and setters to define a property of car. Picture it this way:
Car object {
Initialize the object here
get manufacturer() {
}
set manufacturer(string or array or object) {
}
}
Now your code might get a big here if you implement each detail with a getter and setter. Sometimes you can manage this, other times not, which then you might break things apart: have the manufacturer get/set in an engine object, and the car will only have the get/set for engines.
Like one of the comments said, you should research object prototyping. For a fresh start on JavaScript programming in an object oriented style, read Mozilla's documentation.
##Misc.##
I'm not convinced having a Ferrari
variable and a lotus
variable are the best way to accomplish creating cars. I suggest a new object, maybe CarColection
or Garage
and create/retrieve/store/pimp your cars their. It will allow for later changes, or dynamic modification of the cars.
Purely for fun and for homework: add in the ability to specify exhaust, transmission, tires, driving skill, etc. and then compute horsepower/car level. Pretty soon you could challenge cars up against each other in races! :)