User prompt
Add grey horizontal line to the game to the upper quarter of the map
User prompt
Add grey horizontal line to the game to the upper quarter of the map
User prompt
Add a thick red ring to the map
User prompt
Add a red ring to the upper quarter of the map
User prompt
Move the red line down with 100 units
User prompt
Move the player place down with 50 units
User prompt
Add red horizontal line to the game to the lower quarter of the map
User prompt
Change the background colour from back to white
User prompt
Add grey vertical center line to the game
User prompt
Rename stone asset to blue stone
Initial prompt
curling
/****
* Classes
****/
// The assets will be automatically created and loaded by the LK engine
// Create a class for the curling stone
var CurlingStone = Container.expand(function () {
var self = Container.call(this);
var stoneGraphics = self.attachAsset('stone', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0;
self.direction = 0;
self.update = function () {
self.x += Math.cos(self.direction) * self.speed;
self.y += Math.sin(self.direction) * self.speed;
self.speed *= 0.99; // friction
if (self.speed < 0.1) self.speed = 0;
};
self.throw = function (speed, direction) {
self.speed = speed;
self.direction = direction;
};
});
// Create a class for the target
var Target = Container.expand(function () {
var self = Container.call(this);
var targetGraphics = self.attachAsset('target', {
anchorX: 0.5,
anchorY: 0.5
});
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
// Initialize the curling stone and the target
var stone = game.addChild(new CurlingStone());
stone.x = 2048 / 2;
stone.y = 2732 - 200;
var target = game.addChild(new Target());
target.x = 2048 / 2;
target.y = 200;
// Initialize the game state
var throwing = false;
var throwStart = null;
// Handle touch events
game.down = function (x, y, obj) {
throwing = true;
throwStart = {
x: x,
y: y
};
};
game.up = function (x, y, obj) {
if (throwing) {
var dx = x - throwStart.x;
var dy = y - throwStart.y;
var speed = Math.sqrt(dx * dx + dy * dy) / 100;
var direction = Math.atan2(dy, dx);
stone.throw(speed, direction);
throwing = false;
}
};
// Update the game state
game.update = function () {
if (stone.intersects(target)) {
LK.showGameOver();
}
};
black curling stone with pink top, top view.
Black curlingstone with purple top, top view.
Black curlingstone with yellow top, top view.
Black curlingstone with orange top, top view.
black curlingstone with neongreen top, top view.
Black curlingstone with neonblue top, top view.
add a text to the center: "Player vs Player"
neongreen rectangle with rounded corners, transparent in the middle.
Red button with white start text.