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);
// Add animatronic body (behind jaw and head)
var body = self.attachAsset('animatronicBody', {
anchorX: 0.5,
anchorY: 0,
x: 350,
y: 570
});
// 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.0;
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 = 0.0;
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();
// Kuklanın tüm parçalarını biraz küçült ve daha yukarı taşı
var animatronicScale = 1.25; // daha küçük
// Head asset is 700px wide, 500px tall, so center based on that
animatronic.baseX = 2048 / 2 - 700 * animatronicScale / 2;
// Daha yukarı taşı: 420 yerine 700 px yukarıda
animatronic.baseY = 2732 - 500 * animatronicScale - 700;
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;
// Calculate vertical gap between continue and new game buttons
var menuButtonGap = btnContinue.y - btnNewGame.y;
// Place language button the same gap below continue button
btnLang.y = btnContinue.y + menuButtonGap;
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();
// Set menu button texts to correct language
if (languages[currentLangIndex].code === 'en') {
btnNewGame.setText('NEW GAME');
btnContinue.setText('CONTINUE');
btnEndNight.setText('FINISH NIGHT');
} else {
btnNewGame.setText('YENİ OYUN');
btnContinue.setText('DEVAM ET');
btnEndNight.setText('GECEYİ BİTİR');
}
// 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);
// Update menu button texts based on language
if (languages[currentLangIndex].code === 'en') {
btnNewGame.setText('NEW GAME');
btnContinue.setText('CONTINUE');
btnEndNight.setText('FINISH NIGHT');
} else {
btnNewGame.setText('YENİ OYUN');
btnContinue.setText('DEVAM ET');
btnEndNight.setText('GECEYİ BİTİR');
}
// 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 (disable all except button areas)
game.down = function (x, y, obj) {
// Only allow button interactions, do nothing here
return;
};
// Touch up: disable all except button areas
game.up = function (x, y, obj) {
// Only allow button interactions, do nothing here
return;
};
// 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
@@ -326,11 +326,13 @@
// Set menu button texts to correct language
if (languages[currentLangIndex].code === 'en') {
btnNewGame.setText('NEW GAME');
btnContinue.setText('CONTINUE');
+ btnEndNight.setText('FINISH NIGHT');
} else {
btnNewGame.setText('YENİ OYUN');
btnContinue.setText('DEVAM ET');
+ btnEndNight.setText('GECEYİ BİTİR');
}
// Show animatronic in menu
animatronic.visible = true;
}
@@ -424,11 +426,13 @@
// Update menu button texts based on language
if (languages[currentLangIndex].code === 'en') {
btnNewGame.setText('NEW GAME');
btnContinue.setText('CONTINUE');
+ btnEndNight.setText('FINISH NIGHT');
} else {
btnNewGame.setText('YENİ OYUN');
btnContinue.setText('DEVAM ET');
+ btnEndNight.setText('GECEYİ BİTİR');
}
// Here you could add logic to update all UI text if you implement localization
};
btnContinue.down = function (x, y, obj) {