This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ValidateSpanishID. Returns the type of document and checks its validity. | |
* | |
* Usage: | |
* ValidateSpanishID( str ); | |
* | |
* > ValidateSpanishID( '12345678Z' ); | |
* // { type: 'dni', valid: true } | |
* | |
* > ValidateSpanishID( 'B83375575' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g vue-cli | |
vue init webpack-simple pokemon-vue | |
cd pokemon-vue | |
npm install | |
npm run dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed'); | |
@import url('https://fonts.googleapis.com/css?family=PT+Sans+Narrow'); | |
html, body { | |
height: 100%; | |
background: #3C7ACD; | |
} | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
data(){ | |
return { | |
pokemon: { | |
opponent: { | |
image: "https://img.pokemondb.net/sprites/black-white/anim/normal/onix.gif", | |
name: 'Onyx', | |
hp: 100, | |
level: 50, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="battle-scene"> | |
<div class="bottom-menu"> | |
<div class="battle-text text-box-left"> | |
{{battleText}} | |
</div> | |
<div class="text-box-right"> | |
<!-- Show the main 4 options --> | |
<div v-if="menu == 'options'" id="battleOptions"> | |
<h4 @click="processOption(1)" class="battle-text-top-left">{{battleOptions[0]}}</h4> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
computed: { | |
fightOptions(){ | |
return Object.keys(this.pokemon.player.attacks); | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resetBattle: function () { | |
//reset data to start new game | |
this.menu = 'options'; | |
// Use a string literal to nicely render variables in your strings | |
// https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Template_literals | |
this.battleText = `What will ${this.pokemon.player.name} do?`; | |
this.pokemon.opponent.hp = 100; | |
this.pokemon.player.hp = 100; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
data(){ | |
return { | |
// Inverse pokemon type | |
opponent: this.type == 'player' ? 'opponent' : 'player', | |
// Pokemon image id (handy if needed in the future for applying effects) | |
pokemonImageId: this.type + '-pokemon', | |
// The main box's class, based on the position | |
boxClass: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
props: ['pokemon', 'position', 'type'], |
OlderNewer