Skip to content

Commit

Permalink
animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Richwhat89 committed Jan 29, 2019
1 parent 4e483a1 commit 8bdb22a
Show file tree
Hide file tree
Showing 11 changed files with 722 additions and 55 deletions.
495 changes: 493 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"express": "^4.16.4",
"express-session": "^1.15.6",
"massive": "^5.7.2",
"node-sass": "^4.11.0",
"promise-middleware": "^1.0.7",
"react": "^16.7.0",
"react-chartjs-2": "^2.7.4",
Expand All @@ -23,6 +24,7 @@
"react-sound": "^1.2.0",
"redux": "^4.0.1",
"redux-promise-middleware": "^5.1.1",
"sass": "^1.16.1",
"scss": "^0.2.4",
"typeface-roboto": "0.0.54"
},
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
-->

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link href="https://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet">

<title>React App</title>
</head>
Expand Down
1 change: 1 addition & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
color: black;
min-width: 100vw;
min-height: 100vh;
font-family: 'Permanent Marker', cursive;
}

1 change: 1 addition & 0 deletions src/components/Dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
flex-direction: column;
height: 75vh;
margin-bottom: 40vh;
font-family: 'Permanent Marker', cursive;
}
2 changes: 2 additions & 0 deletions src/components/Home.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@

.title{
font-size: 20vh;
font-family: 'Permanent Marker', cursive;

}
131 changes: 89 additions & 42 deletions src/rooms/Dungeon.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/rooms/Dungeon.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions src/rooms/Dungeon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Link, Redirect} from 'react-router-dom';
import {connect} from 'react-redux';
import axios from 'axios';
import {getHero, getDungeon, login} from '../ducks/reducer';
import {getHero, getDungeon, login, changeUser} from '../ducks/reducer';

import './Dungeon.css';

Expand Down Expand Up @@ -31,7 +31,8 @@ class Dungeon extends Component{
monsterType: '',
attack: 1,
killCount: 0,
endToggle: false
endToggle: false,
enemyImage: 'img_enemy'
};
}

Expand All @@ -45,8 +46,8 @@ class Dungeon extends Component{
rndRoom=()=>
axios
.get('/api/rndRoom')
.then(response=>{console.log(response); this.monster(); this.multiplier()
this.setState({room_id: response.data.room_id, setting: response.data.setting, praiseToggle: false, meanToggle: false, hideTrueFalse: false, hideText: true, isHidden: true, question: '', hideDirections: true, attack: 1}, ()=>{this.multiplier()})
.then(response=>{console.log(response); this.multiplier()
this.setState({room_id: response.data.room_id, setting: response.data.setting, praiseToggle: false, meanToggle: false, hideTrueFalse: false, hideText: true, isHidden: true, question: '', hideDirections: true, attack: 1, enemyImage: this.state.enemyImage === 'img_enemy' ? 'img_enemy2': 'img_enemy'}, ()=>{this.multiplier(); this.monster()})
})

event=()=>
Expand Down Expand Up @@ -93,6 +94,12 @@ class Dungeon extends Component{

gameOver=()=>{this.props.getDungeon(this.state); this.setState({endToggle: this.state.points <= 0 ? true : null})}

logout=()=>{
this.props.changeUser()
axios
.get('/auth/user')
}

render(){
console.log(this.props)
console.log(this.state.monsterHealth)
Expand Down Expand Up @@ -129,18 +136,18 @@ class Dungeon extends Component{
<div className='hero'>
<p>{this.props.hero.class}</p>
<p>{this.state.points}</p>
<img src={this.props.hero.sprite} ref='herosprite' className='img'></img>
<img src={this.props.hero.sprite} ref='herosprite' className='img_hero'></img>
</div>

<div className='enemy'>
<p>{this.state.monsterType}</p>
<p>{this.state.monsterHealth}</p>
<img src={this.state.sprite} ref='enemysprite' className='img_enemy'></img>
<img src={this.state.sprite} ref='enemysprite' className={this.state.enemyImage}></img>
</div>

</div>
<p>Kill count: {this.state.killCount}</p>
<Link to='/'><Button variant="contained">Exit</Button></Link>
<Link to='/'><Button variant="contained" onClick={()=>this.logout()}>Exit</Button></Link>
{this.state.endToggle ? <Redirect to='/end'/> : null}
</div>
</div>
Expand All @@ -157,4 +164,4 @@ const mapStateToProps = (state) => {
}
}

export default connect(mapStateToProps, {getHero, login, getDungeon})(Dungeon);
export default connect(mapStateToProps, {getHero, login, getDungeon, changeUser})(Dungeon);
108 changes: 108 additions & 0 deletions src/rooms/Dungeon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
$primary-color: #d3d3d3;
$img-height: 130px;
$img-width: 130px;

.background {
background-image: url("https://s3.us-east-2.amazonaws.com/personalproject89/dungeon+background.jpg");
background-color: black;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 100vh;
color: $primary-color;
}

.stuff {
display: flex;
flex-direction: column;
height: 40vh;
margin-bottom: 25vh;
justify-content: center;
color: $primary-color;
font-weight: bolder;
/* border: 1px solid white; */
}

.question{
font-size: 3vh;
font-weight: bolder;
font-family: 'Permanent Marker', cursive;
}

@mixin transform($property){
-webkit-transform: $property;
-ms-transform: $property;
transform: translateX($property);
}

@keyframes onClick{
0%{
@include transform(40vw)
}
100%{
@include transform(0vw)
}
}

@keyframes onClick2{
0%{
@include transform(40vw)
}
100%{
@include transform(0vw)
}
}

@keyframes heroClick{
0%{
@include transform(-40vw)
}
100%{
@include transform(5vw)
}
}


.enemy{
height: 200px;
width: 150px;
/* border: 1px solid white; */
// transition: onClick 1s linear;

}

.img_hero{
height: $img-height;
width: $img-width;
/* border: 1px solid white; */
animation: heroClick 1s ease-in;
}

.img_enemy {
height: $img-height;
width: $img-width;
image-rendering: pixelated;
animation: onClick 1s ease-in;
}

.img_enemy2 {
height: $img-height;
width: $img-width;
image-rendering: pixelated;
animation: onClick2 1s ease-in;
}

.battle{
display: flex;
flex-direction: row;
// border: 1px solid black;
width: 100vw;
height: 40vh;
justify-content: space-evenly;
/* background-color: black;
background-image: linear-gradient(purple, black);
background-size: contain; */
}



Loading

0 comments on commit 8bdb22a

Please sign in to comment.