User prompt
Yeni oluşturulan arka plan boyutu diger arkaplan boyutunun 4/1 ölçeğinde ve üst kısıma sabit
User prompt
Arkaplan için yeni bir katman ekle
User prompt
Zemini incelt
User prompt
Zemim varlıgını biraz incelt
User prompt
Zemini olabildigince incelt
User prompt
Bir zemin oluştur
User prompt
Arkaplan için resim varlıgı ekle
User prompt
Arka plan rengini degiştirebilmem için resim varlıgı ekle
User prompt
Bu alanda heryere gidebilen bir oyuncu ekle resim varlıklarıda ekle
User prompt
Arkaplan için varlık için resim varlıgı oluştur
User prompt
Oyındaki herşeyi sil ve sadece kahve rengi bir arkaplan istiyorum
Code edit (1 edits merged)
Please save this source code
User prompt
Toprak Saga - Soil Builder
Initial prompt
Toprak bir alan oluştur
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x8B4513 }); /**** * Game Code ****/ // Array of background colors to cycle through var backgroundColors = [0x8B4513, 0x654321, 0x5D4037, 0x4E342E, 0x3E2723, 0x6F4E37]; var currentColorIndex = 0; // Create background changer button var backgroundChanger = game.addChild(LK.getAsset('backgroundChanger', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 200 })); // Add text to show current function var changerText = new Text2('Change BG', { size: 40, fill: 0xFFFFFF }); changerText.anchor.set(0.5, 0.5); changerText.x = 1024; changerText.y = 200; game.addChild(changerText); // Handle background changer button press backgroundChanger.down = function (x, y, obj) { // Cycle to next background color currentColorIndex = (currentColorIndex + 1) % backgroundColors.length; game.setBackgroundColor(backgroundColors[currentColorIndex]); };
===================================================================
--- original.js
+++ change.js
@@ -1,58 +1,35 @@
/****
-* Classes
+* Initialize Game
****/
-var Player = Container.expand(function () {
- var self = Container.call(this);
- var playerGraphics = self.attachAsset('player', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 8;
- self.targetX = 2048 / 2;
- self.targetY = 2732 / 2;
- self.update = function () {
- // Smooth movement towards target position
- var deltaX = self.targetX - self.x;
- var deltaY = self.targetY - self.y;
- var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- if (distance > 5) {
- self.x += deltaX / distance * self.speed;
- self.y += deltaY / distance * self.speed;
- }
- // Keep player within screen bounds
- if (self.x < 60) self.x = 60;
- if (self.x > 2048 - 60) self.x = 2048 - 60;
- if (self.y < 60) self.y = 60;
- if (self.y > 2732 - 60) self.y = 2732 - 60;
- };
- return self;
+var game = new LK.Game({
+ backgroundColor: 0x8B4513
});
/****
-* Initialize Game
-****/
-var game = new LK.Game({});
-
-/****
* Game Code
****/
-// Add background image that covers the entire screen
-var backgroundImage = game.attachAsset('background', {
- x: 0,
- y: 0,
- width: 2048,
- height: 2732
+// Array of background colors to cycle through
+var backgroundColors = [0x8B4513, 0x654321, 0x5D4037, 0x4E342E, 0x3E2723, 0x6F4E37];
+var currentColorIndex = 0;
+// Create background changer button
+var backgroundChanger = game.addChild(LK.getAsset('backgroundChanger', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1024,
+ y: 200
+}));
+// Add text to show current function
+var changerText = new Text2('Change BG', {
+ size: 40,
+ fill: 0xFFFFFF
});
-// Create player instance
-var player = game.addChild(new Player());
-player.x = 2048 / 2;
-player.y = 2732 / 2;
-// Touch controls for player movement
-game.down = function (x, y, obj) {
- player.targetX = x;
- player.targetY = y;
-};
-game.move = function (x, y, obj) {
- player.targetX = x;
- player.targetY = y;
+changerText.anchor.set(0.5, 0.5);
+changerText.x = 1024;
+changerText.y = 200;
+game.addChild(changerText);
+// Handle background changer button press
+backgroundChanger.down = function (x, y, obj) {
+ // Cycle to next background color
+ currentColorIndex = (currentColorIndex + 1) % backgroundColors.length;
+ game.setBackgroundColor(backgroundColors[currentColorIndex]);
};
\ No newline at end of file
3d köstebek. In-Game asset. 2d. High contrast. No shadows
Elinde havuç olan kızgın bir çiftçi. Karakter ayakkabısı siyah
Havuç. In-Game asset. 2d. High contrast. No shadows
Bomba. In-Game asset. 2d. High contrast. No shadows
Alev. In-Game asset. 2d. High contrast. No shadows
Agız. In-Game asset. 2d. High contrast. No shadows
Kalp 3d. In-Game asset. 2d. High contrast. No shadows