User prompt
que el jugador vaya a donde se de click en la pantalla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ahora coloca arboles aleatorios en todo el mapa
User prompt
que fuera del mapa en las zonas que sobresalen sean del mismo color de el fondo
User prompt
que la camara no vaya mas alla de los arboles del borde del mapa ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que la camara no sobresalga mas alla de los bordes del mapa ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
la camara un poco mas cerca y que la camara no sobresalga mas alla de el mapa ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que la camara este mas cerca de el jugador y lo siga hacia donde se mueva
User prompt
quiero que pongas arboles rodeando todos los bordes
User prompt
crea un mapa grande por el que se pueda mover el jugador pero solo el piso ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el jugador se vea sobre la el fondo
User prompt
quiero que el mapa sea grande pero que no se vea todo en la pantalla y se muestre solo la zona en la que esta el jugador pero que segun el movimiento del jugador la camara lo siga atravez del mapa ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
quiero que hallan edificios silumando una calle por donde el jugador no pueda pasar
User prompt
que el jugador mire primero hacia el destino y se mueva ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que mire directamente hacia el punto que se señala segun el click ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el jugador gire hacia donde se mueve ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el personaje no siga el toque de la pantalla sino que silla el click unico que de haga ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el personaje se mueva mas lento ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
elimina todo y deja solo al jugador en un plano en que pueda moverse de manera vertical y horizontal
User prompt
el jugador aun no va a donde se toca la pantalla
User prompt
que el jugador vaya a donde se toque la pantalla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el jugador se mueva segun en donde se toque la pantalla
Code edit (1 edits merged)
Please save this source code
User prompt
Survivor's Quest
Initial prompt
Quiero hacer un juego de supervivencia en el que tenemos que conseguir recursos y almacenarlos para sobrevivir a través de un escenario por el que podamos movernos vertical y horizontalmente desde un plano de vista de 45 grados.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ // Create large map container that will hold all map elements var mapContainer = game.addChild(new Container()); // Create large map background (4x the screen size) var mapWidth = 8192; // 4x screen width var mapHeight = 10928; // 4x screen height // Create background tiles to fill the large map for (var i = 0; i < mapWidth / 100; i++) { for (var j = 0; j < mapHeight / 100; j++) { var bg = mapContainer.addChild(LK.getAsset('fondo', { anchorX: 0, anchorY: 0 })); bg.x = i * 100; bg.y = j * 100; } } // Add some buildings scattered across the map for (var k = 0; k < 50; k++) { var building = mapContainer.addChild(LK.getAsset(Math.random() > 0.5 ? 'building' : 'building2', { anchorX: 0.5, anchorY: 1 })); building.x = Math.random() * (mapWidth - 600) + 300; building.y = Math.random() * (mapHeight - 800) + 400; } // Create player var player = game.addChild(new Player()); player.x = mapWidth / 2; // Start player at center of large map player.y = mapHeight / 2; // Game controls - touch to move player game.down = function (x, y, obj) { // Convert screen coordinates to world coordinates var worldX = x - mapContainer.x + player.x; var worldY = y - mapContainer.y + player.y; // Calculate angle to face directly toward the clicked point var deltaX = worldX - player.x; var deltaY = worldY - player.y; var targetRotation = Math.atan2(deltaY, deltaX) + Math.PI / 2; // Add 90 degrees to align with sprite orientation // First tween: rotate to face the destination tween(player, { rotation: targetRotation }, { duration: 400, easing: tween.easeOut, onFinish: function onFinish() { // Second tween: move to the destination after rotation is complete tween(player, { x: worldX, y: worldY }, { duration: 800, easing: tween.easeOut }); } }); }; // Main game update loop game.update = function () { // Keep player within map bounds player.x = Math.max(125, Math.min(mapWidth - 125, player.x)); player.y = Math.max(125, Math.min(mapHeight - 125, player.y)); // Camera follows player - center player on screen var targetCameraX = -(player.x - 1024); // Center horizontally var targetCameraY = -(player.y - 1366); // Center vertically // Smooth camera movement using tweening tween.stop(mapContainer, { x: true, y: true }); // Stop any existing camera tweens tween(mapContainer, { x: targetCameraX, y: targetCameraY }, { duration: 100, easing: tween.easeOut }); };
===================================================================
--- original.js
+++ change.js
@@ -6,24 +6,8 @@
/****
* Classes
****/
-var Building = Container.expand(function () {
- var self = Container.call(this);
- var buildingGraphics = self.attachAsset('building', {
- anchorX: 0.5,
- anchorY: 1.0
- });
- return self;
-});
-var Building2 = Container.expand(function () {
- var self = Container.call(this);
- var buildingGraphics = self.attachAsset('building2', {
- anchorX: 0.5,
- anchorY: 1.0
- });
- return self;
-});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
@@ -41,68 +25,45 @@
/****
* Game Code
****/
+// Create large map container that will hold all map elements
+var mapContainer = game.addChild(new Container());
+// Create large map background (4x the screen size)
+var mapWidth = 8192; // 4x screen width
+var mapHeight = 10928; // 4x screen height
+// Create background tiles to fill the large map
+for (var i = 0; i < mapWidth / 100; i++) {
+ for (var j = 0; j < mapHeight / 100; j++) {
+ var bg = mapContainer.addChild(LK.getAsset('fondo', {
+ anchorX: 0,
+ anchorY: 0
+ }));
+ bg.x = i * 100;
+ bg.y = j * 100;
+ }
+}
+// Add some buildings scattered across the map
+for (var k = 0; k < 50; k++) {
+ var building = mapContainer.addChild(LK.getAsset(Math.random() > 0.5 ? 'building' : 'building2', {
+ anchorX: 0.5,
+ anchorY: 1
+ }));
+ building.x = Math.random() * (mapWidth - 600) + 300;
+ building.y = Math.random() * (mapHeight - 800) + 400;
+}
// Create player
var player = game.addChild(new Player());
-player.x = 1024;
-player.y = 1366;
-// Create buildings array
-var buildings = [];
-// Create buildings to simulate a street
-// Left side buildings
-var building1 = game.addChild(new Building());
-building1.x = 200;
-building1.y = 800;
-buildings.push(building1);
-var building2 = game.addChild(new Building2());
-building2.x = 300;
-building2.y = 1200;
-buildings.push(building2);
-var building3 = game.addChild(new Building());
-building3.x = 150;
-building3.y = 1600;
-buildings.push(building3);
-var building4 = game.addChild(new Building2());
-building4.x = 250;
-building4.y = 2000;
-buildings.push(building4);
-// Right side buildings
-var building5 = game.addChild(new Building());
-building5.x = 1800;
-building5.y = 800;
-buildings.push(building5);
-var building6 = game.addChild(new Building2());
-building6.x = 1750;
-building6.y = 1200;
-buildings.push(building6);
-var building7 = game.addChild(new Building());
-building7.x = 1850;
-building7.y = 1600;
-buildings.push(building7);
-var building8 = game.addChild(new Building2());
-building8.x = 1800;
-building8.y = 2000;
-buildings.push(building8);
+player.x = mapWidth / 2; // Start player at center of large map
+player.y = mapHeight / 2;
// Game controls - touch to move player
game.down = function (x, y, obj) {
- // Check if destination would collide with any building
- var canMove = true;
- for (var i = 0; i < buildings.length; i++) {
- var building = buildings[i];
- var distance = Math.sqrt((x - building.x) * (x - building.x) + (y - building.y) * (y - building.y));
- if (distance < 200) {
- // Collision detection radius
- canMove = false;
- break;
- }
- }
- if (!canMove) {
- return; // Don't move if it would collide with a building
- }
+ // Convert screen coordinates to world coordinates
+ var worldX = x - mapContainer.x + player.x;
+ var worldY = y - mapContainer.y + player.y;
// Calculate angle to face directly toward the clicked point
- var deltaX = x - player.x;
- var deltaY = y - player.y;
+ var deltaX = worldX - player.x;
+ var deltaY = worldY - player.y;
var targetRotation = Math.atan2(deltaY, deltaX) + Math.PI / 2; // Add 90 degrees to align with sprite orientation
// First tween: rotate to face the destination
tween(player, {
rotation: targetRotation
@@ -111,10 +72,10 @@
easing: tween.easeOut,
onFinish: function onFinish() {
// Second tween: move to the destination after rotation is complete
tween(player, {
- x: x,
- y: y
+ x: worldX,
+ y: worldY
}, {
duration: 800,
easing: tween.easeOut
});
@@ -122,8 +83,23 @@
});
};
// Main game update loop
game.update = function () {
- // Keep player within bounds
- player.x = Math.max(30, Math.min(2018, player.x));
- player.y = Math.max(30, Math.min(2702, player.y));
+ // Keep player within map bounds
+ player.x = Math.max(125, Math.min(mapWidth - 125, player.x));
+ player.y = Math.max(125, Math.min(mapHeight - 125, player.y));
+ // Camera follows player - center player on screen
+ var targetCameraX = -(player.x - 1024); // Center horizontally
+ var targetCameraY = -(player.y - 1366); // Center vertically
+ // Smooth camera movement using tweening
+ tween.stop(mapContainer, {
+ x: true,
+ y: true
+ }); // Stop any existing camera tweens
+ tween(mapContainer, {
+ x: targetCameraX,
+ y: targetCameraY
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
};
\ No newline at end of file
robot estilo steampunk visto desde arriba totalmente no desde el frente con llantas. In-Game asset. 2d. High contrast. No shadows. vistasuperior
dame un fondo de color verde pasto. In-Game asset. 2d. High contrast. No shadows
has un robot negro tipo auto steampunk con aspecto desgastado que se mueva con llantas y este en una vista desde arriba In-Game asset. 2d. High contrast. No shadows
explosion realista. In-Game asset. 2d. High contrast. No shadows
haz un corazon con aspecto steampunk metalico desgastado. In-Game asset. 2d. High contrast. No shadows
una bateria energetica estilo steampunk. In-Game asset. 2d. High contrast. No shadows
has una flecha de señalizacion en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
has un rayo. In-Game asset. 2d. High contrast. No shadows
has que se vea en estilo steampunk
has una rueda en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
has un escudo en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
plateada
un 0 es estilo steampunk. In-Game asset. 2d. High contrast. No shadows
1 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 2 estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 3 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 4 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 5 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 6 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 7 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 8 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
numero 9 en estilo steampunk. In-Game asset. 2d. High contrast. No shadows
simbolo ":" en estilo steampunk. In-Game asset. 2d. High contrast. No shadows