Skip to content

Commit

Permalink
Covid & Flu Sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
jackygilbertson committed Nov 26, 2020
1 parent 70a28aa commit 82d99a5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
16 changes: 16 additions & 0 deletions src/components/Game.scss
Expand Up @@ -5,3 +5,19 @@
overflow: hidden;
box-shadow: 0 0 20px #000;
}

.flu-sprite {
width: 40px;
height: 40px;

background: transparent url('/images/flu-sprite.png') no-repeat top center;
background-size: 100% auto;
}

.covid-sprite {
width: 40px;
height: 40px;

background: transparent url('/images/covid-sprite.png') no-repeat top center;
background-size: 100% auto;
}
18 changes: 2 additions & 16 deletions src/components/Game.tsx
Expand Up @@ -191,37 +191,23 @@ function GameObject({ position, velocity, type }: ObjectProps) {
case 'flu':
return (
<div
className="flu"
className="flu-sprite"
style={{
color: '#fff',
borderLeft: '20px solid rgba(100, 180, 220, 0.7)',
borderRight: '20px solid transparent',
borderTop: '7px solid transparent',
borderBottom: '7px solid transparent',
position: 'absolute',
top: position.y - 7,
left: position.x - 20,
width: 0,
height: 0,
transform: `rotate(${velocity.angle}rad)`,
}}
/>
);
case 'covid':
return (
<div
className="covid"
className="covid-sprite"
style={{
color: '#fcba03',
borderLeft: '20px solid rgba(252, 186, 3, 0.7)',
borderRight: '20px solid transparent',
borderTop: '7px solid transparent',
borderBottom: '7px solid transparent',
position: 'absolute',
top: position.y - 7,
left: position.x - 20,
width: 0,
height: 0,
transform: `rotate(${velocity.angle}rad)`,
}}
/>
Expand Down
Binary file added src/images/covid-sprite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/flu-sprite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 82d99a5

Please sign in to comment.