Code edit (1 edits merged)
Please save this source code
User prompt
speedcloud should have its own sprite
Code edit (6 edits merged)
Please save this source code
User prompt
create every 30/speed frame a small speedcloud left from the protagonist
User prompt
Please fix the bug: 'ReferenceError: failed is not defined' in or related to this line: 'if (!failed) {' Line Number: 146
Code edit (9 edits merged)
Please save this source code
User prompt
set the color of timerRect to red, when the flip was failed
User prompt
set a red color of self.timerRect
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
when a jump card is flipped, change the attribute isJumping of the protagonist to true and set his attribute jumpTimer to 60;
User prompt
the protagonist should be a class. Add one object of this class to the game
Code edit (1 edits merged)
Please save this source code
User prompt
I want a character named protagonist in the top center
Code edit (2 edits merged)
Please save this source code
User prompt
if (cards[i].activeTimer > 0) { cards[i].activeTimer--; // Decrease the color of the card and its attachments cards[i].sprite.alpha = cards[i].activeTimer / cards[i].activeTimerMax; } else { cards[i].sprite.alpha = 1; cards[i].unflip(); } i want a dark color, which runs from top to bottom while the card is active
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'alpha')' in or related to this line: 'cards[i].sprite.alpha = 1;' Line Number: 218
Code edit (6 edits merged)
Please save this source code
User prompt
for the update function, i just want to manipulate the alpha of this var sprite = self.attachAsset('jar' + self.type + 'Image', { anchorX: 0.5, anchorY: 0.5 });
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: timerRect is not defined' in or related to this line: 'cards[i].addChild(timerRect);' Line Number: 217
Code edit (1 edits merged)
Please save this source code
User prompt
the timerRect do nothing. It should decrease the colors of the card and its attachments
User prompt
Please fix the bug: 'TypeError: Graphics is not a constructor' in or related to this line: 'var timerRect = new Graphics();' Line Number: 217
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for Card
var Card = Container.expand(function () {
var self = Container.call(this);
var originalAsset = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
var cardGraphics = originalAsset; // Referenz für das aktuelle Asset
self.type = null;
self.idNumber = 0;
self.isFlipped = false;
self.activeTimerMax = 90;
self.activeTimer = 0;
self.canBePlayed = true;
self.flip = function () {
if (!self.isFlipped) {
self.isFlipped = true;
// Alle anderen Karten zurückflippen
//cards.forEach(function (c) {
// if (c.isFlipped) {
// c.isFlipped = false;
// c.cardGraphics = c.attachAsset('card', {
// anchorX: 0.5,
// anchorY: 0.5
// });
// }
//});
// Diese Karte flippen
LK.getSound('TurnCard').play();
self.isActive = true;
self.activeTimer = self.activeTimerMax;
cardGraphics = self.attachAsset('flippedCard', {
anchorX: 0.5,
anchorY: 0.5
});
// Add a sprite to the card when it is flipped
var sprite = self.attachAsset('jar' + self.type + 'Image', {
anchorX: 0.5,
anchorY: 0.5
});
}
};
self.unflip = function () {
if (self.isFlipped) {
self.isFlipped = false;
self.cardGraphics = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
}
};
self.on('down', function (x, y, obj) {
if (self.canBePlayed) {
self.flip();
}
});
self.setType = function (type) {
self.type = type;
};
self.setId = function (number) {
self.idNumber = number;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var cards = [];
var cardTypes = ['Boot', 'Jump', 'Shield', 'Fist', 'Knife', 'Hammer', 'Trap'];
var score = 0;
var cardInformation = [{
name: 'dog',
beats: ['cat', 'bird'],
speed: 2,
canJump: true,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: false
}, {
name: 'cat',
beats: ['rat', 'bird'],
speed: 2,
canJump: true,
canClimb: true,
canSwim: false,
canFly: false,
canBreak: false
}, {
name: 'rat',
beats: ['elephant'],
speed: 2,
canJump: true,
canClimb: true,
canSwim: true,
canFly: false,
canBreak: false
}, {
name: 'bird',
beats: ['rat'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: true,
canBreak: false
}, {
name: 'boar',
beats: ['rat', 'cat', 'dog'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: true
}, {
name: 'elephant',
beats: ['cat', 'dog', 'boar'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: true
}];
// Create and position cards
function createCards() {
var cardTypes = ['Boot', 'Boot', 'Boot', 'Jump', 'Jump', 'Fist', 'Knife', 'Knife'];
//var cardTypes = ['boot', 'cat', 'rat', 'mysticHand', 'bird', 'elephant', 'boar', 'magnifier'];
//cardTypes = cardTypes.concat(cardTypes); // duplicate the array
cardTypes.sort(function () {
return Math.random() - 0.5;
}); // shuffle the array
for (var i = 0; i < 8; i++) {
var card = new Card();
card.x = (game.width - 2 * 500) / 2 + i % 4 * 360; // Center the cards horizontally with increased margin
card.y = game.height - 4 * 400 + Math.floor(i / 4) * 420 + 100; // Position the cards at the bottom center with increased margin
card.setType(cardTypes[i]);
card.setId(i);
cards.push(card);
game.addChild(card);
if (cardTypes[i] === 'Boot') {
card.activeTimerMax = 300;
}
}
}
// Check if selected cards match
function checkMatch() {}
// Attach the background images to the game
var topBackground = game.attachAsset('topBackground', {
anchorX: 0.5,
anchorY: 0.0,
x: game.width / 2,
y: -500
});
var bottomBackground = game.attachAsset('bottomBackground', {
anchorX: 0.5,
anchorY: 1.0,
x: game.width / 2,
y: game.height + 100
});
// Initialize game
createCards();
// Update game state
game.update = function () {
for (var i = 0; i < cards.length; i++) {
if (cards[i].isFlipped) {
if (cards[i].activeTimer > 0) {
cards[i].activeTimer--;
// Create a dark rectangle as timer
var timerRect;
cards[i].addChild(timerRect);
} else {
cards[i].unflip();
}
}
}
};
// Play main theme
theme = 'MainTheme';
LK.playMusic(theme, {
loop: true
}); /****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for Card
var Card = Container.expand(function () {
var self = Container.call(this);
var originalAsset = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
var cardGraphics = originalAsset; // Referenz für das aktuelle Asset
self.type = null;
self.idNumber = 0;
self.isFlipped = false;
self.activeTimerMax = 90;
self.activeTimer = 0;
self.canBePlayed = true;
self.flip = function () {
if (!self.isFlipped) {
self.isFlipped = true;
// Alle anderen Karten zurückflippen
//cards.forEach(function (c) {
// if (c.isFlipped) {
// c.isFlipped = false;
// c.cardGraphics = c.attachAsset('card', {
// anchorX: 0.5,
// anchorY: 0.5
// });
// }
//});
// Diese Karte flippen
LK.getSound('TurnCard').play();
self.isActive = true;
self.activeTimer = self.activeTimerMax;
cardGraphics = self.attachAsset('flippedCard', {
anchorX: 0.5,
anchorY: 0.5
});
// Add a sprite to the card when it is flipped
var sprite = self.attachAsset('jar' + self.type + 'Image', {
anchorX: 0.5,
anchorY: 0.5
});
}
};
self.unflip = function () {
if (self.isFlipped) {
self.isFlipped = false;
self.cardGraphics = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
}
};
self.on('down', function (x, y, obj) {
if (self.canBePlayed) {
self.flip();
}
});
self.setType = function (type) {
self.type = type;
};
self.setId = function (number) {
self.idNumber = number;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var cards = [];
var cardTypes = ['Boot', 'Jump', 'Shield', 'Fist', 'Knife', 'Hammer', 'Trap'];
var score = 0;
var cardInformation = [{
name: 'dog',
beats: ['cat', 'bird'],
speed: 2,
canJump: true,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: false
}, {
name: 'cat',
beats: ['rat', 'bird'],
speed: 2,
canJump: true,
canClimb: true,
canSwim: false,
canFly: false,
canBreak: false
}, {
name: 'rat',
beats: ['elephant'],
speed: 2,
canJump: true,
canClimb: true,
canSwim: true,
canFly: false,
canBreak: false
}, {
name: 'bird',
beats: ['rat'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: true,
canBreak: false
}, {
name: 'boar',
beats: ['rat', 'cat', 'dog'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: true
}, {
name: 'elephant',
beats: ['cat', 'dog', 'boar'],
speed: 2,
canJump: false,
canClimb: false,
canSwim: true,
canFly: false,
canBreak: true
}];
// Create and position cards
function createCards() {
var cardTypes = ['Boot', 'Boot', 'Boot', 'Jump', 'Jump', 'Fist', 'Knife', 'Knife'];
//var cardTypes = ['boot', 'cat', 'rat', 'mysticHand', 'bird', 'elephant', 'boar', 'magnifier'];
//cardTypes = cardTypes.concat(cardTypes); // duplicate the array
cardTypes.sort(function () {
return Math.random() - 0.5;
}); // shuffle the array
for (var i = 0; i < 8; i++) {
var card = new Card();
card.x = (game.width - 2 * 500) / 2 + i % 4 * 360; // Center the cards horizontally with increased margin
card.y = game.height - 4 * 400 + Math.floor(i / 4) * 420 + 100; // Position the cards at the bottom center with increased margin
card.setType(cardTypes[i]);
card.setId(i);
cards.push(card);
game.addChild(card);
if (cardTypes[i] === 'Boot') {
card.activeTimerMax = 300;
}
}
}
// Check if selected cards match
function checkMatch() {}
// Attach the background images to the game
var topBackground = game.attachAsset('topBackground', {
anchorX: 0.5,
anchorY: 0.0,
x: game.width / 2,
y: -500
});
var bottomBackground = game.attachAsset('bottomBackground', {
anchorX: 0.5,
anchorY: 1.0,
x: game.width / 2,
y: game.height + 100
});
// Initialize game
createCards();
// Update game state
game.update = function () {
for (var i = 0; i < cards.length; i++) {
if (cards[i].isFlipped) {
if (cards[i].activeTimer > 0) {
cards[i].activeTimer--;
// Create a dark rectangle as timer
var timerRect;
cards[i].addChild(timerRect);
} else {
cards[i].unflip();
}
}
}
};
// Play main theme
theme = 'MainTheme';
LK.playMusic(theme, {
loop: true
});
Cardback with the Symbol ♾️ on it. Single Game Texture. In-Game asset. 2d. High contrast. No shadows.
A cardback in brown empy color with mystical corners. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A good but dangerous elephant. Warcraft 3 art. Single Game Texture. In-Game asset. 2d. High contrast. No shadows.
A good but dangerous falcon. Warcraft 3 art. Single Game Texture. In-Game asset. 2d. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A good but dangerous boar. Warcraft 3 art. Single Game Texture. In-Game asset. 2d. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A good but dangerous cat. Warcraft 3 art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A good but dangerous magnifier. Warcraft 3 art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mystical spirit hand. Warcraft 3 art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A good but dangerous rat. Warcraft 3 art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A wooden play board with leaves. Fantasy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mystical rectangle fantasy board with leaves.
Warcraft 3 art of a boot. Side-view.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Warcraft 3 art of a hammer.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Warcraft 3 image of a bow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Warcraft 3 image of an arrow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Warcraft 3 image of a medieval arrow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Warcraft 3 art of a shield.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
warcraft 3 art of a fist.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.