Anteworld - Outerra Game > JavaScript development
The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
SteelRat:
--- Code: ---/* file: scripts\test.js */
var test = ["test.js"];
--- End code ---
--- Code: ---/* file: scripts\test2.js */
test.push("test2.js");
--- End code ---
--- Code: ---/* file: scripts\test3.js */
test.push("test3.js");
--- End code ---
--- Code: ---/*
objdef: Logic
script: logic.js
*/
$include("scripts/test.js");
$include("scripts/test2.js");
$include("scripts/test3.js");
function init_chassis() {
}
function init_vehicle() {
_veh = this;
test.forEach(function (val, idx) {
_veh.log_inf("file is included: " + val);
});
/* Result
INFO: file is included: test.js
INFO: file is included: test2.js
INFO: file is included: test3.js
*/
}
function update_frame() {
}
--- End code ---
HiFlyer:
Hmmmmmmmmmmm?
SteelRat:
--- Quote from: HiFlyer on March 28, 2015, 05:48:48 pm ---Hmmmmmmmmmmm?
--- End quote ---
The question?
HiFlyer:
--- Quote from: SteelRat on March 28, 2015, 06:22:27 pm ---
--- Quote from: HiFlyer on March 28, 2015, 05:48:48 pm ---Hmmmmmmmmmmm?
--- End quote ---
The question?
--- End quote ---
Not sure what this code is the answer too.......
SteelRat:
--- Code: ---/* file: myConstructor\car.js */
var engines = {
engine500Kwt: {
cylinderBlock: {
count: 8.0,
diameter: 0.120,
pistonStroke: 0.130
},
mainGear: 256/24
},
engine750Kwt: {
// ...
},
engine1000Kwt: {
// ...
}
}
var transmissions = {
transmission_1: {
gears: [128/24, 0.0, 128/24, 64/24, 32/24, 24/24], // [R, N, D0,...,Dx]
type: "Avtomatic"
},
transmission_2: {
// ...
},
transmission_3: {
// ...
}
}
--- End code ---
--- Code: ---/*
objdef: Car_1
script: Car_1.js
*/
$include("myConstructor/car.js");
function init_vehicle() {
this.engine = engines.engine500Kwt;
this.transmission = transmissions.transmission_1;
// ...
}
--- End code ---
--- Code: ---/*
objdef: Car_2
script: Car_2.js
*/
$include("myConstructor/car.js");
function init_vehicle() {
this.engine = engines.engine500Kwt;
this.transmission = transmissions.transmission_1;
// ...
}
--- End code ---
--- Code: ---/*
objdef: Car_3
script: Car_3.js
*/
$include("myConstructor/car.js");
function init_vehicle() {
this.engine = engines.engine1000Kwt;
this.transmission = transmissions.transmission_3;
// ...
}
--- End code ---
Understand the meaning?
Navigation
[0] Message Index
[#] Next page
Go to full version