User prompt
Please fix the bug: 'window.addEventListener is not a function' in or related to this line: 'window.addEventListener('keydown', function (e) {' Line Number: 444
User prompt
Player shall move with "W/A/S/D" or arrow keys.
Code edit (1 edits merged)
Please save this source code
User prompt
Tank Battle
Initial prompt
Make a game for me. First, this game shall be 2D. The name is Tank Battle. Player has 100 HP (this means the health). There is a health bar in the left down corner. This game is pixel art. This game has levels. The player is a tank. The player shoots normal shells. The player has infinite shells. Every one of shells hit the skin color tank 3 HP. Every one of shells hit the red tank 10 HP. Every one of shells hit the green tank 25 HP. There are the tank enemies: Skin Color Tank: This tank has 50 shells (After finished all the shells, doesn't shoot anymore and destroys itself with explode {It explodes in a circular area, the radius of the circle is 2 meters. {1 meter = 16 pixels, 1 block [ground] = Sixteen by sixteen pixels} Depending on the distance, if the player is directly next to the center of the circle, the player takes 95 HP damage. If the player is less than 1 meter and more than 0.5 meters from the center of the circle, the player takes 65 HP damage. If the player is less than 1.5 meters and more than 1 meter away, the player takes 40 HP damage. If the player is less than 2 meters and more than 1.5 meters away, they take 20 HP damage. }). This tank is skin color. This tank has 50 HP. And shoots armor-piercing and explosive shells. Every one of shells damage 5 HP when they touch the player. Red Tank: This tank has 75 dynamites (After finished all the dynamites, doesn't shoot anymore, gets faster, when catches the player, explodes itself {It damages 75 HP}). This tank is red. This tank has 80 HP. If this tank is so close to player, it exploses and damages the player 50 HP. Every one of dynamites damage 15 HP when they touch the player. Green Tank: This tank has 150 asid bombs (After finished all the asid bombs, doesn't shoot anymore, gets faster, when catches the player, explodes itself {It damages 75 HP}). When an asid bomb hit the player, it damages 45 HP and posions for 3 seconds. Every one second, it hits player 1 HP and stops after three seconds. In the levels, there is a portal. If player enters that portal, the level finishes and the player passes to the next level. There is a labyrinth created with walls. But there are random counted tank enemies random places. There can be spawned Skin Color Tanks between 5 and 20, there can be spawned Red Tanks between 10 and 30, there can be spawned Green Tanks between 20 and 25 in a level.
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 });
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
pixel art dynamite. In-Game asset. 2d. High contrast. No shadows
skin color tank pixel art top down. In-Game asset. 2d. High contrast. No shadows
green tank pixel art top down. In-Game asset. 2d. High contrast. No shadows
red tank pixel art top down. In-Game asset. 2d. High contrast. No shadows
blue tank pixel art top down. In-Game asset. 2d. High contrast. No shadows
pixel art bullet. In-Game asset. 2d. High contrast. No shadows
a green bomb (pixel art) writes "Acid" on it. In-Game asset. 2d. High contrast. No shadows
medkit pixel art. In-Game asset. 2d. High contrast. No shadows
dark green square 16*16 pixels pixel art. In-Game asset. 2d. High contrast. No shadows
orange circle pixel art. In-Game asset. 2d. High contrast. No shadows
A portal, outline is purple, and inside is magenta. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat pixel art
dark gray square 16*16 pixels pixel art.. In-Game asset. 2d. High contrast. No shadows
pixel art blackhole. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat