User prompt
oyunu tam ekran yap
User prompt
top köşeye gidince maç otomatik yeniden başlasın,
User prompt
top köşelere gidince ortaya gelsin otomatik
User prompt
iki kalenin resimleri farklı olsun
User prompt
kalecilerin resimleri farklı olsun
User prompt
bot takımı kendi kalesine değil benim kaleme gol atmaya çalışsın
User prompt
6 ya 6 değil 1 e 1 olsun
User prompt
rakip takımın resmi farklı olsun
User prompt
oynanış daha gerçekci olsun ve kolay olsun kaleciler topu kurtarsın bizim takımı komple ben yönetim
User prompt
kalelere kaleci koy birer tane
User prompt
bir takımı biz kontrol edelim karşı takım topu bizim kaleye atmaya çalışsın
User prompt
dikeylemesine yap telefon için kalelerin yeri yatay değil dikey yerde olsun
User prompt
tema saha olsun
Code edit (1 edits merged)
Please save this source code
User prompt
6v6 Futbol Arenası
Initial prompt
futbol oyunu yap 6 ya 6 olsun 2 kale taç ve korner olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Ball class
var Ball = Container.expand(function () {
var self = Container.call(this);
// Attach ball asset (ellipse, white)
var ballAsset = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
// Ball properties
self.radius = ballAsset.width / 2;
self.vx = 0;
self.vy = 0;
self.friction = 0.98; // Ball slows down over time
// Update method (called every tick)
self.update = function () {
self.x += self.vx;
self.y += self.vy;
self.vx *= self.friction;
self.vy *= self.friction;
// Clamp speed to zero if very small
if (Math.abs(self.vx) < 0.1) self.vx = 0;
if (Math.abs(self.vy) < 0.1) self.vy = 0;
};
return self;
});
// Goal class
var Goal = Container.expand(function () {
var self = Container.call(this);
// Attach goal asset (rectangle)
var goalAsset = self.attachAsset('goal', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = goalAsset.width;
self.height = goalAsset.height;
return self;
});
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
// Attach player asset (circle, color depends on team)
var playerAsset = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = playerAsset.width / 2;
self.team = 0; // 0: left, 1: right
self.index = 0; // 0-5
self.isUser = false; // Only one player is user-controlled
// For AI: target position
self.targetX = self.x;
self.targetY = self.y;
// For user drag
self.isDragging = false;
// Update method
self.update = function () {
if (!self.isUser) {
// AI logic
if (self.team === 0) {
// TeamA AI: move toward ball (defend or support)
var dx = ball.x - self.x;
var dy = ball.y - self.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 80) {
self.x += dx / dist * 6;
self.y += dy / dist * 6;
}
} else {
// TeamB AI: attack user's goal (bottomGoal)
// If close to ball, move toward ball and try to shoot toward bottomGoal
var dx = ball.x - self.x;
var dy = ball.y - self.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 120) {
// Try to "kick" the ball toward bottomGoal if close enough
var goalDx = bottomGoal.x - ball.x;
var goalDy = bottomGoal.y - ball.y;
var goalDist = Math.sqrt(goalDx * goalDx + goalDy * goalDy);
if (goalDist > 0) {
// Simulate a kick if close enough to ball
if (dist < self.radius + ball.radius + 10) {
ball.vx += goalDx / goalDist * 4;
ball.vy += goalDy / goalDist * 4;
lastTeamTouched = 1;
}
}
// Move toward ball
self.x += dx / dist * 6;
self.y += dy / dist * 6;
} else {
// Move toward a position between ball and bottomGoal (attack position)
var attackX = ball.x;
var attackY = ball.y - 100;
var adx = attackX - self.x;
var ady = attackY - self.y;
var adist = Math.sqrt(adx * adx + ady * ady);
if (adist > 10) {
self.x += adx / adist * 4;
self.y += ady / adist * 4;
}
}
}
}
// Clamp inside field (vertical orientation)
if (self.x < field.left + self.radius) self.x = field.left + self.radius;
if (self.x > field.right - self.radius) self.x = field.right - self.radius;
if (self.y < field.top + self.radius) self.y = field.top + self.radius;
if (self.y > field.bottom - self.radius) self.y = field.bottom - self.radius;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a8f3c // Football field green
});
/****
* Game Code
****/
// Tween plugin for animations (not used in MVP but included for future use)
// Field dimensions (centered, vertical orientation)
var field = {
width: 1300,
height: 2000,
left: (2048 - 1300) / 2,
right: (2048 + 1300) / 2,
top: (2732 - 2000) / 2,
bottom: (2732 + 2000) / 2
};
// Draw field (rectangle, lines, center circle, etc.)
var fieldAsset = LK.getAsset('field', {
width: field.width,
height: field.height,
color: 0x2e7d32,
// More realistic football field green
shape: 'box',
x: field.left,
y: field.top
});
game.addChild(fieldAsset);
// Center line (horizontal now)
var centerLine = LK.getAsset('centerLine', {
width: 10,
height: field.height,
color: 0xffffff,
shape: 'box',
x: 2048 / 2 - 5,
y: field.top
});
game.addChild(centerLine);
// Penalty areas (top and bottom)
var penaltyWidth = 900;
var penaltyHeight = 300;
var topPenalty = LK.getAsset('penaltyAreaLeft', {
width: penaltyWidth,
height: penaltyHeight,
color: 0xffffff,
shape: 'box',
x: 2048 / 2 - penaltyWidth / 2,
y: field.top - 5
});
topPenalty.alpha = 0.12;
game.addChild(topPenalty);
var bottomPenalty = LK.getAsset('penaltyAreaRight', {
width: penaltyWidth,
height: penaltyHeight,
color: 0xffffff,
shape: 'box',
x: 2048 / 2 - penaltyWidth / 2,
y: field.bottom - penaltyHeight + 5
});
bottomPenalty.alpha = 0.12;
game.addChild(bottomPenalty);
// Goal areas (top and bottom)
var goalAreaWidth = 500;
var goalAreaHeight = 180;
var topGoalArea = LK.getAsset('goalAreaLeft', {
width: goalAreaWidth,
height: goalAreaHeight,
color: 0xffffff,
shape: 'box',
x: 2048 / 2 - goalAreaWidth / 2,
y: field.top - 5
});
topGoalArea.alpha = 0.18;
game.addChild(topGoalArea);
var bottomGoalArea = LK.getAsset('goalAreaRight', {
width: goalAreaWidth,
height: goalAreaHeight,
color: 0xffffff,
shape: 'box',
x: 2048 / 2 - goalAreaWidth / 2,
y: field.bottom - goalAreaHeight + 5
});
bottomGoalArea.alpha = 0.18;
game.addChild(bottomGoalArea);
// Penalty spots
var penaltySpotRadius = 18;
var topPenaltySpot = LK.getAsset('penaltySpotLeft', {
width: penaltySpotRadius * 2,
height: penaltySpotRadius * 2,
color: 0xffffff,
shape: 'ellipse',
x: 2048 / 2 - penaltySpotRadius,
y: field.top + 120
});
topPenaltySpot.alpha = 0.7;
game.addChild(topPenaltySpot);
var bottomPenaltySpot = LK.getAsset('penaltySpotRight', {
width: penaltySpotRadius * 2,
height: penaltySpotRadius * 2,
color: 0xffffff,
shape: 'ellipse',
x: 2048 / 2 - penaltySpotRadius,
y: field.bottom - 120 - penaltySpotRadius * 2
});
bottomPenaltySpot.alpha = 0.7;
game.addChild(bottomPenaltySpot);
// Center circle
var centerCircle = LK.getAsset('centerCircle', {
width: 320,
height: 320,
color: 0xffffff,
shape: 'ellipse',
x: 2048 / 2 - 160,
y: 2732 / 2 - 160
});
centerCircle.alpha = 0.25;
game.addChild(centerCircle);
// Center spot
var centerSpot = LK.getAsset('centerSpot', {
width: 24,
height: 24,
color: 0xffffff,
shape: 'ellipse',
x: 2048 / 2 - 12,
y: 2732 / 2 - 12
});
centerSpot.alpha = 0.7;
game.addChild(centerSpot);
// Corner arcs (for visual, not used in logic)
for (var i = 0; i < 4; i++) {
var cx = i < 2 ? field.left : field.right;
var cy = i % 2 === 0 ? field.top : field.bottom;
var cornerArc = LK.getAsset('cornerArc' + i, {
width: 60,
height: 60,
color: 0xffffff,
shape: 'ellipse',
x: cx - 30,
y: cy - 30
});
cornerArc.alpha = 0.15;
game.addChild(cornerArc);
}
// Goals (top and bottom)
var goalWidth = 400;
var goalHeight = 120;
var topGoal = new Goal();
var bottomGoal = new Goal();
topGoal.x = 2048 / 2;
topGoal.y = field.top - 20 + goalHeight / 2;
bottomGoal.x = 2048 / 2;
bottomGoal.y = field.bottom + 20 - goalHeight / 2;
topGoal.width = goalWidth;
topGoal.height = goalHeight;
bottomGoal.width = goalWidth;
bottomGoal.height = goalHeight;
game.addChild(topGoal);
game.addChild(bottomGoal);
// Ball
var ball = new Ball();
ball.x = 2048 / 2;
ball.y = 2732 / 2;
var ballAsset = ball.children[0];
ballAsset.width = 60;
ballAsset.height = 60;
ball.radius = 30;
ballAsset.color = 0xffffff;
game.addChild(ball);
// Teams
var teamA = [];
var teamB = [];
var playerRadius = 60;
var playerColors = [0x1e90ff, 0xff3333]; // Blue, Red
// Place teamA (top, blue)
for (var i = 0; i < 6; i++) {
var p = new Player();
var asset = p.children[0];
asset.width = playerRadius * 2;
asset.height = playerRadius * 2;
asset.color = playerColors[0];
p.radius = playerRadius;
p.team = 0;
p.index = i;
// Arrange in 2-2-2 formation (top half)
var row = Math.floor(i / 2);
var col = i % 2;
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.top + 300 + row * 150;
if (i === 0) {
p.isUser = true; // Only first player is user-controlled
} else {
p.isUser = false; // All other players are AI
}
teamA.push(p);
game.addChild(p);
}
// Place teamB (bottom, red)
for (var i = 0; i < 6; i++) {
var p = new Player();
var asset = p.children[0];
asset.width = playerRadius * 2;
asset.height = playerRadius * 2;
asset.color = playerColors[1];
p.radius = playerRadius;
p.team = 1;
p.index = i;
// Arrange in 2-2-2 formation (bottom half)
var row = Math.floor(i / 2);
var col = i % 2;
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.bottom - 300 - row * 150;
p.isUser = false; // All teamB are AI
teamB.push(p);
game.addChild(p);
}
// Score
var scoreA = 0;
var scoreB = 0;
var scoreTxt = new Text2('0 - 0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Game state
var lastTouch = {
x: 0,
y: 0
};
var draggingPlayer = null;
var throwInActive = false;
var throwInTeam = 0;
var throwInPos = {
x: 0,
y: 0
};
var cornerActive = false;
var cornerTeam = 0;
var cornerPos = {
x: 0,
y: 0
};
var lastTeamTouched = 0; // 0: teamA, 1: teamB
// Helper: check collision between two circles
function circlesCollide(ax, ay, ar, bx, by, br) {
var dx = ax - bx;
var dy = ay - by;
var dist = Math.sqrt(dx * dx + dy * dy);
return dist < ar + br;
}
// Helper: check if ball is in goal
function isGoal(ball, goal) {
return ball.y > goal.y - goal.height / 2 && ball.y < goal.y + goal.height / 2 && ball.x > goal.x - goal.width / 2 && ball.x < goal.x + goal.width / 2;
}
// Helper: reset positions after goal
function resetPositions() {
// Ball to center
ball.x = 2048 / 2;
ball.y = 2732 / 2;
ball.vx = 0;
ball.vy = 0;
// TeamA (top)
for (var i = 0; i < 6; i++) {
var p = teamA[i];
var row = Math.floor(i / 2);
var col = i % 2;
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.top + 300 + row * 150;
}
// TeamB (bottom)
for (var i = 0; i < 6; i++) {
var p = teamB[i];
var row = Math.floor(i / 2);
var col = i % 2;
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.bottom - 300 - row * 150;
}
}
// Helper: check if ball is out for throw-in or corner
function checkOutOfBounds() {
// Top/bottom (taç)
if (ball.y < field.top) {
throwInActive = true;
throwInTeam = 1; // Bottom team gets throw-in
throwInPos.y = field.top + ball.radius + 10;
throwInPos.x = Math.max(field.left + ball.radius + 10, Math.min(ball.x, field.right - ball.radius - 10));
ball.vx = 0;
ball.vy = 0;
ball.y = throwInPos.y;
ball.x = throwInPos.x;
} else if (ball.y > field.bottom) {
throwInActive = true;
throwInTeam = 0; // Top team gets throw-in
throwInPos.y = field.bottom - ball.radius - 10;
throwInPos.x = Math.max(field.left + ball.radius + 10, Math.min(ball.x, field.right - ball.radius - 10));
ball.vx = 0;
ball.vy = 0;
ball.y = throwInPos.y;
ball.x = throwInPos.x;
}
// Left/right (korner veya aut)
else if (ball.x < field.left) {
// If ball is between goal posts, it's a goal
if (ball.y > topGoal.y - topGoal.height / 2 && ball.y < topGoal.y + topGoal.height / 2) {
// Top goal
scoreB++;
scoreTxt.setText(scoreA + " - " + scoreB);
resetPositions();
return;
}
// Otherwise, corner or goal kick
if (ball.y < field.top + 200) {
// Top left corner
cornerActive = true;
cornerTeam = 1; // Bottom team gets corner
cornerPos.x = field.left + 30;
cornerPos.y = field.top + 30;
} else if (ball.y > field.bottom - 200) {
// Bottom left corner
cornerActive = true;
cornerTeam = 0; // Top team gets corner
cornerPos.x = field.left + 30;
cornerPos.y = field.bottom - 30;
} else {
// Goal kick (not implemented, treat as throw-in for now)
throwInActive = true;
throwInTeam = lastTeamTouched === 0 ? 1 : 0;
throwInPos.y = Math.max(field.top + ball.radius + 10, Math.min(ball.y, field.bottom - ball.radius - 10));
throwInPos.x = field.left + ball.radius + 10;
}
ball.vx = 0;
ball.vy = 0;
if (cornerActive) {
ball.x = cornerPos.x;
ball.y = cornerPos.y;
} else {
ball.x = throwInPos.x;
ball.y = throwInPos.y;
}
} else if (ball.x > field.right) {
// If ball is between goal posts, it's a goal
if (ball.y > bottomGoal.y - bottomGoal.height / 2 && ball.y < bottomGoal.y + bottomGoal.height / 2) {
// Bottom goal
scoreA++;
scoreTxt.setText(scoreA + " - " + scoreB);
resetPositions();
return;
}
// Otherwise, corner or goal kick
if (ball.y < field.top + 200) {
// Top right corner
cornerActive = true;
cornerTeam = 1; // Bottom team gets corner
cornerPos.x = field.right - 30;
cornerPos.y = field.top + 30;
} else if (ball.y > field.bottom - 200) {
// Bottom right corner
cornerActive = true;
cornerTeam = 0; // Top team gets corner
cornerPos.x = field.right - 30;
cornerPos.y = field.bottom - 30;
} else {
// Goal kick (not implemented, treat as throw-in for now)
throwInActive = true;
throwInTeam = lastTeamTouched === 0 ? 1 : 0;
throwInPos.y = Math.max(field.top + ball.radius + 10, Math.min(ball.y, field.bottom - ball.radius - 10));
throwInPos.x = field.right - ball.radius - 10;
}
ball.vx = 0;
ball.vy = 0;
if (cornerActive) {
ball.x = cornerPos.x;
ball.y = cornerPos.y;
} else {
ball.x = throwInPos.x;
ball.y = throwInPos.y;
}
}
}
// Touch/drag logic for user player
game.down = function (x, y, obj) {
// Only allow drag if not in throw-in/corner
if (throwInActive || cornerActive) return;
// Check if user player is touched
var userPlayer = teamA[0];
var dx = x - userPlayer.x;
var dy = y - userPlayer.y;
if (dx * dx + dy * dy < userPlayer.radius * userPlayer.radius) {
draggingPlayer = userPlayer;
draggingPlayer.isDragging = true;
lastTouch.x = x;
lastTouch.y = y;
}
};
game.move = function (x, y, obj) {
if (draggingPlayer && draggingPlayer.isDragging) {
// Move player with finger, clamp inside field (vertical)
draggingPlayer.x = Math.max(field.left + draggingPlayer.radius, Math.min(x, field.right - draggingPlayer.radius));
draggingPlayer.y = Math.max(field.top + draggingPlayer.radius, Math.min(y, field.bottom - draggingPlayer.radius));
lastTouch.x = x;
lastTouch.y = y;
}
};
game.up = function (x, y, obj) {
if (draggingPlayer && draggingPlayer.isDragging) {
// On release, if close to ball, kick it
var dx = ball.x - draggingPlayer.x;
var dy = ball.y - draggingPlayer.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < draggingPlayer.radius + ball.radius + 10) {
// Kick direction: from player to ball, magnitude based on drag
var kickVx = (ball.x - lastTouch.x) * 0.3;
var kickVy = (ball.y - lastTouch.y) * 0.3;
ball.vx += kickVx;
ball.vy += kickVy;
lastTeamTouched = 0;
}
draggingPlayer.isDragging = false;
draggingPlayer = null;
}
// Throw-in/corner logic
if (throwInActive) {
// Only allow throw-in by correct team
if (throwInTeam === 0) {
// Left team
var dx = x - ball.x;
var dy = y - ball.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 30) {
ball.vx = dx * 0.15;
ball.vy = dy * 0.15;
throwInActive = false;
}
}
if (throwInTeam === 1) {
// Right team
var dx = x - ball.x;
var dy = y - ball.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 30) {
ball.vx = dx * 0.15;
ball.vy = dy * 0.15;
throwInActive = false;
}
}
}
if (cornerActive) {
// Only allow corner by correct team
if (cornerTeam === 0) {
// Left team
var dx = x - ball.x;
var dy = y - ball.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 30) {
ball.vx = dx * 0.15;
ball.vy = dy * 0.15;
cornerActive = false;
}
}
if (cornerTeam === 1) {
// Right team
var dx = x - ball.x;
var dy = y - ball.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 30) {
ball.vx = dx * 0.15;
ball.vy = dy * 0.15;
cornerActive = false;
}
}
}
};
// Main game update
game.update = function () {
// Update all players
for (var i = 0; i < 6; i++) {
teamA[i].update();
teamB[i].update();
}
// Update ball
ball.update();
// Ball-player collision
for (var i = 0; i < 6; i++) {
var p = teamA[i];
var dx = ball.x - p.x;
var dy = ball.y - p.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < ball.radius + p.radius) {
// Push ball away
var overlap = ball.radius + p.radius - dist + 1;
var nx = dx / dist;
var ny = dy / dist;
ball.x += nx * overlap;
ball.y += ny * overlap;
// Ball velocity
ball.vx += nx * 2;
ball.vy += ny * 2;
lastTeamTouched = 0;
}
var p2 = teamB[i];
dx = ball.x - p2.x;
dy = ball.y - p2.y;
dist = Math.sqrt(dx * dx + dy * dy);
if (dist < ball.radius + p2.radius) {
var overlap = ball.radius + p2.radius - dist + 1;
var nx = dx / dist;
var ny = dy / dist;
ball.x += nx * overlap;
ball.y += ny * overlap;
ball.vx += nx * 2;
ball.vy += ny * 2;
lastTeamTouched = 1;
}
}
// Ball-wall collision (field boundaries)
if (ball.x < field.left + ball.radius) {
ball.x = field.left + ball.radius;
ball.vx = -ball.vx * 0.7;
}
if (ball.x > field.right - ball.radius) {
ball.x = field.right - ball.radius;
ball.vx = -ball.vx * 0.7;
}
if (ball.y < field.top + ball.radius) {
ball.y = field.top + ball.radius;
ball.vy = -ball.vy * 0.7;
}
if (ball.y > field.bottom - ball.radius) {
ball.y = field.bottom - ball.radius;
ball.vy = -ball.vy * 0.7;
}
// Check for goals
if (isGoal(ball, topGoal)) {
scoreB++;
scoreTxt.setText(scoreA + " - " + scoreB);
resetPositions();
return;
}
if (isGoal(ball, bottomGoal)) {
scoreA++;
scoreTxt.setText(scoreA + " - " + scoreB);
resetPositions();
return;
}
// Check for throw-in/corner
if (!throwInActive && !cornerActive) {
checkOutOfBounds();
}
// Win condition (first to 5)
if (scoreA >= 5) {
LK.showYouWin();
}
if (scoreB >= 5) {
LK.showGameOver();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -62,15 +62,52 @@
self.isDragging = false;
// Update method
self.update = function () {
if (!self.isUser) {
- // Simple AI: move toward ball
- var dx = ball.x - self.x;
- var dy = ball.y - self.y;
- var dist = Math.sqrt(dx * dx + dy * dy);
- if (dist > 80) {
- self.x += dx / dist * 6;
- self.y += dy / dist * 6;
+ // AI logic
+ if (self.team === 0) {
+ // TeamA AI: move toward ball (defend or support)
+ var dx = ball.x - self.x;
+ var dy = ball.y - self.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist > 80) {
+ self.x += dx / dist * 6;
+ self.y += dy / dist * 6;
+ }
+ } else {
+ // TeamB AI: attack user's goal (bottomGoal)
+ // If close to ball, move toward ball and try to shoot toward bottomGoal
+ var dx = ball.x - self.x;
+ var dy = ball.y - self.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist < 120) {
+ // Try to "kick" the ball toward bottomGoal if close enough
+ var goalDx = bottomGoal.x - ball.x;
+ var goalDy = bottomGoal.y - ball.y;
+ var goalDist = Math.sqrt(goalDx * goalDx + goalDy * goalDy);
+ if (goalDist > 0) {
+ // Simulate a kick if close enough to ball
+ if (dist < self.radius + ball.radius + 10) {
+ ball.vx += goalDx / goalDist * 4;
+ ball.vy += goalDy / goalDist * 4;
+ lastTeamTouched = 1;
+ }
+ }
+ // Move toward ball
+ self.x += dx / dist * 6;
+ self.y += dy / dist * 6;
+ } else {
+ // Move toward a position between ball and bottomGoal (attack position)
+ var attackX = ball.x;
+ var attackY = ball.y - 100;
+ var adx = attackX - self.x;
+ var ady = attackY - self.y;
+ var adist = Math.sqrt(adx * adx + ady * ady);
+ if (adist > 10) {
+ self.x += adx / adist * 4;
+ self.y += ady / adist * 4;
+ }
+ }
}
}
// Clamp inside field (vertical orientation)
if (self.x < field.left + self.radius) self.x = field.left + self.radius;
@@ -273,8 +310,10 @@
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.top + 300 + row * 150;
if (i === 0) {
p.isUser = true; // Only first player is user-controlled
+ } else {
+ p.isUser = false; // All other players are AI
}
teamA.push(p);
game.addChild(p);
}
@@ -292,8 +331,9 @@
var row = Math.floor(i / 2);
var col = i % 2;
p.x = field.left + (col + 1) * (field.width / 3);
p.y = field.bottom - 300 - row * 150;
+ p.isUser = false; // All teamB are AI
teamB.push(p);
game.addChild(p);
}
// Score