Skip to content

Commit

Permalink
files are added
Browse files Browse the repository at this point in the history
  • Loading branch information
sohamgoswami07 committed Nov 21, 2024
1 parent 7ce2243 commit 4ee2445
Show file tree
Hide file tree
Showing 56 changed files with 1,897 additions and 0 deletions.
8 changes: 8 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
chrome.webRequest.onErrorOccurred.addListener(
function(details) {
if (details.type === "main_frame") {
chrome.tabs.update(details.tabId, {url: chrome.runtime.getURL("index.html")});
}
},
{urls: ["<all_urls>"]}
);
146 changes: 146 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
@font-face {
font-family: SuperMario256;
src: url('../fonts/SuperMario256.ttf');
}

body {
position: relative;
height: 100vh;
width: 100vw;
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #DFDFDF;
color: #21242B;
}

@media (prefers-color-scheme: dark) {
body {
background-color: #21242B;
color: #DFDFDF;
}

.creator-details a {
text-decoration: underline;
font-style: italic;
color: #FFFFFF !important;
}
}

.start-screen {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 1280px;
height: 530px;
margin: 0 auto;
border: none;
background: url('../images/start-screen.png');
}

.main-wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.game-screen {
position: relative;
width: auto;
height: 100%;
border: none;
background: url('../images/bg.png');
display: none;
margin: 0 auto;
}

.creator-details {
position: absolute;
bottom: 0px;
left: 0px;
font-size: 16px;
line-height: 12px;
padding-left: 5vw;
margin: 0;
}

.creator-details a {
text-decoration: underline;
font-style: italic;
color: #000000;
}

.score-wrapper {
padding-left: 40px;
width: 1240px;
margin: 0 auto;
height: 50px;
display: none;
border: none;
line-height: 50px;
font-size: 20px;
background-color: #ADD1F3;
font-family: SuperMario256;
color: #FFFFFF;
}

.life-count {
background: url('../images/mario-head.png') left center no-repeat;
width: 100px;
float: left;
padding-left: 40px;
}

.coin-score {
background: url('../images/coin.png') left center no-repeat;
width: 150px;
float: left;
padding-left: 40px;
}

.level-num {
width: 150px;
float: left;
}

.total-score {
float: left;
}

.start-btn {
width: 200px;
height: 50px;
color: #FFFFFF;
background: url('../images/start-btn.png');
position: absolute;
bottom: 100px;
left: 252px;
border: 2px solid #000000;
}

.back-btn {
position: absolute;
top: -10px;
right: -10px;
width: 200px;
height: 50px;
background: url('../images/back-btn.png');
color: #FFFFFF;
border: 2px solid black;
margin: 10px;
display: none;
}

.loading-percentage {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 60px;
font-family: SuperMario256;
text-align: center;
padding: 100px;
color: #FFFFFF;
}
Binary file added fonts/SuperMario256.ttf
Binary file not shown.
Binary file added images/back-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/clear-map-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/coin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/delete-all-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/editor-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/elements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/enemies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flag-pole.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/grid-large-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/grid-medium-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/grid-small-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/lvl-size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mario-head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mario-sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/popup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/powerups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/save-map-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/saved-btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/slider-left.png
Binary file added images/slider-right.png
Binary file added images/start-btn.png
Binary file added images/start-screen.png
38 changes: 38 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>

<head>
<meta name="viewport" content="width=1280" />
<title>Mario Game | Chrome Extension</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body>

<!-- main game -->
<div class="main-wrapper">
<canvas class="game-screen"></canvas>
</div>
<div class="creator-details">
<p>Developed by <a target="_blank" href="https://github.com/sohamgoswami07">Soham Goswami</a></p>
<p>Mario game code taken from <a target="_blank" href="https://varunbanka.github.io/">Varun Banka</a> | <a href="https://github.com/VarunBanka">Github</a></p>
</div>

<script src="js/View.js"></script>
<script src="js/GameUI.js"></script>

<script src="js/mainGame/GameSound.js"></script>
<script src="js/mainGame/Element.js"></script>
<script src="js/mainGame/PowerUp.js"></script>
<script src="js/mainGame/Enemy.js"></script>
<script src="js/mainGame/Bullet.js"></script>
<script src="js/mainGame/Mario.js"></script>
<script src="js/mainGame/Score.js"></script>
<script src="js/mainGame/MarioGame.js"></script>

<script src="js/MarioMaker.js"></script>
<script src="js/Preloader.js"></script>

</body>

</html>
72 changes: 72 additions & 0 deletions js/GameUI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//canvas elements for the main mario game

let GameUI = (function() {
let instance;

function GameUI() {
let canvas = document.getElementsByClassName('game-screen')[0];
let ctx = canvas.getContext('2d');

this.setWidth = function(width) {
canvas.width = width;
};

this.setHeight = function(height) {
canvas.height = height;
};

this.getWidth = function() {
return canvas.width;
};

this.getHeight = function() {
return canvas.height;
};

this.getCanvas = function() {
return canvas;
};

this.show = function() {
canvas.style.display = 'block';
};

this.hide = function() {
canvas.style.display = 'none';
};

this.clear = function(x, y, width, height) {
ctx.clearRect(x, y, width, height);
};

this.scrollWindow = function(x, y) {
ctx.translate(x, y);
};

this.draw = function(image, sx, sy, width, height, x, y, width, height) {
ctx.drawImage(image, sx, sy, width, height, x, y, width, height);
};

this.makeBox = function(x, y, width, height) {
ctx.rect(x, y, width, height);
ctx.fillStyle = 'black';
ctx.fill();
};

this.writeText = function(text, x, y) {
ctx.font = '20px SuperMario256';
ctx.fillStyle = 'white';
ctx.fillText(text, x, y);
};
}

return {
getInstance: function() {
if (instance == null) {
instance = new GameUI();
}

return instance;
}
};
})();
Loading

0 comments on commit 4ee2445

Please sign in to comment.