Skip to content

Commit

Permalink
Add character speed and attack
Browse files Browse the repository at this point in the history
Add character class with speed and attack properties and methods to increase them.

* **Character Class**
  - Create `Character` class with `speed` and `attack` properties.
  - Add methods `increaseSpeed` and `increaseAttack` to increase speed and attack respectively.

* **Character Tests**
  - Add tests for `increaseSpeed` and `increaseAttack` methods in `character.test.ts`.

* **Character Styles**
  - Add CSS styles for character, speed indicator, and attack indicator in `character.css`.

* **Character HTML**
  - Add HTML structure to display character with speed and attack indicators in `character.html`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/vscode/tree/169?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
faraon-bot committed Dec 31, 2024
1 parent e28a92f commit e9f38e5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/vs/workbench/contrib/character/character.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.character {
display: flex;
flex-direction: column;
align-items: center;
}

.speed-indicator,
.attack-indicator {
margin: 5px;
padding: 10px;
border: 1px solid #000;
border-radius: 5px;
background-color: #f0f0f0;
}

.speed-indicator {
color: #007bff;
}

.attack-indicator {
color: #dc3545;
}
16 changes: 16 additions & 0 deletions src/vs/workbench/contrib/character/character.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Character</title>
<link rel="stylesheet" href="character.css">
</head>
<body>
<div class="character">
<div class="speed-indicator">Speed: <span id="speed">10</span></div>
<div class="attack-indicator">Attack: <span id="attack">5</span></div>
</div>
<script src="character.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions src/vs/workbench/contrib/character/character.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Character } from './character';

describe('Character', () => {
let character: Character;

beforeEach(() => {
character = new Character(10, 5);
});

it('should increase speed', () => {
character.increaseSpeed(5);
assert.equal(character.speed, 15);
});

it('should increase attack', () => {
character.increaseAttack(3);
assert.equal(character.attack, 8);
});
});
17 changes: 17 additions & 0 deletions src/vs/workbench/contrib/character/character.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export class Character {
speed: number;
attack: number;

constructor(speed: number, attack: number) {
this.speed = speed;
this.attack = attack;
}

increaseSpeed(amount: number): void {
this.speed += amount;
}

increaseAttack(amount: number): void {
this.attack += amount;
}
}

0 comments on commit e9f38e5

Please sign in to comment.