Code edit (1 edits merged)
Please save this source code
User prompt
bigger buttons
User prompt
🔧 Sana önerim: Karakterin her konum seçildiğinde yeniden yerleştirilmesini iptal etmek için, selectLocation() fonksiyonu içindeki şu satırları kaldır veya yorum satırı haline getir: javascript Kopyala Düzenle musician.x = location.x; musician.y = location.y + 100; Karakteri ekranın ortasına sabitlemek için, müzisyen tanımlandıktan sonra şu şekilde güncelle: javascript Kopyala Düzenle musician.x = LK.width / 2; musician.y = LK.height - 150; // Alt ortada olsun diye
Code edit (1 edits merged)
Please save this source code
User prompt
Street Musician Simulator
Initial prompt
📌 PROMPT (Upit’e yazılacak metin): "Bir müzisyen simülasyon oyunu yapmanı istiyorum. Oyuncu, sokakta yaşayan evsiz bir müzisyeni yönetiyor. Oyun 2D veya izometrik olabilir. Oyun gün gün ilerliyor ve oyuncunun amacı 30 gün içinde müzisyen karakteri şöhrete ulaştırmak. Eğer başaramazsa karakter sokakta hastalanıp ölüyor. Oyunda aşağıdaki sistemleri kullan: 🎯 HEDEF: 30 gün içinde konser verip ünlü olmak. Şöhret seviyesini artırmak. Para kazanarak barları dengede tutmak ve gelişmek. 🎮 OYUN MEKANİKLERİ: 🧍 BAŞLANGIÇ DURUMU: Karakter yerde oturmuş, gitar çalıyor. Ev yok, kıyafet eski, morali düşük. 📊 ÜST BARLAR (Ekranın üst kısmında sürekli görünecek): Yemek (her gün %10 azalır, sıfır olursa enerji düşer) Su (her gün %10 azalır, sıfır olursa hastalık riski artar) Uyku (her gece uyumazsa ertesi gün performans düşer) Soğuk (Hava durumu etkisiyle artar/azalır) – dışarıda çok kalmak hastalık riskini artırır Hastalık Barı – soğukta kalma, açlık, susuzluk gibi etkenlerle dolmaya başlar. %100 olursa oyun biter. Moral Barı – iyi günlerde artar, kötü olaylarda düşer (insanların kötü sözleri vs.) 💰 PARA KAZANMA: Gün içinde belirli saatlerde sokakta müzik yap. Kalabalık yerlere gitmek daha fazla para getirir. Performansın iyiliği morale ve uykuna bağlıdır. Para ile şunlar yapılabilir: Ucuz yiyecek / kaliteli yiyecek Su / içecek Ucuz otelde uyumak Sokak çalgıcı ruhsatı (polis cezası riskini azaltır) Müzik ekipmanı geliştirmesi 📈 GELİŞİM SİSTEMİ: Yetenek puanları: Her başarılı müzik performansından sonra alınır (ritim, karizma, nota bilgisi gibi). Yeni ekipmanlar: Daha iyi gitar, mikrofon, loop pedal, vs. Sosyal medya: 10. günden sonra açılır, paylaşım yaparak takipçi topla. Bağlantılar: Bar sahibi, yapımcı, menajer gibi kişilerle tanışma şansı. 🏘️ MEKANLAR: Sokaklar (para kazanmak için müzik yapılan yerler) Market (yemek, içecek, ilaç alabileceğin yer) Otel / Barınak (uyumak için) Hastane (hastalık için ama pahalıdır) Müzik Stüdyosu (şöhrete ulaşırsan girilebilir) 🔄 GÜNLÜK DÖNGÜ: Gün sabahı: Barlar güncelle Haritada bir yer seç → Git O yerde müzik yap / yemek al / uyumaya çalış / görev yap Akşam: Uyumazsan ertesi gün enerji düşük olur Günü kapat: Bir günlük rapor göster (% başarı, gelir, barlar) 🧠 ÖZEL DURUMLAR: Rastgele Etkinlikler: Polis gelip ceza kesebilir, biri bahşiş verebilir, yağmur yağabilir vs. Mini Görevler: "Bugün 50₺ kazan", "Yeni bir kişiyle tanış", "10 kişi alkışlasın" gibi 🏆 KAZANMA KOŞULU: 30 gün içinde en az 3 konser ver ve takipçi sayısı 1000'e ulaş. En iyi son: Menajer seni keşfeder ve kontrat imzalanır. 💀 KAYBETME KOŞULLARI: Hastalık barı %100 olursa Moral 0’a düşerse karakter sokakları terk eder 30 gün içinde şöhrete ulaşamazsa: “Soğuk bir gecede yalnızca rüzgarın sesi duyuluyordu...” 🧩 OYUNUN SES VE GÖRSEL STİLİ: Sokak ortamına uygun düşük çözünürlüklü, lo-fi tarzda müzikler. Renkler pastel ve solgun, zaman geçtikçe canlanıyor. Konser sahnelerinde ışıklar, renkli efektler kullanılabilir.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ActionButton = Container.expand(function (text, action) {
var self = Container.call(this);
var button = self.attachAsset('performButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 28,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
buttonText.x = 0;
buttonText.y = 0;
self.addChild(buttonText);
self.action = action;
self.down = function (x, y, obj) {
if (self.action) {
self.action();
}
};
return self;
});
var Location = Container.expand(function (type, name, earningMultiplier, cost) {
var self = Container.call(this);
self.type = type;
self.name = name;
self.earningMultiplier = earningMultiplier;
self.cost = cost;
self.unlocked = type === 'street';
var locationGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
var nameText = new Text2(name, {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0);
nameText.x = 0;
nameText.y = locationGraphics.height / 2 + 10;
self.addChild(nameText);
self.down = function (x, y, obj) {
if (self.unlocked) {
selectLocation(self);
}
};
return self;
});
var Musician = Container.expand(function () {
var self = Container.call(this);
var body = self.attachAsset('musicianBody', {
anchorX: 0.5,
anchorY: 1
});
var guitar = self.attachAsset('guitar', {
anchorX: 0.5,
anchorY: 0.5,
x: 30,
y: -40
});
self.perform = function () {
tween(guitar, {
rotation: 0.2
}, {
duration: 200,
onFinish: function onFinish() {
tween(guitar, {
rotation: -0.2
}, {
duration: 200,
onFinish: function onFinish() {
tween(guitar, {
rotation: 0
}, {
duration: 200
});
}
});
}
});
LK.getSound('guitarStrum').play();
};
return self;
});
var ResourceBar = Container.expand(function (label, color, maxValue) {
var self = Container.call(this);
self.maxValue = maxValue;
self.currentValue = maxValue;
var bg = self.attachAsset('resourceBg', {
anchorX: 0,
anchorY: 0
});
var bar = self.attachAsset('resourceBar', {
anchorX: 0,
anchorY: 0,
x: 2,
y: 2
});
bar.tint = color;
self.bar = bar;
var labelText = new Text2(label, {
size: 20,
fill: 0xFFFFFF
});
labelText.anchor.set(0, 0.5);
labelText.x = -80;
labelText.y = 17;
self.addChild(labelText);
var valueText = new Text2('100%', {
size: 18,
fill: 0xFFFFFF
});
valueText.anchor.set(0.5, 0.5);
valueText.x = 152;
valueText.y = 17;
self.addChild(valueText);
self.valueText = valueText;
self.updateBar = function () {
var percentage = Math.max(0, self.currentValue / self.maxValue);
self.bar.width = 300 * percentage;
self.valueText.setText(Math.round(percentage * 100) + '%');
if (percentage < 0.3) {
self.bar.tint = 0xFF0000;
} else if (percentage < 0.6) {
self.bar.tint = 0xFFFF00;
} else {
self.bar.tint = color;
}
};
self.setValue = function (value) {
self.currentValue = Math.max(0, Math.min(self.maxValue, value));
self.updateBar();
};
self.addValue = function (amount) {
self.setValue(self.currentValue + amount);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game state variables
var currentDay = 1;
var money = 10;
var followers = 0;
var concerts = 0;
var musicSkill = 10;
var equipmentLevel = 1;
var socialMediaUnlocked = false;
// Resources
var foodLevel = 100;
var waterLevel = 100;
var healthLevel = 100;
var moodLevel = 80;
var sleepLevel = 80;
// Game state
var currentLocation = null;
var gamePhase = 'playing'; // 'playing', 'gameOver', 'won'
var lastPerformanceTime = 0;
var policeRisk = 0;
// UI Elements
var dayText = new Text2('Day 1', {
size: 40,
fill: 0x000000
});
dayText.anchor.set(0.5, 0);
LK.gui.top.addChild(dayText);
var moneyText = new Text2('$10', {
size: 30,
fill: 0x000000
});
moneyText.anchor.set(1, 0);
moneyText.x = -20;
moneyText.y = 60;
LK.gui.topRight.addChild(moneyText);
var followersText = new Text2('Followers: 0', {
size: 25,
fill: 0x000000
});
followersText.anchor.set(0, 0);
followersText.x = 20;
followersText.y = 60;
LK.gui.topLeft.addChild(followersText);
// Create resource bars
var foodBar = new ResourceBar('Food', 0x32CD32, 100);
foodBar.x = 1024;
foodBar.y = 150;
game.addChild(foodBar);
var waterBar = new ResourceBar('Water', 0x1E90FF, 100);
waterBar.x = 1024;
waterBar.y = 200;
game.addChild(waterBar);
var healthBar = new ResourceBar('Health', 0xFF6347, 100);
healthBar.x = 1024;
healthBar.y = 250;
game.addChild(healthBar);
var moodBar = new ResourceBar('Mood', 0xFFD700, 100);
moodBar.x = 1024;
moodBar.y = 300;
game.addChild(moodBar);
var sleepBar = new ResourceBar('Sleep', 0x9370DB, 100);
sleepBar.x = 1024;
sleepBar.y = 350;
game.addChild(sleepBar);
// Create locations
var locations = [];
var streetCorner = new Location('streetCorner', 'Street Corner', 1.0, 0);
streetCorner.x = 300;
streetCorner.y = 500;
locations.push(streetCorner);
game.addChild(streetCorner);
var market = new Location('market', 'Market', 1.5, 5);
market.x = 600;
market.y = 500;
locations.push(market);
game.addChild(market);
var hotel = new Location('hotel', 'Hotel', 2.0, 15);
hotel.x = 900;
hotel.y = 500;
locations.push(hotel);
game.addChild(hotel);
var studio = new Location('studio', 'Studio', 3.0, 50);
studio.x = 1200;
studio.y = 500;
locations.push(studio);
game.addChild(studio);
// Create musician
var musician = new Musician();
musician.x = 1024; // Center horizontally (2048/2)
musician.y = 650; // Fixed position at bottom center
game.addChild(musician);
// Create action buttons
var performButton = new ActionButton('Perform ($' + (currentLocation ? currentLocation.cost : 0) + ')', function () {
if (currentLocation && money >= currentLocation.cost) {
performMusic();
}
});
performButton.x = 250;
performButton.y = 800;
game.addChild(performButton);
var eatButton = new ActionButton('Eat ($5)', function () {
if (money >= 5) {
money -= 5;
foodLevel = Math.min(100, foodLevel + 30);
moodLevel = Math.min(100, moodLevel + 10);
updateDisplay();
}
});
eatButton.x = 550;
eatButton.y = 800;
game.addChild(eatButton);
var drinkButton = new ActionButton('Drink ($2)', function () {
if (money >= 2) {
money -= 2;
waterLevel = Math.min(100, waterLevel + 40);
updateDisplay();
}
});
drinkButton.x = 850;
drinkButton.y = 800;
game.addChild(drinkButton);
var sleepButton = new ActionButton('Sleep ($10)', function () {
if (money >= 10) {
money -= 10;
sleepLevel = Math.min(100, sleepLevel + 60);
healthLevel = Math.min(100, healthLevel + 10);
moodLevel = Math.min(100, moodLevel + 15);
updateDisplay();
}
});
sleepButton.x = 1150;
sleepButton.y = 800;
game.addChild(sleepButton);
var nextDayButton = new ActionButton('Next Day', function () {
nextDay();
});
nextDayButton.x = 1450;
nextDayButton.y = 800;
game.addChild(nextDayButton);
// Set initial location
currentLocation = streetCorner;
selectLocation(streetCorner);
function selectLocation(location) {
if (!location.unlocked) {
return;
}
currentLocation = location;
// Update perform button cost
var buttonText = performButton.children[1];
buttonText.setText('Perform ($' + location.cost + ')');
// Visual feedback
for (var i = 0; i < locations.length; i++) {
locations[i].alpha = locations[i] === location ? 1.0 : 0.7;
}
}
function performMusic() {
if (currentLocation && money >= currentLocation.cost && sleepLevel > 20) {
money -= currentLocation.cost;
// Calculate performance quality
var performance = calculatePerformance();
var earnings = Math.floor(performance * currentLocation.earningMultiplier * (5 + Math.random() * 15));
money += earnings;
musicSkill += 1;
sleepLevel = Math.max(0, sleepLevel - 15);
moodLevel = Math.min(100, moodLevel + 5);
// Police encounter chance
if (currentLocation.type === 'streetCorner' && Math.random() < 0.15) {
policeEncounter();
}
// Social media followers (after day 10)
if (currentDay >= 10 && !socialMediaUnlocked) {
socialMediaUnlocked = true;
}
if (socialMediaUnlocked && performance > 0.7) {
var newFollowers = Math.floor(performance * 10 * currentLocation.earningMultiplier);
followers += newFollowers;
}
musician.perform();
LK.getSound('coinDrop').play();
// Show earnings
showEarnings(earnings);
updateDisplay();
checkWinConditions();
}
}
function calculatePerformance() {
var base = musicSkill / 100;
var moodBonus = moodLevel / 100 * 0.3;
var sleepBonus = sleepLevel / 100 * 0.2;
var equipmentBonus = equipmentLevel * 0.1;
return Math.min(1.0, base + moodBonus + sleepBonus + equipmentBonus);
}
function policeEncounter() {
LK.getSound('policeSiren').play();
var officer = game.addChild(LK.getAsset('policeOfficer', {
anchorX: 0.5,
anchorY: 1,
x: musician.x + 100,
y: musician.y
}));
var fine = Math.floor(5 + Math.random() * 15);
money = Math.max(0, money - fine);
moodLevel = Math.max(0, moodLevel - 20);
LK.setTimeout(function () {
officer.destroy();
}, 2000);
updateDisplay();
}
function showEarnings(amount) {
var earningsText = new Text2('+$' + amount, {
size: 30,
fill: 0x00FF00
});
earningsText.anchor.set(0.5, 0.5);
earningsText.x = musician.x;
earningsText.y = musician.y - 150;
game.addChild(earningsText);
tween(earningsText, {
y: earningsText.y - 50,
alpha: 0
}, {
duration: 1500,
onFinish: function onFinish() {
earningsText.destroy();
}
});
}
function nextDay() {
currentDay++;
// Daily resource drain
foodLevel = Math.max(0, foodLevel - 10);
waterLevel = Math.max(0, waterLevel - 10);
// Health effects
if (foodLevel < 20) {
healthLevel = Math.max(0, healthLevel - 15);
moodLevel = Math.max(0, moodLevel - 10);
}
if (waterLevel < 20) {
healthLevel = Math.max(0, healthLevel - 10);
}
if (sleepLevel < 30) {
healthLevel = Math.max(0, healthLevel - 5);
moodLevel = Math.max(0, moodLevel - 15);
}
// Unlock locations based on progress
if (currentDay >= 5 && !market.unlocked) {
market.unlocked = true;
market.alpha = 1.0;
}
if (currentDay >= 10 && musicSkill >= 50 && !hotel.unlocked) {
hotel.unlocked = true;
hotel.alpha = 1.0;
}
if (currentDay >= 15 && followers >= 100 && !studio.unlocked) {
studio.unlocked = true;
studio.alpha = 1.0;
}
// Random events
if (Math.random() < 0.2) {
randomEvent();
}
updateDisplay();
checkGameOver();
checkWinConditions();
}
function randomEvent() {
var events = [{
text: "A generous fan gave you $20!",
effect: function effect() {
money += 20;
}
}, {
text: "Rain ruined your guitar strings. -$10",
effect: function effect() {
money = Math.max(0, money - 10);
}
}, {
text: "You met a music producer!",
effect: function effect() {
if (musicSkill >= 70) {
concerts++;
money += 100;
}
}
}];
var event = events[Math.floor(Math.random() * events.length)];
event.effect();
var eventText = new Text2(event.text, {
size: 25,
fill: 0xFFFF00
});
eventText.anchor.set(0.5, 0.5);
eventText.x = 1024;
eventText.y = 1000;
game.addChild(eventText);
tween(eventText, {
alpha: 0
}, {
duration: 3000,
onFinish: function onFinish() {
eventText.destroy();
}
});
}
function updateDisplay() {
dayText.setText('Day ' + currentDay);
moneyText.setText('$' + money);
followersText.setText('Followers: ' + followers);
foodBar.setValue(foodLevel);
waterBar.setValue(waterLevel);
healthBar.setValue(healthLevel);
moodBar.setValue(moodLevel);
sleepBar.setValue(sleepLevel);
}
function checkGameOver() {
if (healthLevel <= 0) {
gamePhase = 'gameOver';
LK.showGameOver();
} else if (moodLevel <= 0) {
gamePhase = 'gameOver';
LK.showGameOver();
} else if (currentDay > 30) {
if (concerts < 3 || followers < 1000) {
gamePhase = 'gameOver';
LK.showGameOver();
}
}
}
function checkWinConditions() {
if (concerts >= 3 && followers >= 1000 && currentDay <= 30) {
gamePhase = 'won';
LK.showYouWin();
}
}
// Initialize display
updateDisplay();
game.update = function () {
// Game runs at 60fps, update logic here if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -297,9 +297,11 @@
// Set initial location
currentLocation = streetCorner;
selectLocation(streetCorner);
function selectLocation(location) {
- if (!location.unlocked) return;
+ if (!location.unlocked) {
+ return;
+ }
currentLocation = location;
// Update perform button cost
var buttonText = performButton.children[1];
buttonText.setText('Perform ($' + location.cost + ')');
pixel yatak. In-Game asset. 2d. High contrast. No shadows
pixel
Market pixel. In-Game asset. 2d. High contrast. No shadows
hotel pixel. In-Game asset. 2d. High contrast. No shadows
sokak lambası kaldırım ve bank pixel. In-Game asset. 2d. High contrast. No shadows
Music studio pixel. In-Game asset. 2d. High contrast. No shadows
water pixel. In-Game asset. 2d. High contrast. No shadows
Navigation pixel. In-Game asset. 2d. High contrast. No shadows
pixel phone frame. In-Game asset. 2d. High contrast. No shadows
street lamp pixel. In-Game asset. 2d. High contrast. No shadows
make pixels
sitting bench pixels. In-Game asset. 2d. High contrast. No shadows
clock face. no clock hour stick and minute stick only the clock face In-Game asset. 2d. High contrast. No shadows
DİRTY AND BROKE guitar pixel. dik dursun In-Game asset. 2d. High contrast. No shadows
same picture but night
same picture but morning
same picture noon time pixel
police officer pixel. detaylı surat full body In-Game asset. 2d. High contrast. No shadows
same picture but evening