User prompt
Tire os heart_icon de spawnar na cena
User prompt
Remover heart icon display spawn
User prompt
Coloque em cima do Pato
User prompt
Como falado, o Pato tem 3 corações, que representa a vida.
User prompt
Ok, crie uma variável escopo global.
User prompt
I created more itens!
User prompt
Please fix the bug: 'ReferenceError: bullets is not defined' in or related to this line: 'for (var i = bullets.length - 1; i >= 0; i--) {' Line Number: 113
User prompt
Destroy bullet when reload, and create bullet after reload
User prompt
3000 milisseconds
User prompt
2300 milisseconds
User prompt
Remove sound reload delay
User prompt
You have 3 bullets, can reload automaticamente after 1800 milisseconds
User prompt
Add a Notice Text:warning! loud sound
User prompt
Global scope that
User prompt
No heart variable, points variable
User prompt
Place the variable
User prompt
Add the Classic variable
User prompt
Add points variable
User prompt
Place the new sound (jump i created)
User prompt
Now place the sounds
User prompt
Singitutically decrease the player attack speed
User prompt
Enemy spawn every 3 seconds.
User prompt
Enemy ho to left
User prompt
Place the enemy in ground and in right
User prompt
Not in up enemy
/****
* Classes
****/
// Bullet class representing the bullets shot by the player
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('Yellow_bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.x += self.speed;
if (self.y < -50) {
self.destroy();
}
};
});
// Enemy class representing the enemies in the game
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('Enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
// Enemy stays in place
};
});
// Update function to apply velocity and rotation
// Player class representing the main character
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('Duck', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
// Apply gravity
self.speed += 0.5; // Gravity pulling down
self.y += self.speed; // Apply gravity to vertical speed
// Check if player is on the ground
if (self.y > ground.y - self.height / 2) {
self.y = ground.y - self.height / 2; // Correct position
self.speed = 0; // Stop moving downwards
}
// Check for shooting
if (LK.ticks % 30 === 0) {
self.shoot();
}
// Check for collision with enemies
for (var i = enemies.length - 1; i >= 0; i--) {
if (self.intersects(enemies[i])) {
enemies[i].destroy();
enemies.splice(i, 1);
// Handle player damage or game over logic
}
}
};
self.shoot = function () {
// Logic for shooting bullets
var bullet = new Bullet();
bullet.x = self.x;
bullet.y = self.y;
game.addChild(bullet);
};
});
/****
* Initialize Game
****/
//<Assets used in the game will automatically appear here>
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Initialize up button
var upButton = LK.getAsset('Up', {
anchorX: 0.5,
anchorY: 0.5,
x: 400,
y: 2600
});
game.addChild(upButton);
upButton.down = function (x, y, obj) {
if (player.y >= ground.y - player.height / 2) {
// If player is on the ground
player.speed = -20; // Apply upward force
// Add more dust effect when player jumps
for (var i = 0; i < 3; i++) {
var dust = LK.getAsset('dust', {
anchorX: 0.5,
anchorY: 0.5,
x: player.x + i * 20,
y: player.y + player.height / 2,
scaleX: 0.3,
scaleY: 0.3
});
game.addChild(dust);
// Update dust position to follow player's jump
dust.update = function () {
dust.y = player.y + player.height / 2;
};
// Remove dust effect after 500ms
LK.setTimeout(function () {
dust.destroy();
}, 500);
}
}
};
// Add a button to skip the introduction;
var yourGoalText;
// Initialize ground
var ground = LK.getAsset('Ground', {
anchorX: 0.5,
anchorY: 1.0,
x: 1024,
y: 2500
});
game.addChild(ground);
// Initialize player, enemies, and TV channels
var player = game.addChild(new Player());
player.x = 200; // Place the duck in left
player.y = ground.y - ground.height - player.height / 2;
var enemies = [];
var enemy = game.addChild(new Enemy());
enemy.x = 0;
enemy.y = 200;
enemies.push(enemy);
// Create TV channels
// Play background music and display 'Your Goal' text after 10 seconds
var introTimeout = LK.setTimeout(function () {
LK.playMusic('Background_music');
}, 10000);
// Add a button to skip the introduction
Title game:duck with a gun. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Duck with a gun title logo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Yellow_bullet pixel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Red dot with white in the middle pixel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Mana_icon pixel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Enemy pixel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White_bullet_icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
duck_death. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
duck_revive_in_game_over. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Continue_button_spending_gems. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Powerup_1. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Scenario. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Enemy pixel_2 more strong.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Danger sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.