less copy protection, more size visualization
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

60 lines
1.5 KiB

  1. function makeVehicle(name, horizHeight, horizImage, vertHeight, vertImage, mass) {
  2. views = {
  3. horizontal: {
  4. attributes: {
  5. height: {
  6. name: "Height",
  7. power: 1,
  8. type: "length",
  9. base: horizHeight
  10. },
  11. mass: {
  12. name: "Mass",
  13. power: 3,
  14. type: "mass",
  15. base: mass
  16. }
  17. },
  18. image: horizImage,
  19. name: "Horizontal"
  20. },
  21. vertical: {
  22. attributes: {
  23. height: {
  24. name: "Height",
  25. power: 1,
  26. type: "length",
  27. base: vertHeight
  28. },
  29. mass: {
  30. name: "Mass",
  31. power: 3,
  32. type: "mass",
  33. base: mass
  34. }
  35. },
  36. image: vertImage,
  37. name: "Vertical"
  38. }
  39. };
  40. return makeEntity(name, "Vehicle", views);
  41. }
  42. function makeVehicles() {
  43. const results = [];
  44. results.push({
  45. name: "Bus",
  46. constructor: () => makeVehicle(
  47. "Bus",
  48. math.unit(10.5, "feet"),
  49. { source: "./media/vehicles/bus.svg" },
  50. math.unit(38.556, "feet"),
  51. { source: "./media/vehicles/vertical-bus.svg" },
  52. math.unit(30000, "lb"),
  53. )
  54. });
  55. return results;
  56. }