User prompt
online skor tablosu ekler misin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
ARAKAYA ŞARKI KOY
User prompt
MENÜDEKİ ÇUNUKLARI SİL
User prompt
MENÜDE KAÇ WİN ALSIĞIN YAZSIN ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
KEMALDEV YAZISINA 2 KERE BASARSAN WİN AL
User prompt
Add anything you want to the game ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menu gta 2 style ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menu gta 2 style ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
3 adet daha hero ekle
User prompt
Oyun ekranını biraz aşağı al ortala
User prompt
LOGADA OLSUN BAŞTA ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
KEMALDEV WRITE BEFORE THE MENU WHEN THE GAME STARTS ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
LET IT BE WRITE KEMALDEV AND THEN IT BE THE LOGO
User prompt
Let the game be fun and fluent ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Uncaught ReferenceError: scoreText is not defined' in or related to this line: 'scoreText.setText('Score: ' + LK.getScore());' Line Number: 273
User prompt
Game not showing fix
User prompt
make the menu visible
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'if (grid[y][x] === null) {' Line Number: 227
User prompt
Add menu
User prompt
remove the numbers from the heroes
Code edit (1 edits merged)
Please save this source code
Initial prompt
Hero Fusion Academy
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Hero = Container.expand(function (tier) { var self = Container.call(this); self.tier = tier || 1; self.gridX = -1; self.gridY = -1; self.isDragging = false; self.originalX = 0; self.originalY = 0; var heroAssets = ['heroTier1', 'heroTier2', 'heroTier3', 'heroTier4', 'heroTier5', 'heroTier6']; var heroGraphics = self.attachAsset(heroAssets[self.tier - 1], { anchorX: 0.5, anchorY: 0.5 }); // Tier text removed - heroes now display without numbers self.setGridPosition = function (gridX, gridY) { self.gridX = gridX; self.gridY = gridY; self.x = GRID_START_X + gridX * CELL_SIZE + CELL_SIZE / 2; self.y = GRID_START_Y + gridY * CELL_SIZE + CELL_SIZE / 2; self.originalX = self.x; self.originalY = self.y; }; self.down = function (x, y, obj) { if (!gameOver) { self.isDragging = true; draggedHero = self; self.originalX = self.x; self.originalY = self.y; tween(self, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100 }); } }; self.up = function (x, y, obj) { if (self.isDragging) { self.isDragging = false; draggedHero = null; tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); // Check for merge var targetGridX = Math.floor((self.x - GRID_START_X) / CELL_SIZE); var targetGridY = Math.floor((self.y - GRID_START_Y) / CELL_SIZE); if (targetGridX >= 0 && targetGridX < GRID_WIDTH && targetGridY >= 0 && targetGridY < GRID_HEIGHT) { var targetHero = grid[targetGridY][targetGridX]; if (targetHero && targetHero !== self && targetHero.tier === self.tier) { // Merge! performMerge(self, targetHero); return; } } // Return to original position tween(self, { x: self.originalX, y: self.originalY }, { duration: 200 }); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ var GRID_WIDTH = 5; var GRID_HEIGHT = 7; var CELL_SIZE = 140; var GRID_START_X = (2048 - GRID_WIDTH * CELL_SIZE) / 2; var GRID_START_Y = 400; var grid = []; var heroes = []; var draggedHero = null; var gameOver = false; var gameStarted = false; var spawnTimer = 0; var spawnInterval = 180; // 3 seconds at 60fps var menuContainer = null; function showMainMenu() { menuContainer = new Container(); game.addChild(menuContainer); // Menu background var menuBg = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5, scaleX: 15, scaleY: 20 }); menuBg.x = 2048 / 2; menuBg.y = 2732 / 2; menuBg.alpha = 0.8; menuContainer.addChild(menuBg); // Game title var gameTitle = new Text2('Hero Fusion Academy', { size: 140, fill: 0xFFD700 }); gameTitle.anchor.set(0.5, 0.5); gameTitle.x = 2048 / 2; gameTitle.y = 1200; menuContainer.addChild(gameTitle); // Subtitle var subtitle = new Text2('Merge identical heroes to create powerful champions!', { size: 80, fill: 0xFFFFFF }); subtitle.anchor.set(0.5, 0.5); subtitle.x = 2048 / 2; subtitle.y = 1400; menuContainer.addChild(subtitle); // Start button var startButton = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5, scaleX: 3, scaleY: 1.2 }); startButton.x = 2048 / 2; startButton.y = 1800; startButton.alpha = 0.9; menuContainer.addChild(startButton); var startButtonText = new Text2('START GAME', { size: 100, fill: 0xFFFFFF }); startButtonText.anchor.set(0.5, 0.5); startButtonText.x = 2048 / 2; startButtonText.y = 1800; menuContainer.addChild(startButtonText); // Button interaction startButton.down = function () { startGame(); }; } function startGame() { if (menuContainer) { menuContainer.destroy(); menuContainer = null; } gameStarted = true; initializeGame(); } function initializeGame() { // Initialize grid for (var y = 0; y < GRID_HEIGHT; y++) { grid[y] = []; for (var x = 0; x < GRID_WIDTH; x++) { grid[y][x] = null; // Create grid cell visuals var cell = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); cell.x = GRID_START_X + x * CELL_SIZE + CELL_SIZE / 2; cell.y = GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2; cell.alpha = 0.3; game.addChild(cell); } } // Score display var scoreText = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Title var titleText = new Text2('Hero Fusion Academy', { size: 100, fill: 0xFFD700 }); titleText.anchor.set(0.5, 0); titleText.x = 2048 / 2; titleText.y = 150; game.addChild(titleText); // Instructions var instructionText = new Text2('Drag matching heroes to merge them!', { size: 60, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0); instructionText.x = 2048 / 2; instructionText.y = 250; game.addChild(instructionText); // Show main menu on game start showMainMenu(); } function getEmptyCell() { var emptyCells = []; for (var y = 0; y < GRID_HEIGHT; y++) { for (var x = 0; x < GRID_WIDTH; x++) { if (grid[y][x] === null) { emptyCells.push({ x: x, y: y }); } } } return emptyCells.length > 0 ? emptyCells[Math.floor(Math.random() * emptyCells.length)] : null; } function spawnHero() { var emptyCell = getEmptyCell(); if (emptyCell) { var tier = Math.random() < 0.8 ? 1 : 2; // 80% chance for tier 1, 20% for tier 2 var hero = new Hero(tier); hero.setGridPosition(emptyCell.x, emptyCell.y); grid[emptyCell.y][emptyCell.x] = hero; heroes.push(hero); game.addChild(hero); // Spawn animation hero.scaleX = 0; hero.scaleY = 0; tween(hero, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut }); LK.getSound('spawn').play(); } else { // Grid is full - game over gameOver = true; LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } function performMerge(hero1, hero2) { if (hero1.tier >= 6) return; // Max tier reached // Calculate score based on tier var scoreIncrease = hero1.tier * 100; LK.setScore(LK.getScore() + scoreIncrease); scoreText.setText('Score: ' + LK.getScore()); // Remove both heroes from grid grid[hero1.gridY][hero1.gridX] = null; grid[hero2.gridY][hero2.gridX] = null; // Create new hero with higher tier var newHero = new Hero(hero1.tier + 1); newHero.setGridPosition(hero2.gridX, hero2.gridY); grid[hero2.gridY][hero2.gridX] = newHero; heroes.push(newHero); game.addChild(newHero); // Merge animation newHero.scaleX = 0; newHero.scaleY = 0; tween(newHero, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut }); tween(newHero, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); // Flash effect LK.effects.flashObject(newHero, 0xFFFFFF, 500); // Remove old heroes hero1.destroy(); hero2.destroy(); // Remove from heroes array var index1 = heroes.indexOf(hero1); if (index1 > -1) heroes.splice(index1, 1); var index2 = heroes.indexOf(hero2); if (index2 > -1) heroes.splice(index2, 1); LK.getSound('merge').play(); // Check for win condition (tier 6 hero created) if (newHero.tier >= 6) { LK.setTimeout(function () { LK.showYouWin(); }, 1000); } } game.move = function (x, y, obj) { if (draggedHero && draggedHero.isDragging) { draggedHero.x = x; draggedHero.y = y; } }; game.update = function () { if (gameStarted && !gameOver) { spawnTimer++; if (spawnTimer >= spawnInterval) { spawnHero(); spawnTimer = 0; // Gradually decrease spawn interval to increase difficulty if (spawnInterval > 120) { spawnInterval -= 2; } } } }; // Spawn initial heroes spawnHero(); spawnHero();
===================================================================
--- original.js
+++ change.js
@@ -93,51 +93,121 @@
var grid = [];
var heroes = [];
var draggedHero = null;
var gameOver = false;
+var gameStarted = false;
var spawnTimer = 0;
var spawnInterval = 180; // 3 seconds at 60fps
-// Initialize grid
-for (var y = 0; y < GRID_HEIGHT; y++) {
- grid[y] = [];
- for (var x = 0; x < GRID_WIDTH; x++) {
- grid[y][x] = null;
- // Create grid cell visuals
- var cell = LK.getAsset('gridCell', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- cell.x = GRID_START_X + x * CELL_SIZE + CELL_SIZE / 2;
- cell.y = GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2;
- cell.alpha = 0.3;
- game.addChild(cell);
+var menuContainer = null;
+function showMainMenu() {
+ menuContainer = new Container();
+ game.addChild(menuContainer);
+ // Menu background
+ var menuBg = LK.getAsset('gridCell', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 15,
+ scaleY: 20
+ });
+ menuBg.x = 2048 / 2;
+ menuBg.y = 2732 / 2;
+ menuBg.alpha = 0.8;
+ menuContainer.addChild(menuBg);
+ // Game title
+ var gameTitle = new Text2('Hero Fusion Academy', {
+ size: 140,
+ fill: 0xFFD700
+ });
+ gameTitle.anchor.set(0.5, 0.5);
+ gameTitle.x = 2048 / 2;
+ gameTitle.y = 1200;
+ menuContainer.addChild(gameTitle);
+ // Subtitle
+ var subtitle = new Text2('Merge identical heroes to create powerful champions!', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ subtitle.anchor.set(0.5, 0.5);
+ subtitle.x = 2048 / 2;
+ subtitle.y = 1400;
+ menuContainer.addChild(subtitle);
+ // Start button
+ var startButton = LK.getAsset('gridCell', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 3,
+ scaleY: 1.2
+ });
+ startButton.x = 2048 / 2;
+ startButton.y = 1800;
+ startButton.alpha = 0.9;
+ menuContainer.addChild(startButton);
+ var startButtonText = new Text2('START GAME', {
+ size: 100,
+ fill: 0xFFFFFF
+ });
+ startButtonText.anchor.set(0.5, 0.5);
+ startButtonText.x = 2048 / 2;
+ startButtonText.y = 1800;
+ menuContainer.addChild(startButtonText);
+ // Button interaction
+ startButton.down = function () {
+ startGame();
+ };
+}
+function startGame() {
+ if (menuContainer) {
+ menuContainer.destroy();
+ menuContainer = null;
}
+ gameStarted = true;
+ initializeGame();
}
-// Score display
-var scoreText = new Text2('Score: 0', {
- size: 80,
- fill: 0xFFFFFF
-});
-scoreText.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreText);
-// Title
-var titleText = new Text2('Hero Fusion Academy', {
- size: 100,
- fill: 0xFFD700
-});
-titleText.anchor.set(0.5, 0);
-titleText.x = 2048 / 2;
-titleText.y = 150;
-game.addChild(titleText);
-// Instructions
-var instructionText = new Text2('Drag matching heroes to merge them!', {
- size: 60,
- fill: 0xFFFFFF
-});
-instructionText.anchor.set(0.5, 0);
-instructionText.x = 2048 / 2;
-instructionText.y = 250;
-game.addChild(instructionText);
+function initializeGame() {
+ // Initialize grid
+ for (var y = 0; y < GRID_HEIGHT; y++) {
+ grid[y] = [];
+ for (var x = 0; x < GRID_WIDTH; x++) {
+ grid[y][x] = null;
+ // Create grid cell visuals
+ var cell = LK.getAsset('gridCell', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ cell.x = GRID_START_X + x * CELL_SIZE + CELL_SIZE / 2;
+ cell.y = GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2;
+ cell.alpha = 0.3;
+ game.addChild(cell);
+ }
+ }
+ // Score display
+ var scoreText = new Text2('Score: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ scoreText.anchor.set(0.5, 0);
+ LK.gui.top.addChild(scoreText);
+ // Title
+ var titleText = new Text2('Hero Fusion Academy', {
+ size: 100,
+ fill: 0xFFD700
+ });
+ titleText.anchor.set(0.5, 0);
+ titleText.x = 2048 / 2;
+ titleText.y = 150;
+ game.addChild(titleText);
+ // Instructions
+ var instructionText = new Text2('Drag matching heroes to merge them!', {
+ size: 60,
+ fill: 0xFFFFFF
+ });
+ instructionText.anchor.set(0.5, 0);
+ instructionText.x = 2048 / 2;
+ instructionText.y = 250;
+ game.addChild(instructionText);
+ // Show main menu on game start
+ showMainMenu();
+}
function getEmptyCell() {
var emptyCells = [];
for (var y = 0; y < GRID_HEIGHT; y++) {
for (var x = 0; x < GRID_WIDTH; x++) {
@@ -235,9 +305,9 @@
draggedHero.y = y;
}
};
game.update = function () {
- if (!gameOver) {
+ if (gameStarted && !gameOver) {
spawnTimer++;
if (spawnTimer >= spawnInterval) {
spawnHero();
spawnTimer = 0;
pixel art Hulk. In-Game asset. 2d. High contrast. No shadows
attack on titan colossal titan pixel art. In-Game asset. 2d. High contrast. No shadows
KANEKİ PİXEL ART GHOUL. In-Game asset. 2d. High contrast. No shadows
PİXEL ART SİLVER SURFER. In-Game asset. 2d. High contrast. No shadows
Pixel art
pixel art red gurdian. In-Game asset. 2d. High contrast. No shadows
pixel art Hero. In-Game asset. 2d. High contrast. No shadows
PNG