User prompt
L'abeille ne doit pas tomber de la plateforme de l'araigneĢe quand le combat se lance
User prompt
L'abeille ne doit pas tomber de la plateforme de l'araigneĢe quand l'araigneĢe se pousse
User prompt
L'araigneĢe doit se pousser quand l'abeille arrive sur la meĢme plateforme quelle, avant que se lance le combat entre les deux
User prompt
L'abeille ne doit pas tomber lorsqu'elle rejoint la plateforme cliqueĢ (qu'elle soit vers le haut, le bas et meĢme celle de l'araigneĢe)
User prompt
L'abeille doit pouvoir voler vers le haut quand l'utilisateur tape sur une plateforme, l'abeille doit rejoindre la plateforme en question
User prompt
L'abeille doit pouvoir eĢtre glisser vers le haut, le bas et sur les plateformes du choix du joueur, et l'abeille doit eĢtre sur une plateforme lors du deĢmarrage du jeu , cela lui permettra d'avancer
User prompt
Ajoute une fonctionnaliteĢ pour que le joueur puisse deĢplacer l'abeille vers le haut, et la faire sauter
User prompt
Ajoute une fonctionnaliteĢ pour que le joueur puisse deĢplacer son abeille dans le vide, en appuyant sur l'eĢcran pour la remettre sur une plateforme
User prompt
Ajoute une fonctionnaliteĢ pour que l'abeille saute a la plateforme la plus proche lorsqu'elle se retrouve dans le vide āŖš” Consider importing and using the following plugins: @upit/tween.v1
User prompt
Le joueur doit pouvoir faire sauter et bouger son abeille sur la plateforme en appuyant sur son eĢcran
User prompt
Ajoute une fonctionnaliteĢ pour que le joueur puisse bouger et faire avancer son abeille en appuyant sur l'eĢcran
Code edit (1 edits merged)
Please save this source code
User prompt
Bee vs Spiders: Platform Battle
Initial prompt
CreĢe ce jeu : --- **Titre** : *Abeille vs AraigneĢes* **Genre** : Jeu de plateforme avec combat au tour par tour **Description** : Dans ce jeu de plateforme, l'objectif est de guider une abeille aĢ travers plusieurs niveaux semeĢs d'araigneĢes. Le joueur doit faire avancer l'abeille jusqu'aĢ la ligne d'arriveĢe en traversant des plateformes tout en combattant les araigneĢes rencontreĢes sur le chemin. ### MeĢcaniques de Jeu : 1. **DeĢplacement de l'abeille** : - L'abeille se deĢplace automatiquement sur les plateformes, mais le joueur peut la controĢler aĢ lāaide des fleĢches directionnelles ou des touches (par exemple, *fleĢche droite* pour avancer et *fleĢche gauche* pour reculer). - Si l'abeille touche une araigneĢe, un combat commence. 2. **Combat au tour par tour** : - Lorsqu'une araigneĢe est rencontreĢe, un combat s'engage entre l'abeille et l'araigneĢe. - **Points de vie** : L'abeille et l'araigneĢe commencent avec 50 points de vie chacun. - **Attaque de l'araigneĢe** : L'araigneĢe attaque automatiquement aĢ chaque tour. - **Attaque de l'abeille** : Le joueur doit appuyer sur un bouton ("Attaquer") pour faire attaquer l'abeille. - Le combat est reĢsolu en alternance : l'araigneĢe attaque, puis le joueur peut faire attaquer l'abeille. Cela continue jusqu'aĢ ce que l'un des deux perde tous ses points de vie. 3. **ConseĢquences du combat** : - **Si l'abeille gagne** : L'araigneĢe est eĢlimineĢe, et l'abeille peut continuer aĢ avancer sur la plateforme. - **Si l'araigneĢe gagne** : L'abeille perd et doit recommencer le niveau aĢ partir du deĢbut de la plateforme. 4. **Niveaux** : - **Niveau 1** : 5 araigneĢes aĢ affronter avant d'atteindre la ligne d'arriveĢe. - **Niveaux 2 aĢ 3** : 8 araigneĢes aĢ affronter. - **Niveaux 4 aĢ 5** : 10 araigneĢes aĢ affronter. - **Niveau 6** : 13 araigneĢes aĢ affronter. - **Niveaux 7 aĢ 9** : 15 araigneĢes aĢ affronter. - **Niveau 10** : 20 araigneĢes aĢ affronter. 5. **Objectif** : L'objectif est de faire avancer l'abeille jusqu'aĢ la ligne d'arriveĢe aĢ la fin de chaque niveau. Chaque niveau devient plus difficile en raison de l'augmentation du nombre d'araigneĢes aĢ combattre. 6. **Progression de Niveau** : - Chaque fois que le joueur finit un niveau, il passe au suivant avec un nombre accru d'araigneĢes. - AĢ la fin du **niveau 10**, un message de feĢlicitations s'affiche : *"FeĢlicitations ! Tu as gagneĢ le jeu ! AĢ bientoĢt pour d'autres jeux de clem27games."* ### DeĢtails Techniques : - **Graphismes** : L'abeille et les araigneĢes doivent eĢtre dessineĢes dans un style simple et mignon. La plateforme devrait eĢtre un environnement naturel (par exemple, des branches, des fleurs, etc.), et les araigneĢes devraient apparaiĢtre sur la plateforme aĢ diffeĢrents endroits. - **ControĢles** : - FleĢches directionnelles pour deĢplacer l'abeille. - Espace ou un bouton speĢcifique pour faire attaquer l'abeille. - **Combat** : - Chaque personnage (abeille et araigneĢe) aura une barre de vie afficheĢe aĢ l'eĢcran. - Les attaques doivent eĢtre simples et visuellement distinctes pour chaque personnage. - Un son ou une animation de frappe peut eĢtre ajouteĢ lorsque lāabeille ou lāaraigneĢe attaque. - **EĢcran de Fin** : - Un message sāaffiche aĢ la fin du niveau 10 : *"FeĢlicitations ! Tu as gagneĢ le jeu ! AĢ bientoĢt pour d'autres jeux de clem27games."* - L'eĢcran de victoire pourrait inclure une animation ou un effet visuel pour rendre lāexpeĢrience de victoire plus immersive.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { currentLevel: 1 }); /**** * Classes ****/ var BattleUI = Container.expand(function () { var self = Container.call(this); var panel = self.attachAsset('battlePanel', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); var attackBtn = self.attachAsset('attackButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 200 }); self.beeHealthBar = self.attachAsset('healthBar', { anchorX: 0, anchorY: 0.5, x: -300, y: -150 }); self.spiderHealthBar = self.attachAsset('healthBar', { anchorX: 0, anchorY: 0.5, x: 0, y: -150 }); var beeHealthText = new Text2("Bee: 100/100", { size: 40, fill: 0xFFFFFF }); beeHealthText.anchor.set(0, 0.5); beeHealthText.x = -300; beeHealthText.y = -200; self.addChild(beeHealthText); var spiderHealthText = new Text2("Spider: 50/50", { size: 40, fill: 0xFFFFFF }); spiderHealthText.anchor.set(0, 0.5); spiderHealthText.x = 0; spiderHealthText.y = -200; self.addChild(spiderHealthText); var turnText = new Text2("Your Turn", { size: 60, fill: 0xFFFFFF }); turnText.anchor.set(0.5, 0.5); turnText.y = -300; self.addChild(turnText); var attackText = new Text2("Attack", { size: 50, fill: 0xFFFFFF }); attackText.anchor.set(0.5, 0.5); attackText.x = 0; attackText.y = 200; self.addChild(attackText); self.updateHealth = function (beeHealth, beeMaxHealth, spiderHealth, spiderMaxHealth) { // Update health bars self.beeHealthBar.scale.x = beeHealth / beeMaxHealth; self.spiderHealthBar.scale.x = spiderHealth / spiderMaxHealth; // Update text beeHealthText.setText("Bee: " + beeHealth + "/" + beeMaxHealth); spiderHealthText.setText("Spider: " + spiderHealth + "/" + spiderMaxHealth); }; self.setTurnText = function (isPlayerTurn) { turnText.setText(isPlayerTurn ? "Your Turn" : "Spider's Turn"); }; self.down = function (x, y, obj) { // Check if attack button was pressed if (x >= attackBtn.x - attackBtn.width / 2 && x <= attackBtn.x + attackBtn.width / 2 && y >= attackBtn.y - attackBtn.height / 2 && y <= attackBtn.y + attackBtn.height / 2) { if (self.onAttackPressed && game.battleState.isPlayerTurn) { self.onAttackPressed(); } } }; return self; }); var Bee = Container.expand(function () { var self = Container.call(this); var beeGraphic = self.attachAsset('bee', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.speed = 8; self.jumpForce = -20; self.gravity = 1; self.onGround = false; self.health = 100; self.maxHealth = 100; self.isJumping = false; self.fallingInVoid = false; self.update = function () { // Apply gravity if (!self.onGround) { self.velocityY += self.gravity; } // Update position self.x += self.velocityX; self.y += self.velocityY; // Reset onGround flag for next frame collision detection self.onGround = false; }; self.moveUp = function () { // Only allow moving up when not jumping if (!self.isJumping) { self.velocityY = -self.speed * 0.8; // Slower than horizontal movement } }; self.jump = function () { if (self.onGround) { self.velocityY = self.jumpForce; self.onGround = false; self.isJumping = true; LK.getSound('jump').play(); } }; self.moveLeft = function () { self.velocityX = -self.speed; }; self.moveRight = function () { self.velocityX = self.speed; }; self.stopMoving = function () { self.velocityX = 0; }; self.takeDamage = function (amount) { self.health -= amount; if (self.health < 0) { self.health = 0; } LK.getSound('hurt').play(); }; self.heal = function (amount) { self.health += amount; if (self.health > self.maxHealth) { self.health = self.maxHealth; } }; return self; }); var ControlsUI = Container.expand(function () { var self = Container.call(this); // Left button var leftBtn = self.attachAsset('attackButton', { anchorX: 0.5, anchorY: 0.5, x: -800, y: 0, tint: 0x0000FF }); var leftText = new Text2("<", { size: 80, fill: 0xFFFFFF }); leftText.anchor.set(0.5, 0.5); leftText.x = -800; self.addChild(leftText); // Right button var rightBtn = self.attachAsset('attackButton', { anchorX: 0.5, anchorY: 0.5, x: -400, y: 0, tint: 0x0000FF }); var rightText = new Text2(">", { size: 80, fill: 0xFFFFFF }); rightText.anchor.set(0.5, 0.5); rightText.x = -400; self.addChild(rightText); // Jump button var jumpBtn = self.attachAsset('attackButton', { anchorX: 0.5, anchorY: 0.5, x: 800, y: 0, tint: 0x00FF00 }); var jumpText = new Text2("Jump", { size: 50, fill: 0xFFFFFF }); jumpText.anchor.set(0.5, 0.5); jumpText.x = 800; self.addChild(jumpText); // Up button var upBtn = self.attachAsset('attackButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -80, tint: 0x0099FF }); var upText = new Text2("Up", { size: 50, fill: 0xFFFFFF }); upText.anchor.set(0.5, 0.5); upText.x = 0; upText.y = -80; self.addChild(upText); self.down = function (x, y, obj) { // Check if left button was pressed if (x >= leftBtn.x - leftBtn.width / 2 && x <= leftBtn.x + leftBtn.width / 2 && y >= leftBtn.y - leftBtn.height / 2 && y <= leftBtn.y + leftBtn.height / 2) { if (self.onLeftPressed) { self.onLeftPressed(); } } // Check if right button was pressed if (x >= rightBtn.x - rightBtn.width / 2 && x <= rightBtn.x + rightBtn.width / 2 && y >= rightBtn.y - rightBtn.height / 2 && y <= rightBtn.y + rightBtn.height / 2) { if (self.onRightPressed) { self.onRightPressed(); } } // Check if jump button was pressed if (x >= jumpBtn.x - jumpBtn.width / 2 && x <= jumpBtn.x + jumpBtn.width / 2 && y >= jumpBtn.y - jumpBtn.height / 2 && y <= jumpBtn.y + jumpBtn.height / 2) { if (self.onJumpPressed) { self.onJumpPressed(); } } // Check if up button was pressed if (x >= upBtn.x - upBtn.width / 2 && x <= upBtn.x + upBtn.width / 2 && y >= upBtn.y - upBtn.height / 2 && y <= upBtn.y + upBtn.height / 2) { if (self.onUpPressed) { self.onUpPressed(); } } }; self.up = function (x, y, obj) { // When buttons are released, stop movement if (self.onControlsReleased) { self.onControlsReleased(); } }; return self; }); var FinishLine = Container.expand(function () { var self = Container.call(this); var finishLineGraphic = self.attachAsset('finishLine', { anchorX: 0.5, anchorY: 0.5 }); self.width = finishLineGraphic.width; self.height = finishLineGraphic.height; return self; }); var Platform = Container.expand(function () { var self = Container.call(this); var platformGraphic = self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); self.width = platformGraphic.width; self.height = platformGraphic.height; return self; }); var Spider = Container.expand(function () { var self = Container.call(this); var spiderGraphic = self.attachAsset('spider', { anchorX: 0.5, anchorY: 0.5 }); self.health = 50; self.maxHealth = 50; self.attackDamage = 15; self.defeated = false; self.takeDamage = function (amount) { self.health -= amount; if (self.health <= 0) { self.health = 0; self.defeated = true; } }; self.attack = function () { return self.attackDamage; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Initialize music // Initialize sounds // Initialize battle UI elements // Initialize finish line // Initialize platform assets // Initialize spider assets // Initialize bee asset // Game state variables var currentLevel = storage.currentLevel || 1; var maxLevels = 10; var gameState = "platform"; // "platform" or "battle" var platforms = []; var spiders = []; var finishLine; var bee; var battleUI; var controlsUI; var levelText; // Battle state game.battleState = { currentSpider: null, isPlayerTurn: true, turnDelay: 1000 // ms }; // Initialize level function initLevel(level) { // Clear existing elements platforms = []; spiders = []; // Remove old elements from game while (game.children.length > 0) { game.removeChild(game.children[0]); } // Create bee bee = new Bee(); bee.x = 150; bee.y = 2732 / 2; game.addChild(bee); // Create platforms based on level var platformCount = 5 + level; var platformWidth = 400; var platformHeight = 30; var minPlatformY = 500; var maxPlatformY = 2732 - 500; var platformSpacing = 2048 / platformCount; for (var i = 0; i < platformCount; i++) { var platform = new Platform(); platform.x = i * platformSpacing + platformSpacing / 2; platform.y = minPlatformY + Math.random() * (maxPlatformY - minPlatformY); platforms.push(platform); game.addChild(platform); } // Create spiders based on level var spiderCount = level; for (var i = 0; i < spiderCount; i++) { var spider = new Spider(); // Position spiders on platforms, starting from the second platform var platformIndex = Math.floor((i + 1) * (platformCount - 1) / spiderCount); spider.x = platforms[platformIndex].x; spider.y = platforms[platformIndex].y - platforms[platformIndex].height / 2 - spider.height / 2; spiders.push(spider); game.addChild(spider); } // Create finish line finishLine = new FinishLine(); finishLine.x = 2048 - 100; finishLine.y = platforms[platformCount - 1].y - platforms[platformCount - 1].height / 2 - finishLine.height / 2; game.addChild(finishLine); // Create controls UI controlsUI = new ControlsUI(); controlsUI.x = 2048 / 2; controlsUI.y = 2732 - 150; LK.gui.addChild(controlsUI); // Set up controls controlsUI.onLeftPressed = function () { bee.moveLeft(); }; controlsUI.onRightPressed = function () { bee.moveRight(); }; controlsUI.onJumpPressed = function () { bee.jump(); }; controlsUI.onUpPressed = function () { bee.moveUp(); }; controlsUI.onControlsReleased = function () { bee.stopMoving(); }; // Create level display text levelText = new Text2("Level: " + currentLevel + "/" + maxLevels, { size: 60, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); // Create score display scoreText = new Text2("Score: " + LK.getScore(), { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); scoreText.x = -50; LK.gui.topRight.addChild(scoreText); // Set game state gameState = "platform"; // Play background music LK.playMusic('gameMusic'); } // Start battle with a spider function startBattle(spider) { gameState = "battle"; game.battleState.currentSpider = spider; game.battleState.isPlayerTurn = true; // Create battle UI battleUI = new BattleUI(); battleUI.x = 2048 / 2; battleUI.y = 2732 / 2; battleUI.updateHealth(bee.health, bee.maxHealth, spider.health, spider.maxHealth); battleUI.setTurnText(true); game.addChild(battleUI); // Set up attack button handler battleUI.onAttackPressed = function () { if (game.battleState.isPlayerTurn) { playerAttack(); } }; } // Player attacks in battle function playerAttack() { var damage = 20 + Math.floor(Math.random() * 10); // 20-29 damage game.battleState.currentSpider.takeDamage(damage); LK.getSound('attack').play(); // Update battle UI battleUI.updateHealth(bee.health, bee.maxHealth, game.battleState.currentSpider.health, game.battleState.currentSpider.maxHealth); // Flash effect on spider LK.effects.flashObject(game.battleState.currentSpider, 0xFF0000, 300); // Check if spider is defeated if (game.battleState.currentSpider.defeated) { LK.setTimeout(function () { endBattle(true); }, 1000); return; } // Switch turns game.battleState.isPlayerTurn = false; battleUI.setTurnText(false); // Spider attacks after delay LK.setTimeout(function () { spiderAttack(); }, game.battleState.turnDelay); } // Spider attacks in battle function spiderAttack() { var damage = game.battleState.currentSpider.attack(); bee.takeDamage(damage); LK.getSound('hurt').play(); // Update battle UI battleUI.updateHealth(bee.health, bee.maxHealth, game.battleState.currentSpider.health, game.battleState.currentSpider.maxHealth); // Flash effect on bee LK.effects.flashObject(bee, 0xFF0000, 300); // Check if bee is defeated if (bee.health <= 0) { LK.setTimeout(function () { endBattle(false); }, 1000); return; } // Switch turns game.battleState.isPlayerTurn = true; battleUI.setTurnText(true); } // End battle function endBattle(playerWon) { // Remove battle UI game.removeChild(battleUI); if (playerWon) { // Mark spider as defeated game.battleState.currentSpider.defeated = true; // Make spider invisible game.battleState.currentSpider.alpha = 0; // Increase score LK.setScore(LK.getScore() + 100); scoreText.setText("Score: " + LK.getScore()); } else { // Game over if player lost LK.showGameOver(); return; } // Return to platform mode gameState = "platform"; } // Complete level function completeLevel() { LK.getSound('levelComplete').play(); // Increase level currentLevel++; storage.currentLevel = currentLevel; // Check if all levels completed if (currentLevel > maxLevels) { LK.showYouWin(); return; } // Initialize next level LK.setTimeout(function () { initLevel(currentLevel); }, 1000); } // Check collision between bee and platform function checkPlatformCollision(bee, platform) { // Simple rectangle collision var beeLeft = bee.x - bee.width / 2; var beeRight = bee.x + bee.width / 2; var beeTop = bee.y - bee.height / 2; var beeBottom = bee.y + bee.height / 2; var platformLeft = platform.x - platform.width / 2; var platformRight = platform.x + platform.width / 2; var platformTop = platform.y - platform.height / 2; var platformBottom = platform.y + platform.height / 2; // Check for collision if (beeRight > platformLeft && beeLeft < platformRight && beeBottom > platformTop && beeTop < platformBottom) { // Check if landing on top of platform if (beeBottom > platformTop && bee.velocityY > 0 && beeTop < platformTop) { bee.y = platformTop - bee.height / 2; bee.velocityY = 0; bee.onGround = true; bee.isJumping = false; return true; } } return false; } // Find and jump to the nearest platform function findAndJumpToNearestPlatform() { var nearestPlatform = null; var shortestDistance = Infinity; // Find the nearest platform for (var i = 0; i < platforms.length; i++) { var platform = platforms[i]; var horizontalDistance = Math.abs(platform.x - bee.x); // Only consider platforms that are reasonably within reach horizontally if (horizontalDistance < 500) { var verticalDistance = platform.y - platform.height / 2 - bee.y; // Prefer platforms slightly above the bee or at the same level var distance = horizontalDistance + (verticalDistance > 0 ? verticalDistance * 2 : Math.abs(verticalDistance) * 0.5); if (distance < shortestDistance) { shortestDistance = distance; nearestPlatform = platform; } } } // If we found a platform, animate jumping to it if (nearestPlatform) { // Stop current movement bee.velocityX = 0; bee.velocityY = 0; // Play jump sound LK.getSound('jump').play(); // Tween to the platform position with a nice arc var targetX = nearestPlatform.x; var targetY = nearestPlatform.y - nearestPlatform.height / 2 - bee.height / 2; // Create an animation that looks like a jump tween(bee, { x: targetX, y: targetY }, { duration: 800, easing: tween.easeOutQuad, onFinish: function onFinish() { bee.onGround = true; bee.isJumping = false; } }); } } // Handle game movement game.move = function (x, y, obj) { // Only process movement in platform mode if (gameState === "platform") { // Check if bee is falling in void and rescue it with any tap if (bee.fallingInVoid) { findAndJumpToNearestPlatform(); return; } // If tap is on the top fifth of the screen, jump if (y < 2732 / 5) { bee.jump(); } // If tap is in the top-mid section of the screen, move up else if (y < 2732 / 3) { bee.moveUp(); } // If tap is on the right half of the screen, move right else if (x > 2048 / 2) { bee.moveRight(); } // If tap is on the left half of the screen, move left else { bee.moveLeft(); } } }; // Initialize first level initLevel(currentLevel); // Handle touch release to stop bee movement game.up = function (x, y, obj) { if (gameState === "platform") { bee.stopMoving(); } }; // Game update loop game.update = function () { // Skip update if in battle mode if (gameState === "battle") { return; } // Update bee bee.update(); // Add visual indication when bee is falling in void if (bee.fallingInVoid) { // Flash the bee to indicate it can be rescued if (LK.ticks % 10 < 5) { bee.alpha = 0.5; } else { bee.alpha = 1.0; } } else { bee.alpha = 1.0; } // Check for platform collisions for (var i = 0; i < platforms.length; i++) { checkPlatformCollision(bee, platforms[i]); } // Check for screen boundaries if (bee.x < bee.width / 2) { bee.x = bee.width / 2; } else if (bee.x > 2048 - bee.width / 2) { bee.x = 2048 - bee.width / 2; } // Check if bee is falling with no platform below if (bee.y > 2732 - 400 && bee.velocityY > 0 && !bee.onGround) { // Set a flag that bee is falling in void to allow rescue by tap bee.fallingInVoid = true; } else if (bee.y > 2732 + bee.height) { // Fell off the screen LK.showGameOver(); return; } else { // Reset falling flag when not in danger zone bee.fallingInVoid = false; } // Check for spider collisions for (var i = 0; i < spiders.length; i++) { if (!spiders[i].defeated && bee.intersects(spiders[i])) { startBattle(spiders[i]); return; } } // Check for finish line collision if (bee.intersects(finishLine)) { // Check if all spiders are defeated var allSpidersDefeated = true; for (var i = 0; i < spiders.length; i++) { if (!spiders[i].defeated) { allSpidersDefeated = false; break; } } if (allSpidersDefeated) { completeLevel(); } } };
===================================================================
--- original.js
+++ change.js
@@ -112,8 +112,14 @@
self.y += self.velocityY;
// Reset onGround flag for next frame collision detection
self.onGround = false;
};
+ self.moveUp = function () {
+ // Only allow moving up when not jumping
+ if (!self.isJumping) {
+ self.velocityY = -self.speed * 0.8; // Slower than horizontal movement
+ }
+ };
self.jump = function () {
if (self.onGround) {
self.velocityY = self.jumpForce;
self.onGround = false;
@@ -191,8 +197,24 @@
});
jumpText.anchor.set(0.5, 0.5);
jumpText.x = 800;
self.addChild(jumpText);
+ // Up button
+ var upBtn = self.attachAsset('attackButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: -80,
+ tint: 0x0099FF
+ });
+ var upText = new Text2("Up", {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ upText.anchor.set(0.5, 0.5);
+ upText.x = 0;
+ upText.y = -80;
+ self.addChild(upText);
self.down = function (x, y, obj) {
// Check if left button was pressed
if (x >= leftBtn.x - leftBtn.width / 2 && x <= leftBtn.x + leftBtn.width / 2 && y >= leftBtn.y - leftBtn.height / 2 && y <= leftBtn.y + leftBtn.height / 2) {
if (self.onLeftPressed) {
@@ -210,8 +232,14 @@
if (self.onJumpPressed) {
self.onJumpPressed();
}
}
+ // Check if up button was pressed
+ if (x >= upBtn.x - upBtn.width / 2 && x <= upBtn.x + upBtn.width / 2 && y >= upBtn.y - upBtn.height / 2 && y <= upBtn.y + upBtn.height / 2) {
+ if (self.onUpPressed) {
+ self.onUpPressed();
+ }
+ }
};
self.up = function (x, y, obj) {
// When buttons are released, stop movement
if (self.onControlsReleased) {
@@ -355,8 +383,11 @@
};
controlsUI.onJumpPressed = function () {
bee.jump();
};
+ controlsUI.onUpPressed = function () {
+ bee.moveUp();
+ };
controlsUI.onControlsReleased = function () {
bee.stopMoving();
};
// Create level display text
@@ -553,12 +584,16 @@
if (bee.fallingInVoid) {
findAndJumpToNearestPlatform();
return;
}
- // If tap is on the top third of the screen, jump
- if (y < 2732 / 3) {
+ // If tap is on the top fifth of the screen, jump
+ if (y < 2732 / 5) {
bee.jump();
}
+ // If tap is in the top-mid section of the screen, move up
+ else if (y < 2732 / 3) {
+ bee.moveUp();
+ }
// If tap is on the right half of the screen, move right
else if (x > 2048 / 2) {
bee.moveRight();
}
tron d'arbre mignon de plateforme. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Abeille. In-Game asset. 2d. High contrast. No shadows
AraigneĢe. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran ruche. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran maiĢs. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran roche. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran campagne. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran nid des araigneĢes. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran foreĢt enchanteĢe. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran muguet. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran roses epineuses. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran prairie manga. In-Game asset. 2d. High contrast. No shadows
Fond d'eĢcran ortis. In-Game asset. 2d. High contrast. No shadows
Frelon. In-Game asset. 2d. High contrast. No shadows
GueĢpe. In-Game asset. 2d. High contrast. No shadows
Libellule. In-Game asset. 2d. High contrast. No shadows
Oiseau. In-Game asset. 2d. High contrast. No shadows