===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,15 @@
/****
* Classes
****/
+// Define the Floor class
+var Floor = Container.expand(function () {
+ var self = Container.call(this);
+ var floorGraphics = self.attachAsset('floor', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+});
// Define the Obstacle class
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
@@ -67,8 +75,12 @@
// Initialize game variables
game.groundLevel = 2500;
game.obstacles = [];
game.score = 0;
+// Create floor instance
+var floor = game.addChild(new Floor());
+floor.x = 2048 / 2;
+floor.y = game.groundLevel + 25; // Adjust y position to align with ground level
// Create player instance
var player = game.addChild(new Player());
player.x = 200;
player.y = game.groundLevel;