Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- player.weapon.name
- player.weapon.name
- // DOM Variables
- var equipButton = document.getElementById('equip-button');
- // UI Variables
- var equipQuery = false;
- // Player Variables
- var player = {
- name: "Player",
- health: 100,
- armor: 0,
- strength: 1,
- accuracy: 80,
- knowledge: 0,
- weapon: nothing,
- };
- equipButton.style.display = 'none';
- showStatus();
- // Button Handlers
- equipButton.addEventListener('click', function() {
- equipQuery = true;
- showStatus();
- });
- // Write Screen
- function showStatus() {
- if (equipQuery == true) { // Clicked Equip Button
- textArea.innerText = "You are wielding " + player.weapon.name;
- equipQuery = false; // Let's turn off the equip query
- equipButton.style.display = 'none'; // Sets the buttons such that the player can go back
- return;
- }
- textArea.innerText = "Your name is " + player.name; // Default Text
- }
- // Item Objects
- var sword = {
- name: "sword",
- bigname: "Sword",
- strength: 0,
- accuracy: 0,
- type: null,
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement