Skip to content

Commit f8a3e7d

Browse files
committed
modified styles
1 parent 8215a11 commit f8a3e7d

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

src/board/board.css

+20-8
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
top:0px;
2626
position: absolute;
2727
width: fit-content;
28-
outline: 2px solid rgb(134,154,189);
29-
background-color: #282c34;
30-
margin-left: 148px;
28+
border-radius: 8px;
29+
border: 8px solid rgb(153, 37, 37);
30+
background-color: #282c34d3;
31+
margin-left: 130px;
3132
margin-right: auto;
32-
margin-top: 100px;
33+
margin-top: 90px;
3334
}
3435

3536
.row{
@@ -39,16 +40,27 @@
3940
.cell{
4041
width: 40px;
4142
height: 40px;
42-
outline: 1px solid rgb(134,154,189);
43+
border: 1px dotted rgb(153, 141, 88);
4344
display:inline-block;
4445
}
4546

4647
.cell-green{
47-
background-color: green;
48+
outline: none;
49+
background-color:#78ca0dab;
4850
}
51+
4952
.cell-red{
50-
background-color: red;
53+
/* background-color: tan; */
54+
/* border-radius: 14px; */
55+
background-image:url("../assets/apple.png");
56+
/* height: 40px;
57+
width: 40px; */
58+
background-size: contain;
59+
/* background-color: red; */
5160
}
5261
.cell-purple{
53-
background-color: purple;
62+
/* background-color: purple; */
63+
background-image: url("../assets/frog.png");
64+
background-size: contain;
65+
5466
}

src/board/board.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import {
1313
import {useInterval} from '../utils/intervalUtil';
1414
import './board.css';
1515
import Aside from './aside';
16-
import scoreBoardImg from '../assets/borderGolden.png'
17-
import GreenBoard from '../assets/borderLeaves.png'
16+
import scoreBoardImg from '../assets/borderGolden.png';
17+
import appleImg from '../assets/apple.png';
18+
import GreenBoard from '../assets/borderLeaves.png';
19+
import frogImg from '../assets/frog.png';
1820
const BOARD_SIZE=13;
1921
const PROBABILITY_OF_DIRECTION_REVERSAL_FOOD=0.3;
2022

@@ -179,7 +181,11 @@ const Board=()=>{
179181

180182
setFoodCell(nextFoodCell);
181183
setFoodShouldReverseDirection(nextFoodShouldReverseDirection);
182-
setScore(score+1);
184+
if(foodShouldReverseDirection){//if food is frog then score double
185+
setScore(score+2);
186+
}else{
187+
setScore(score+1);
188+
}
183189
}
184190

185191
const handleGameOver=()=>{
@@ -224,7 +230,9 @@ const Board=()=>{
224230
<p>
225231
<span style={{textDecorationLine:"underline"}} >Score </span>
226232
<br/>
227-
<span style={{color:""}}><strong>{score}</strong></span>
233+
<img width="100px" height="100px" style={{marginTop:"0px",marginLeft:"-100px"}} src={appleImg} alt="apple.png" />
234+
<span style={{position:"absolute",color:"red",marginTop:"30px",marginLeft:"0px"}}><strong>{score}</strong></span>
235+
<img width="100px" height="100px" style={{marginTop:"0px",marginLeft:"30px",marginRight:"-100px"}} src={frogImg} alt="frog.png" />
228236
</p>
229237
</div>
230238
</>

0 commit comments

Comments
 (0)