User prompt
Geceyi bitir tuşuna bir kere basıldığında jumpscare çıkıp bizi öldürmeli
User prompt
Şimdi oyunda geceyi bitir tuşuna bir kere bastığında sesli bir jump scare çıkmalı iki kere bastığında ise geceyi geçmeli
User prompt
ismin ingilizce olması lazım
User prompt
İsmin dil değiştiğinde değişmesine gerek yok
User prompt
İsmin başına FNAF : YAZMALISIN
User prompt
Oyunun adı finish the night olmalı
User prompt
Geceyi belirten yazı dil ingilizce olduğunda night olmalı
User prompt
Gece night geceyi bitir finish night olmalı
User prompt
Dil ingilizce olduğunda dil language olarak yeni oyun new game olarak devam et continue olarak değişmeli
User prompt
Tuşlar şeffaf olmalı
User prompt
Ekranda tuş hariç birşey ile etkileşime girememeliyiz
User prompt
Bedenin tüm parçalarını biraz küçült ve kukarı al
User prompt
Biraz daha
User prompt
Biraz daha
User prompt
Beden asseti biraz daha büyük olmalı
User prompt
Beden olarak yeni bir asset ekle
User prompt
Animatroniğe gövde ekle
User prompt
Dil tuşuna bastığımda oyun başlamamalı
User prompt
Bi gıdım daha aşağı yada devam et tuşunun yeni oyundan ne kadar aşağılayan dil tuşunun devam et tuşunun okadar aşağısına koy
User prompt
Dil tuşunu devam et tuşunun altına koy
User prompt
Tuşların arasına dil seçeneği ekle
User prompt
Animatronik gece bitiş ekranında olmasın
User prompt
Geceyi geçince gecenin yükselmesi lazım
User prompt
Devam et tuşunun bir sonraki geceden değil olduğumuz geceden başlatması lazım
User prompt
Animatroniğin kulağı olmasın
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Animatronic class
var Animatronic = Container.expand(function () {
var self = Container.call(this);
// (Ears removed)
// Jaw (behind head)
var jaw = self.attachAsset('animatronicJaw', {
anchorX: 0.5,
anchorY: 0,
x: 350,
y: 400
});
// Head (in front of jaw)
var head = self.attachAsset('animatronicHead', {
anchorX: 0.5,
anchorY: 0.5,
x: 350,
y: 250
});
// (Eyes, pupils, and nose removed)
// State
self.jawOpen = 0; // 0 closed, 1 open
self.headTilt = 0; // -1 left, 0 center, 1 right
self.glitchTimer = 0;
self.glitching = false;
self.glitchState = 0;
self.glitchDuration = 0;
self.glitchCooldown = 0;
// Helper: set pose
self.setPose = function (jawOpen, headTilt) {
self.jawOpen = jawOpen;
self.headTilt = headTilt;
// Jaw open/close
jaw.y = 400 + 60 * jawOpen;
// Head tilt
head.rotation = headTilt * 0.12;
// (Ears removed)
// (Eyes, pupils, and nose removed)
};
// Helper: set pupils offset (for glitch)
self.setPupilOffset = function (dx, dy) {
// (Pupil offset removed)
};
// Helper: set head position offset (for glitch)
self.setHeadOffset = function (dx, dy) {
self.x = self.baseX + dx;
self.y = self.baseY + dy;
};
// Helper: reset all offsets
self.resetOffsets = function () {
self.setHeadOffset(0, 0);
};
// Animate jaw open/close
self.animateJaw = function (open) {
tween(self, {
jawOpen: open
}, {
duration: 180,
easing: tween.cubicInOut
});
};
// Animate head tilt
self.animateTilt = function (target) {
tween(self, {
headTilt: target
}, {
duration: 220,
easing: tween.cubicInOut
});
};
// Glitch effect: random pose, random offset, short duration
self.triggerGlitch = function () {
self.glitching = true;
self.glitchState = Math.floor(Math.random() * 3);
self.glitchDuration = 6 + Math.floor(Math.random() * 6); // 6-12 frames
self.glitchCooldown = 30 + Math.floor(Math.random() * 60); // 0.5-1.5s
// Random pose
var jaw = Math.random() > 0.5 ? 1 : 0;
var tilt = [-1, 0, 1][Math.floor(Math.random() * 3)];
self.setPose(jaw, tilt);
// Random offset
var dx = -10 + Math.random() * 20;
var dy = -10 + Math.random() * 20;
self.setHeadOffset(dx, dy);
// (Random pupils removed)
};
// Update
self.update = function () {
// Animate jaw and tilt
self.setPose(self.jawOpen, self.headTilt);
// Glitch logic
if (self.glitching) {
self.glitchDuration--;
if (self.glitchDuration <= 0) {
self.glitching = false;
self.resetOffsets();
}
} else {
self.glitchCooldown--;
if (self.glitchCooldown <= 0) {
self.triggerGlitch();
}
}
};
// For centering
self.baseX = 0;
self.baseY = 0;
return self;
});
// Button class
var MenuButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('buttonRect', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
bg.alpha = 0.7;
self.label = new Text2('', {
size: 80,
fill: 0xFFFFFF
});
self.label.anchor.set(0.5, 0.5);
self.addChild(self.label);
self.setText = function (txt) {
self.label.setText(txt);
};
self.setActive = function (active) {
bg.alpha = active ? 1 : 0.7;
self.label.alpha = active ? 1 : 0.7;
};
return self;
});
// VHS Static overlay class
var VHSStatic = Container.expand(function () {
var self = Container.call(this);
var staticNode = self.attachAsset('vhsStatic', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
staticNode.alpha = 0.08;
// Add horizontal noise lines
var noiseLines = [];
for (var i = 0; i < 8; i++) {
var line = self.attachAsset('vhsStatic', {
anchorX: 0,
anchorY: 0,
x: 0,
y: Math.random() * 2732,
width: 2048,
height: 8,
color: 0xffffff
});
line.alpha = 0.08 + Math.random() * 0.10;
noiseLines.push(line);
}
self.update = function () {
// Animate static flicker
staticNode.alpha = 0.06 + Math.random() * 0.10;
// Animate noise lines: randomize y and alpha for each line
for (var i = 0; i < noiseLines.length; i++) {
var line = noiseLines[i];
// Move line vertically, wrap around
line.y += 32 + Math.random() * 32;
if (line.y > 2732) line.y = -8;
// Flicker alpha
line.alpha = 0.08 + Math.random() * 0.12;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game state
// Animatronic body (main head)
// Animatronic jaw
// Animatronic left eye
// Animatronic right eye
// Animatronic left pupil
// Animatronic right pupil
// Animatronic left ear
// Animatronic right ear
// Animatronic nose
// VHS static overlay
// Button shape
var STATE_MENU = 0;
var STATE_PLAY = 1;
var STATE_NIGHTEND = 2;
var state = STATE_MENU;
// Night and hour
var currentNight = 1;
var currentHour = 12;
// Animatronic
var animatronic = new Animatronic();
var animatronicScale = 1.7; // küçültüldü
// Center animatronic horizontally and place at bottom 40% of screen
// Head asset is 700px wide, 500px tall, so center based on that
animatronic.baseX = 2048 / 2 - 700 * animatronicScale / 2;
// Move animatronic up by 420px for better visual balance
animatronic.baseY = 2732 - 500 * animatronicScale - 420; // daha yukarıda
animatronic.x = animatronic.baseX;
animatronic.y = animatronic.baseY;
animatronic.scaleX = animatronicScale;
animatronic.scaleY = animatronicScale;
game.addChild(animatronic);
// VHS static overlay
var vhsStatic = new VHSStatic();
game.addChild(vhsStatic);
// Menu UI
var titleText = new Text2('FNAF: GECE VARDİYASI', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 2048 / 2;
titleText.y = 220;
var btnNewGame = new MenuButton();
btnNewGame.x = 2048 / 2;
btnNewGame.y = 600;
btnNewGame.setText('YENİ OYUN');
var btnContinue = new MenuButton();
btnContinue.x = 2048 / 2;
btnContinue.y = 800;
btnContinue.setText('DEVAM ET');
// Language select button (now below continue)
var btnLang = new MenuButton();
btnLang.x = 2048 / 2;
btnLang.y = 950;
btnLang.setText('DİL: Türkçe');
var continueNightText = new Text2('', {
size: 38,
fill: 0xFFFFFF
});
continueNightText.anchor.set(0, 0.5);
continueNightText.x = btnContinue.x + 380;
continueNightText.y = btnContinue.y;
// Menu selection
var menuSelected = 0; // 0: new game, 1: continue
// Night info UI
var nightText = new Text2('', {
size: 110,
fill: 0xFFFFFF
});
nightText.anchor.set(0.5, 0.5);
nightText.x = 2048 / 2;
nightText.y = 400;
nightText.alpha = 0;
var hourText = new Text2('', {
size: 90,
fill: 0xFFFFFF
});
hourText.anchor.set(0.5, 0.5);
hourText.x = 2048 / 2;
hourText.y = 540;
hourText.alpha = 0;
// Test: End night button
var btnEndNight = new MenuButton();
btnEndNight.x = 2048 / 2;
btnEndNight.y = 1200;
btnEndNight.setText('GECEYİ BİTİR');
btnEndNight.visible = false;
// 6:00 screen
var sixText = new Text2('06:00', {
size: 180,
fill: 0xFFFFFF
});
sixText.anchor.set(0.5, 0.5);
sixText.x = 2048 / 2;
sixText.y = 700;
sixText.alpha = 0;
// Add menu UI to game
game.addChild(titleText);
game.addChild(btnNewGame);
game.addChild(btnContinue);
game.addChild(btnLang);
game.addChild(continueNightText);
// Add night info and test UI
game.addChild(nightText);
game.addChild(hourText);
game.addChild(btnEndNight);
game.addChild(sixText);
// Hide all except menu
function showMenu() {
state = STATE_MENU;
titleText.visible = true;
btnNewGame.visible = true;
btnLang.visible = true;
btnContinue.visible = true;
continueNightText.visible = true;
nightText.visible = false;
hourText.visible = false;
btnEndNight.visible = false;
sixText.visible = false;
menuSelected = 0;
btnNewGame.setActive(true);
btnContinue.setActive(false);
updateContinueNight();
// Show animatronic in menu
animatronic.visible = true;
}
function showNight() {
state = STATE_PLAY;
titleText.visible = false;
btnNewGame.visible = false;
btnLang.visible = false;
btnContinue.visible = false;
continueNightText.visible = false;
nightText.visible = true;
hourText.visible = true;
btnEndNight.visible = true;
sixText.visible = false;
// Set night and hour text
nightText.setText('GECE ' + currentNight);
hourText.setText(currentHour + ':00');
nightText.alpha = 0;
hourText.alpha = 0;
// Animate in
tween(nightText, {
alpha: 1
}, {
duration: 400,
easing: tween.cubicOut
});
tween(hourText, {
alpha: 1
}, {
duration: 400,
easing: tween.cubicOut
});
// Animatronic: look at player, jaw closed
animatronic.animateJaw(0);
animatronic.animateTilt(0);
// Hide animatronic during gameplay
animatronic.visible = false;
}
function showNightEnd() {
state = STATE_NIGHTEND;
titleText.visible = false;
btnNewGame.visible = false;
btnLang.visible = false;
btnContinue.visible = false;
continueNightText.visible = false;
nightText.visible = false;
hourText.visible = false;
btnEndNight.visible = false;
sixText.visible = true;
sixText.alpha = 0;
tween(sixText, {
alpha: 1
}, {
duration: 600,
easing: tween.cubicOut
});
// Animatronic: jaw open, head tilt
animatronic.animateJaw(1);
animatronic.animateTilt(1);
// Hide animatronic in night end
animatronic.visible = false;
// Geceyi geçince geceyi yükselt
currentNight += 1;
}
// Update continue night text
function updateContinueNight() {
continueNightText.setText('gece ' + currentNight);
}
// Menu button touch logic
btnNewGame.down = function (x, y, obj) {
menuSelected = 0;
btnNewGame.setActive(true);
btnContinue.setActive(false);
// Start new game
currentNight = 1;
currentHour = 12;
showNight();
};
// Language selection logic
var languages = [{
code: 'tr',
label: 'Türkçe'
}, {
code: 'en',
label: 'English'
}];
var currentLangIndex = 0;
btnLang.down = function (x, y, obj) {
currentLangIndex = (currentLangIndex + 1) % languages.length;
btnLang.setText('DİL: ' + languages[currentLangIndex].label);
// Here you could add logic to update all UI text if you implement localization
};
btnContinue.down = function (x, y, obj) {
menuSelected = 1;
btnNewGame.setActive(false);
btnContinue.setActive(true);
// Continue game
currentHour = 12;
showNight();
};
btnEndNight.down = function (x, y, obj) {
// End night, show 6:00
showNightEnd();
// After 2s, return to menu
LK.setTimeout(function () {
showMenu();
}, 2000);
};
// Touch navigation for menu (touch anywhere except buttons to switch selection)
game.down = function (x, y, obj) {
if (state !== STATE_MENU) return;
// If touch is on a button, handled by button
if (x > btnNewGame.x - 350 && x < btnNewGame.x + 350 && y > btnNewGame.y - 70 && y < btnNewGame.y + 70) return;
if (x > btnContinue.x - 350 && x < btnContinue.x + 350 && y > btnContinue.y - 70 && y < btnContinue.y + 70) return;
// Switch selection
menuSelected = 1 - menuSelected;
btnNewGame.setActive(menuSelected === 0);
btnContinue.setActive(menuSelected === 1);
};
// Touch up: select menu
game.up = function (x, y, obj) {
if (state !== STATE_MENU) return;
if (menuSelected === 0) {
btnNewGame.down(x, y, obj);
} else {
btnContinue.down(x, y, obj);
}
};
// Animate animatronic idle (jaw open/close, head tilt)
var animTimer = 0;
function animatronicIdleAnim() {
if (state !== STATE_MENU && state !== STATE_PLAY) return;
animTimer++;
if (animTimer % 90 === 0) {
// Open jaw
animatronic.animateJaw(1);
} else if (animTimer % 90 === 30) {
// Close jaw
animatronic.animateJaw(0);
}
if (animTimer % 180 === 0) {
// Tilt head randomly
var tilt = [-1, 0, 1][Math.floor(Math.random() * 3)];
animatronic.animateTilt(tilt);
}
}
// VHS static overlay always on top
game.children.sort(function (a, b) {
if (a === vhsStatic) return 1;
if (b === vhsStatic) return -1;
return 0;
});
// Main update
game.update = function () {
animatronic.update();
vhsStatic.update();
animatronicIdleAnim();
};
// Start at menu
showMenu(); ===================================================================
--- original.js
+++ change.js
@@ -236,17 +236,17 @@
var btnNewGame = new MenuButton();
btnNewGame.x = 2048 / 2;
btnNewGame.y = 600;
btnNewGame.setText('YENİ OYUN');
-// Language select button
-var btnLang = new MenuButton();
-btnLang.x = 2048 / 2;
-btnLang.y = 700;
-btnLang.setText('DİL: Türkçe');
var btnContinue = new MenuButton();
btnContinue.x = 2048 / 2;
btnContinue.y = 800;
btnContinue.setText('DEVAM ET');
+// Language select button (now below continue)
+var btnLang = new MenuButton();
+btnLang.x = 2048 / 2;
+btnLang.y = 950;
+btnLang.setText('DİL: Türkçe');
var continueNightText = new Text2('', {
size: 38,
fill: 0xFFFFFF
});
@@ -289,10 +289,10 @@
sixText.alpha = 0;
// Add menu UI to game
game.addChild(titleText);
game.addChild(btnNewGame);
-game.addChild(btnLang);
game.addChild(btnContinue);
+game.addChild(btnLang);
game.addChild(continueNightText);
// Add night info and test UI
game.addChild(nightText);
game.addChild(hourText);