/**** * Classes ****/ var Button = Container.expand(function (onPress, size, text) { var self = Container.call(this); self.onPress = onPress; self.isPressed = false; var background = self.attachAsset('buttonBackground', { width: size, height: size }); var backgroundPressed = self.attachAsset('buttonBackgroundPressed', { visible: false, width: size, height: size }); var buttonText = new Text2(text, { size: size / 5, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); buttonText.x = size / 2; buttonText.y = size / 2; self.addChild(buttonText); self.down = function (x, y, obj) { self.isPressed = true; background.visible = false; backgroundPressed.visible = true; currentButton = self; if (self.onPress) { self.onPress(); } }; self.up = function (x, y, obj) { self.isPressed = false; background.visible = true; backgroundPressed.visible = false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x83C7FF }); /**** * Game Code ****/ game.attachAsset('waterBackground', {}); ; // Create add fish button var addFishButton = new Button(function () { // Function to add a fish will be implemented when fish spawning is added console.log("Add fish button pressed"); }, 400, "Add Fish"); // Position button in bottom left with margin addFishButton.x = 2048 - 250; addFishButton.y = 2732 - 250; game.addChild(addFishButton);
===================================================================
--- original.js
+++ change.js
@@ -54,9 +54,9 @@
// Create add fish button
var addFishButton = new Button(function () {
// Function to add a fish will be implemented when fish spawning is added
console.log("Add fish button pressed");
-}, 150, "Add Fish");
+}, 400, "Add Fish");
// Position button in bottom left with margin
-addFishButton.x = 100;
+addFishButton.x = 2048 - 250;
addFishButton.y = 2732 - 250;
game.addChild(addFishButton);
\ No newline at end of file