Code edit (12 edits merged)
Please save this source code
User prompt
create new images: 'jarBootImage', 'jarArrowImage', 'jarBowImage', 'jarHammerImage', 'jarFistImage', 'jarJumpImage', 'jarShieldImage'
Code edit (3 edits merged)
Please save this source code
User prompt
Add twi background images. One for the top and one for bottom
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.typecharAt is not a function' in or related to this line: 'var sprite = self.attachAsset('card' + self.typecharAt(0).toUpperCase() + 'Image', {' Line Number: 59
Code edit (1 edits merged)
Please save this source code
User prompt
add images for each card type
User prompt
when a card is flipped, add a further sprite on it, which is named after the type of the card
Code edit (1 edits merged)
Please save this source code
User prompt
create a function for card, which is triggered, when they are clicked. This function should be empty
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'down')' in or related to this line: 'self.down = function (x, y, obj) {' Line Number: 93
User prompt
die funktion, die du für game.down gemacht hast funtkioniert nicht. Setze sie als down listener für Card ein und pass ihn entsprechend an
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'setTexture')' in or related to this line: 'self.cardGraphics.setTexture(flippedAsset);' Line Number: 48
User prompt
Please fix the bug: 'Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 't.Stage' --- property 'stage' closes the circle' in or related to this line: 'self.cardGraphics = self.attachAsset(flippedAsset, {});' Line Number: 48
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'setAsset')' in or related to this line: 'self.cardGraphics.setAsset(flippedAsset);' Line Number: 48
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'setTexture')' in or related to this line: 'self.cardGraphics.setTexture(flippedAsset);' Line Number: 48
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'setAsset')' in or related to this line: 'self.cardGraphics.setAsset = flippedAsset;' Line Number: 48
Code edit (1 edits merged)
Please save this source code
User prompt
add a function to LK.playMusic, which change the global variable theme to 'MainThemeB', when one loop is finished
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'LK.getMusic is not a function' in or related to this line: 'LK.getMusic('MainTheme').on('end', function () {' Line Number: 109
User prompt
Each theme has a duration of 60 seconds
User prompt
Please fix the bug: 'LK.getMusic is not a function' in or related to this line: 'LK.setTimeout(function () {' Line Number: 106
/****
* 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 cardGraphics = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
self.type = null;
self.isFlipped = false;
self.flip = function () {
if (!self.isFlipped) {
cards.forEach(function (c) {
c.isFlipped = false;
c.setAsset = c.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
});
// Play turn card sound
LK.getSound('TurnCard').play();
self.isFlipped = true;
cardGraphics.setAsset = self.attachAsset('flippedCard', {
anchorX: 0.5,
anchorY: 0.5
});
} else {}
};
self.setType = function (type) {
self.type = type;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var cards = [];
var selectedCards = [];
var cardTypes = ['dog', 'cat', 'rat', 'mysticHand', 'bird', 'elephant', 'boar', 'magnifier'];
var score = 0;
// Create and position cards
function createCards() {
var cardTypes = ['dog', '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 < 16; 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]);
cards.push(card);
game.addChild(card);
}
}
// Check if selected cards match
function checkMatch() {}
// Initialize game
createCards();
// Add event listeners
game.down = function (x, y, obj) {
var localPos = game.toLocal(obj.global);
cards.forEach(function (card) {
if (card.getBounds().contains(localPos.x, localPos.y)) {
if (!card.isFlipped) {
card.flip();
}
}
});
};
// Update game state
game.update = function () {};
// Play main theme
LK.playMusic('MainTheme', {
loop: false
});
LK.getAsset('MainTheme', {}).on('end', function () {
LK.playMusic('SecondTheme', {
loop: false
});
LK.getAsset('SecondTheme', {}).on('end', function () {
LK.playMusic('ThirdTheme', {
loop: false
});
LK.getAsset('ThirdTheme', {}).on('end', function () {
LK.playMusic('FourthTheme', {
loop: false
});
});
});
});
; ===================================================================
--- original.js
+++ change.js
@@ -86,17 +86,17 @@
// Play main theme
LK.playMusic('MainTheme', {
loop: false
});
-LK.getMusic('MainTheme').on('end', function () {
+LK.getAsset('MainTheme', {}).on('end', function () {
LK.playMusic('SecondTheme', {
loop: false
});
- LK.getMusic('SecondTheme').on('end', function () {
+ LK.getAsset('SecondTheme', {}).on('end', function () {
LK.playMusic('ThirdTheme', {
loop: false
});
- LK.getMusic('ThirdTheme').on('end', function () {
+ LK.getAsset('ThirdTheme', {}).on('end', function () {
LK.playMusic('FourthTheme', {
loop: false
});
});
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.