User prompt
Animatronik kulaklarını kaldır
User prompt
Kafayı biraz küçültüp yukarı çıkar
User prompt
Karıncalanma efektini tekrar düzenle
User prompt
Karıncalanma efektini geri düzenle ve karıncalanmada renk değişimi olmasın
User prompt
Çene animatronik kafasının arkasında dursun
User prompt
Gözleri ve burnunu kaldır
User prompt
Please fix the bug: 'ReferenceError: eyeL is not defined' in or related to this line: 'eyeL.x = 250 + headTilt * 10;' Line Number: 74
User prompt
Please fix the bug: 'ReferenceError: earL is not defined' in or related to this line: 'earL.rotation = headTilt * 0.10;' Line Number: 57
User prompt
Gözü burnunu ve kulakları kaldır
User prompt
Çene kafa modelinin arkasında dursun
User prompt
Animatroniği biraz yukarı çıkar
User prompt
Animatroniği ortala ve boyutunu iki katına çıkar
User prompt
Oyuna başladığımızda animatronik görükmesin
Code edit (1 edits merged)
Please save this source code
User prompt
FNAF: GECE VARDİYASI
Initial prompt
Bana bir fnaf fan oyunu yap. Oyunda ana menü olmalı. Yukarıda oyunun ismi büyük harflerle yazılmalı altında ise yeni oyun ve devam et yazmalı sadece yazı olacak ama arkada bir görsel olmamalı. Ekranda vhs kaseti gibi hafif bir karıncalanma efekti olmalı. Ekranın aşağısında karıncalanmanın ardında ise ekranın yüzde kırkını kaplayan oynak bir animatronik olmalı ağzını açıp kapamalı kafasını falan eğmeli ama animasyonsuz. Düz bakışı biraz uzun sürmeli diğer duruşları karelik şekilde glitch gibi anlık gelmeli . Oyun için ise başlat butonuna basınca başlamalı. Ve ekranda ani bir parlayıp biraz daha yavaş bi şekilde sönen yazı olmalı. Saati ve günü söylemeli. 12 ÖS ve hangi gecedeysek mesela üçüncü gecedeyiz: GECE 3 :12 Ö.S. demeli. Şu anlık test amaçlı oyun başladığında geceyi bitirmesi gereken bir tuş olmalı bastığımızda ise ekranda 06:00 yazmalı ve sonra ana menüye dönmeliyiz. Devam et tuşunun yanında daha küçük harflerle bir sonraki geceyi söylemeli. Ana menüdeki yazılar beyaz renk olmalı. Animatroniğin çenesi olmalı
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Animatronic class
var Animatronic = Container.expand(function () {
var self = Container.call(this);
// Ears
var earL = self.attachAsset('animatronicEarL', {
anchorX: 0.5,
anchorY: 1,
x: 180,
y: 60
});
var earR = self.attachAsset('animatronicEarR', {
anchorX: 0.5,
anchorY: 1,
x: 520,
y: 60
});
// Head
var head = self.attachAsset('animatronicHead', {
anchorX: 0.5,
anchorY: 0.5,
x: 350,
y: 250
});
// Eyes
var eyeL = self.attachAsset('animatronicEyeL', {
anchorX: 0.5,
anchorY: 0.5,
x: 250,
y: 210
});
var eyeR = self.attachAsset('animatronicEyeR', {
anchorX: 0.5,
anchorY: 0.5,
x: 450,
y: 210
});
// Pupils
var pupilL = self.attachAsset('animatronicPupilL', {
anchorX: 0.5,
anchorY: 0.5,
x: 250,
y: 210
});
var pupilR = self.attachAsset('animatronicPupilR', {
anchorX: 0.5,
anchorY: 0.5,
x: 450,
y: 210
});
// Nose
var nose = self.attachAsset('animatronicNose', {
anchorX: 0.5,
anchorY: 0.5,
x: 350,
y: 270
});
// Jaw
var jaw = self.attachAsset('animatronicJaw', {
anchorX: 0.5,
anchorY: 0,
x: 350,
y: 400
});
// 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;
earL.rotation = headTilt * 0.10;
earR.rotation = headTilt * 0.10;
// Eyes and pupils follow tilt
eyeL.x = 250 + headTilt * 10;
eyeR.x = 450 + headTilt * 10;
pupilL.x = 250 + headTilt * 18;
pupilR.x = 450 + headTilt * 18;
// Pupils: look straight, but can be offset for glitch
pupilL.y = 210;
pupilR.y = 210;
// Nose follows head
nose.x = 350 + headTilt * 8;
};
// Helper: set pupils offset (for glitch)
self.setPupilOffset = function (dx, dy) {
pupilL.x = 250 + self.headTilt * 18 + dx;
pupilR.x = 450 + self.headTilt * 18 + dx;
pupilL.y = 210 + dy;
pupilR.y = 210 + dy;
};
// 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.setPupilOffset(0, 0);
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
var pdx = -10 + Math.random() * 20;
var pdy = -10 + Math.random() * 20;
self.setPupilOffset(pdx, pdy);
};
// 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;
self.update = function () {
// Animate alpha and tint for static effect
staticNode.alpha = 0.06 + Math.random() * 0.07;
staticNode.tint = 0xffffff - Math.floor(Math.random() * 0x222222);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Button shape
// VHS static overlay
// Animatronic nose
// Animatronic right ear
// Animatronic left ear
// Animatronic right pupil
// Animatronic left pupil
// Animatronic right eye
// Animatronic left eye
// Animatronic jaw
// Animatronic body (main head)
// Game state
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 = 2.4; // double previous 1.2
// 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;
animatronic.baseY = 2732 - 500 * animatronicScale; // bottom of head at screen bottom
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');
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(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;
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;
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;
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);
// Show animatronic in night end
animatronic.visible = true;
}
// Update continue night text
function updateContinueNight() {
continueNightText.setText('gece ' + (currentNight + 1));
}
// 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();
};
btnContinue.down = function (x, y, obj) {
menuSelected = 1;
btnNewGame.setActive(false);
btnContinue.setActive(true);
// Continue game
currentNight += 1;
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
@@ -248,11 +248,13 @@
var currentNight = 1;
var currentHour = 12;
// Animatronic
var animatronic = new Animatronic();
-var animatronicScale = 1.2;
-animatronic.baseX = 2048 / 2 - 350 * animatronicScale / 2;
-animatronic.baseY = 2732 - 600 * animatronicScale;
+var animatronicScale = 2.4; // double previous 1.2
+// 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;
+animatronic.baseY = 2732 - 500 * animatronicScale; // bottom of head at screen bottom
animatronic.x = animatronic.baseX;
animatronic.y = animatronic.baseY;
animatronic.scaleX = animatronicScale;
animatronic.scaleY = animatronicScale;