Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'onClickBuldo')' in or related to this line: 'self.onClickBuldo = function (buldos) {' Line Number: 388
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: OrdiZone is not defined' in or related to this line: 'var buldoZer1 = new Buldo(OrdiZone.x + OrdiZone.width / 2, OrdiZone.y + OrdiZone.height / 3, ordiCamp);' Line Number: 425
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: dxHotSpot is not defined' in or related to this line: 'this.dxAvHotSpot = dxHotSpot; //Offset du point chaud du sprite (point de contact avec le rocher) décalage par rapport au point d'ancrage' Line Number: 353
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'x')' in or related to this line: 'this.sprite.x = x;' Line Number: 336
User prompt
Please fix the bug: 'Uncaught ReferenceError: sprite is not defined' in or related to this line: 'this.sprite = sprite;' Line Number: 335
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_gros_sprite = self.attachAsset('large_rock', {' Line Number: 230
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_moyen_sprite = self.attachAsset('medium_rock', {' Line Number: 226
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_petit_sprite = self.attachAsset('small_rock', {' Line Number: 222
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: _this is not defined' in or related to this line: 'var rocher_petit_sprite = _this.attachAsset('small_rock', {' Line Number: 222
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'name')' in or related to this line: 'self.name = "rocher";' Line Number: 211
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'var zoneMiniy = RoadZone.y;' Line Number: 280
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: playersZoneWidth is not defined' in or related to this line: 'var RoadZone = {' Line Number: 280
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'var ComputerZone = {' Line Number: 138
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: humanZoneInstance is undefined' in or related to this line: 'var RoadZone = {' Line Number: 459
Code edit (1 edits merged)
Please save this source code
/****
* Classes
****/
var Bulldozer = Container.expand(function () {
var self = Container.call(this);
var bulldozerGraphics = self.attachAsset('bulldozer', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0; // Base speed will be set to the same as BulldoRock
self.pushing = null; // Reference to the rock it's pushing
self.update = function () {
// Check if bulldozer is moving horizontally or vertically
if (self.isMovingHorizontally) {
self.x += self.speed;
} else if (self.isMovingVertically) {
self.y += self.speed;
}
// Handle quarter turn rotation
if (self.needsToTurn) {
self.rotation += Math.PI / 2; // Rotate 90 degrees
self.isMovingHorizontally = !self.isMovingHorizontally;
self.isMovingVertically = !self.isMovingVertically;
self.needsToTurn = false;
}
};
});
var ComputerBulldozer = Container.expand(function () {
var self = Container.call(this);
var bulldozerGraphics = self.attachAsset('bulldozer', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0; // Base speed, possibly adjusted for AI difficulty
self.rock = null; // Reference to the rock being pushed
self.update = function () {
// AI logic for selecting and pushing rocks
};
});
var ComputerZone = Container.expand(function () {
var self = Container.call(this);
self.width = game.width / 10;
self.height = HumanZone.height;
self.x = game.width - self.width;
self.y = ScoreZone.height;
var graphics = self.attachAsset('shape', {
width: self.width,
height: self.height,
color: 0xFF0000
});
});
var HumanBulldozer = Container.expand(function () {
var self = Container.call(this);
var bulldozerGraphics = self.attachAsset('bulldozer', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0; // Base speed will be set later
self.rock = null; // Reference to the rock being pushed
self.interactive = true;
self.buttonMode = true;
self.on('down', function (obj) {
// Code for human player to select and command bulldozer
});
self.update = function () {
// Movement and rotation logic for human-controlled bulldozer
};
});
var HumanZone = Container.expand(function () {
var self = Container.call(this);
self.width = game.width / 10;
self.height = game.height - ScoreZone.height - OptionsZone.height;
self.x = 0;
self.y = ScoreZone.height;
var graphics = self.attachAsset('shape', {
width: self.width,
height: self.height,
color: 0x0000FF
});
self.addChild(graphics);
});
/****
* Initialize Game
****/
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
0. let playersZoneWidth = 200;
1. let ScoreZone = {x: 0, y: 0, width: app.screen.width, height: 200};
2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
- At the start of the game, 10 rocks of three different sizes are randomly placed in the RoadZone.
- Each player has two bulldozers to move the rocks.
- A bulldozer moving without pushing anything has a base speed V.
- When a bulldozer pushes a small rock, the combined speed is V/2.
- When a bulldozer pushes a medium rock, the combined speed is V/4.
- When a bulldozer pushes a large rock, the combined speed is V/8.
- When two bulldozers push a rock together, one behind the other, the pushing speeds are doubled compared to the speed of a single bulldozer.
- The human player clicks on a rock to command the nearest free bulldozer to push it towards the ComputerZone.
- The computer-controlled bulldozers randomly choose a rock and push it towards the HumanZone.
- If a human bulldozer is free, the player can click on a rock already being pushed to have the bulldozer move behind the first one and push the rock faster.
- It is possible to push a rock that is being pushed by the opponent to block or slow down its movement. If a second bulldozer is added in this situation, the rock will be pushed in the direction where there are fewer bulldozers.
- The game ends when all rocks have been moved out of the RoadZone. The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone.
- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same. Effective strategy and skillful bulldozer management are necessary to maximize the score.
There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their bulldozers to win the game.
*/
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
0. let playersZoneWidth = 200;
1. let ScoreZone = {x: 0, y: 0, width: app.screen.width, height: 200};
2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
Game settings:
- At the start of the game, 10 rocks of three different sizes (small, medium, large) are randomly placed in the RoadZone.
- The rocks have square 100x100 pixels sprites centered (anchor 0.5, 0.5).
- The Rocks have a front and a back zone to simulate a contact area with the Buldos.
- Each rock is on its own horizontal 100 pixels wide line.
- There are two players: the human player and the computer.
- Each player has two Buldos to move the rocks, a kind of bulldozer.
- The human Buldos are called "buldoRocks" and the computer Buldos are called "buldoZers".
- The buldoRocks have a 100x100 pixels sprite centered (anchor 0.5, 0.5).
- The buldoZers have a 100x100 pixels sprite centered (anchor 0.5, 0.5).
- The Buldos have a front and a back zone to simulate the pushing of the rocks.
- At the start of the game, the buldoRocks are placed in the HumanZone and the buldoZers are placed in the ComputerZone (abscissa centered and ordinate equally spaced 1/3, 2/3).
- The buldoRocks are facing right and the buldoZers are facing left.
Game rules:
- The buldoZers are controlled by the computer and will move randomly (or futher with AI) to push the rocks towards the HumanZone.
- The buldoRocks are controlled by the human player and will move when the player clicks or taps to push the rocks towards the ComputerZone.
- The human player selects a buldoRock by clicking or tapping on it, then selects a rock to push by clicking or tapping on it.
- The Buldos may only move in lignes, horizontally or vertically, and may not move diagonally.
- When a Buldo is selected to push a rock, the Buldo must move to the ordonnate of the rock
- To move to the ordonnate of the rock, the Buldo will probably have to make a 90 degres rotation, then move vertically up or down to the ordonnate of the rock, then make a 90 degres rotation to face the rock.
- When a rock is entirely into the HumanZone or the ComputerZone, it is out of the game (loss of visibility of its sprite or destruction of the object Rock).
- When a Buldo has finished pushing a rock, it comes back to its camp (HumanZone or ComputerZone) horizontally and once in its camp, it turns at 180 degres to face the RoadZone.
- A Buldo moving without pushing anything has a base speed V (to futher adjust).
- When a bulldozer pushes a small rock, the combined speed is V/2.
- When a bulldozer pushes a medium rock, the combined speed is V/4.
- When a bulldozer pushes a large rock, the combined speed is V/8.
- When two bulldozers push a rock together, one behind the other, the pushing speeds are doubled compared to the speed of a single bulldozer.
- It is possible to push a rock that is being pushed by the opponent to block or slow down its movement.
- If a second Buldo is added in this situation, the rock will be pushed in the direction where there are fewer Buldos.
- The game ends when all rocks have been moved out of the RoadZone.
- The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone (small rock is 1 point, medium rock is 2 points, large rock is 3 points).
- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same.
- There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their Buldos to win the game.
*/
// Time limit in seconds
var game = new LK.Game();
/****
* Game Code
****/
var Rocher = /*#__PURE__*/function (_Container) {
_inherits(Rocher, _Container);
function Rocher() {
var _this;
var tailleRocher = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : petitRocher;
var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RoadZone.width / 2;
var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : RoadZone.height / 2;
_classCallCheck(this, Rocher);
_this = _callSuper(this, Rocher);
_this.name = "rocher";
_this.dxHotLeftSpot = petitRocherDxHotLeft;
_this.dyHotLeftSpot = petitRocherDyHotLeft;
_this.dxHotRightSpot = petitRocherDxHotRight;
_this.dyHotRightSpot = petitRocherDyHotRight;
_this.isBeingPushed = false;
_this.vitesse = 0.0;
_this.pushedByHuman = null;
_this.pushedByOrdi = null;
_this.totalPushers = 0;
var rocher_petit_sprite = _this.attachAsset('small_rock', {
anchorX: 0.5,
anchorY: 0.5
});
var rocher_moyen_sprite = _this.attachAsset('medium_rock', {
anchorX: 0.5,
anchorY: 0.5
});
var rocher_gros_sprite = _this.attachAsset('large_rock', {
anchorX: 0.5,
anchorY: 0.5
});
_this.tailleRocher = tailleRocher;
if (_this.tailleRocher == petitRocher) {
_this.sprite = rocher_petit_sprite;
}
if (_this.tailleRocher == moyenRocher) {
_this.sprite = rocher_moyen_sprite;
}
if (_this.tailleRocher == grosRocher) {
_this.sprite = rocher_gros_sprite;
}
_this.sprite.x = x;
_this.sprite.y = y;
_this.sprite.anchor.set(0.5);
_this.sprite.scale.set(1.0);
if (_this.tailleRocher == petitRocher) {
_this.dxHotLeftSpot = petitRocherDxHotLeft;
_this.dyHotLeftSpot = petitRocherDyHotLeft;
_this.dxHotRightSpot = petitRocherDxHotRight;
_this.dyHotRightSpot = petitRocherDyHotRight;
}
if (_this.tailleRocher == moyenRocher) {
_this.dxHotLeftSpot = moyenRocherDxHotLeft;
_this.dyHotLeftSpot = moyenRocherDyHotLeft;
_this.dxHotRightSpot = moyenRocherDxHotRight;
_this.dyHotRightSpot = moyenRocherDyHotRight;
}
if (_this.tailleRocher == grosRocher) {
_this.dxHotLeftSpot = grosRocherDxHotLeft;
_this.dyHotLeftSpot = grosRocherDyHotLeft;
_this.dxHotRightSpot = grosRocherDxHotRight;
_this.dyHotRightSpot = grosRocherDyHotRight;
}
if (_this.tailleRocher == petitRocher) {
_this.name = "Petit Rocher";
}
if (_this.tailleRocher == moyenRocher) {
_this.name = "Moyen Rocher";
}
if (_this.tailleRocher == grosRocher) {
_this.name = "Gros Rocher";
}
return _this;
}
return _createClass(Rocher);
}(Container);
var rochers = generateRandomRock(nbRochers); //création des rochers
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
0. let playersZoneWidth = 200;
1. let ScoreZone = {x: 0, y: 0, width: app.screen.width, height: 200};
2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
- At the start of the game, 10 rocks of three different sizes are randomly placed in the RoadZone.
- Each player has two bulldozers to move the rocks.
- A bulldozer moving without pushing anything has a base speed V.
- When a bulldozer pushes a small rock, the combined speed is V/2.
- When a bulldozer pushes a medium rock, the combined speed is V/4.
- When a bulldozer pushes a large rock, the combined speed is V/8.
- When two bulldozers push a rock together, one behind the other, the pushing speeds are doubled compared to the speed of a single bulldozer.
- The human player clicks on a rock to command the nearest free bulldozer to push it towards the ComputerZone.
- The computer-controlled bulldozers randomly choose a rock and push it towards the HumanZone.
- If a human bulldozer is free, the player can click on a rock already being pushed to have the bulldozer move behind the first one and push the rock faster.
- It is possible to push a rock that is being pushed by the opponent to block or slow down its movement. If a second bulldozer is added in this situation, the rock will be pushed in the direction where there are fewer bulldozers.
- The game ends when all rocks have been moved out of the RoadZone. The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone.
- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same. Effective strategy and skillful bulldozer management are necessary to maximize the score.
There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their bulldozers to win the game.
*/
//PARAMETRES DIVERS DU JEU
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) {
descriptor.writable = true;
}
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) {
_defineProperties(Constructor.prototype, protoProps);
}
if (staticProps) {
_defineProperties(Constructor, staticProps);
}
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : String(i);
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) {
return t;
}
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) {
return i;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _callSuper(t, o, e) {
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
return !!t;
})();
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) {
_setPrototypeOf(subClass, superClass);
}
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
var nbRochers = 10; //nombre de rochers
var vitesseBuldo = 8.0; //vitesse de déplacement des buldos a vide, vitesse/2 quand ils poussent un petit rocher, vitesse/4 pour un moyen, vitesse/8 pour un gros
var humanCamp = 1; //camp du joueur humain
var ordiCamp = -1; //camp du joueur ordinateur
var ancrageMedian = 0.5; //ancrage median des sprites
var buldoRockHotSpotX = 35; //hotspot X du sprite buldoRock, offset du sprite par rapport à l'ancrage
var buldoRockHotSpotY = 0; //hotspot Y du sprite buldoRock
var buldoRockBkHotSpotX = -40; //hotspot arriere du buldoRock
var buldoRockBkHotSpotY = 0;
var buldoZerHotSpotX = -35; //hotspot X du sprite buldoZer, offset du sprite par rapport à l'ancrage
var buldoZerHotSpotY = 0; //hotspot Y du sprite buldoZer
var buldoZerBkHotSpotX = 35; //hotspot arriere du buldoZer
var buldoZerBkHotSpotY = 0;
var petitRocher = 2; //taille du rocher (2=petit, 4=moyen, 8=gros)
var petitRocherDxHotLeft = -16; //hotspot X du sprite petitRocher, offset du sprite par rapport à l'ancrage
var petitRocherDyHotLeft = 0; //hotspot Y du sprite petitRocher
var petitRocherDxHotRight = 20; //hotspot X du sprite petitRocher, offset du sprite par rapport à l'ancrage
var petitRocherDyHotRight = 0; //hotspot Y du sprite petitRocher
var moyenRocher = 4; //taille du rocher (2=petit, 4=moyen, 8=gros)
var moyenRocherDxHotLeft = -35; //hotspot X du sprite moyenRocher, offset du sprite par rapport à l'ancrage
var moyenRocherDyHotLeft = 0; //hotspot Y du sprite moyenRocher
var moyenRocherDxHotRight = 15; //hotspot X du sprite moyenRocher, offset du sprite par rapport à l'ancrage
var moyenRocherDyHotRight = 0; //hotspot Y du sprite moyenRocher
var grosRocher = 8; //taille du rocher (2=petit, 4=moyen, 8=gros)
var grosRocherDxHotLeft = -40; //hotspot X du sprite grosRocher, offset du sprite par rapport à l'ancrage
var grosRocherDyHotLeft = 0; //hotspot Y du sprite grosRocher
var grosRocherDxHotRight = 45; //hotspot X du sprite grosRocher, offset du sprite par rapport à l'ancrage
var grosRocherDyHotRight = 0; //hotspot Y du sprite grosRocher
var typeRotation = 1; //Type 1 = rotation
var typeLigneHtoX = 2; //Type 2 = déplacement horizontal vers une position X
var typeLigneVtoY = 3; //Type 3 = déplacement vertical vers une position Y
// Track the currently selected BulldoRock
var selectedBulldoRock = null;
// Game Zones
var ScoreZone = {
x: 0,
y: 0,
width: game.width,
height: 200
};
var OptionsZone = {
x: 0,
y: game.height - 200,
width: game.width,
height: 200
};
var humanZoneInstance = new HumanZone();
game.addChild(humanZoneInstance);
var computerZoneInstance = new ComputerZone();
game.addChild(computerZoneInstance);
var playersZoneWidth = 200;
var RoadZone = {
x: playersZoneWidth,
y: 200,
width: game.width - playersZoneWidth * 2,
height: game.height - OptionsZone.height - ScoreZone.height
};
var roadZoneInstance = new RoadZone();
game.addChild(roadZoneInstance);
var optionsZoneInstance = new OptionsZone();
game.addChild(optionsZoneInstance);
var scoreZoneInstance = new ScoreZone();
game.addChild(scoreZoneInstance);
var humanZoneInstance = new HumanZone();
game.addChild(humanZoneInstance);
var scoreZoneInstance = new ScoreZone();
game.addChild(scoreZoneInstance);
LK.on('tick', function () {
// The graphics are already initialized and drawn in the HumanZone class constructor
// No need to clear and redraw every tick
});
function generateRandomRock(nombreRochers) {
//Calcul de positions aléatoire pour les rochers dans la zone de route
// Define RoadZone with correct dimensions before using it
var RoadZone = {
x: playersZoneWidth,
y: 200,
width: game.width - humanZoneInstance.width - computerZoneInstance.width,
height: game.height - OptionsZone.height - ScoreZone.height
};
var zoneMiniy = RoadZone.y;
var zoneMaxiy = RoadZone.y + RoadZone.height;
//Calcul des ordonnees possibles pour les rochers entre zoneMiniy + 50 et zoneMaxiy - 50
var ordonneesPossibles = [];
for (var i = zoneMiniy + 50; i < zoneMaxiy - 50; i += 100) {
ordonneesPossibles.push(i);
}
//Securite : si le nombre de rochers demande est superieur au nombre d'ordonnees possibles, on ajuste le nombre de rochers
if (nombreRochers > ordonneesPossibles.length) {
nombreRochers = ordonneesPossibles.length;
}
var rochers = [];
//Creation des rochers
for (var i = 0; i < nombreRochers; i++) {
// Choisir une taille de rocher aléatoire
var sizes = [petitRocher, moyenRocher, grosRocher];
var size = sizes[Math.floor(Math.random() * sizes.length)];
// Choisir une abscisse aléatoire pour le rocher
var zoneMinix = RoadZone.x + 100;
var zoneMaxix = RoadZone.x + RoadZone.width - 100;
var x = Math.random() * (zoneMaxix - zoneMinix) + zoneMinix;
//Choix d'une ordonnee aleatoire en supprimant l'ordonnee choisie precedemment
var index = Math.floor(Math.random() * ordonneesPossibles.length);
var y = ordonneesPossibles[index];
ordonneesPossibles.splice(index, 1);
// Créer le rocher
var rock = new Rocher(size, x, y);
rochers.push(rock);
}
return rochers;
} //fin generateRandomRock
A small rock
a rock without any shadow and four time smaller than the original.
Blue color
a rock is being crunched so there is smoke and peaces of rocks viewed from top.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Un trophée de victoire sous forme d'une coupe d'où s'échappe un feu d'artifice.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Red bulldozer viewed strictly from top. Top view as if we are a drone.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Remove yellow lines.