Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Mario Game/Sch476/Content/backgrounds/01.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 Mario Game/Sch476/Content/backgrounds/02.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 Mario Game/Sch476/Content/backgrounds/03.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 Mario Game/Sch476/Content/backgrounds/04.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 Mario Game/Sch476/Content/backgrounds/05.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 Mario Game/Sch476/Content/backgrounds/06.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 Mario Game/Sch476/Content/backgrounds/07.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 Mario Game/Sch476/Content/backgrounds/08.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 not shown.
Binary file added Mario Game/Sch476/Content/mario-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 Mario Game/Sch476/Content/mario-objects.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 Mario Game/Sch476/Content/mario-peach.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 Mario Game/Sch476/Content/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.
97 changes: 97 additions & 0 deletions Mario Game/Sch476/Content/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@font-face {
font-family: 'SMB';
src: local('Super Mario Bros.'),
url('fonts/Super Mario Bros.ttf') format('truetype');
font-style: normal;
}

body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}

#game {
height: 100%;
width: 100%;
position: relative;
border: 1px solid #ccc;
overflow: hidden;
}

#world {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
z-index: 0;
}

.gauge {
margin: 0;
padding: 0;
height: 50px;
width: 70px;
text-align: right;
font-size: 2em;
font-weight: bold;
position: absolute;
top: 17px;
right: 52px;
z-index: 1000;
font-family: 'SMB';
}

.gaugeSprite {
margin: 0;
padding: 0;
z-index: 1000;
position: absolute;
}

#coinNumber {
left: 0;
}

#liveNumber {
right: 52px;
}

#coin {
height: 32px;
width: 32px;
background-image: url(mario-objects.png);
background-position: 0 0;
top: 15px;
left: 70px;
}

#live {
height: 40px;
width: 40px;
background-image: url(mario-sprites.png);
background-position: 0 -430px;
top: 12px;
right: 8px;
}

.figure {
margin: 0;
padding: 0;
z-index: 99;
position: absolute;
}

.matter {
margin: 0;
padding: 0;
z-index: 95;
position: absolute;
width: 32px;
height: 32px;
}

106 changes: 106 additions & 0 deletions Mario Game/Sch476/Scripts/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* *****
* WRITTEN BY FLORIAN RAPPL, 2012.
* florian-rappl.de
* mail@florian-rappl.de
* *****
*/

var AUDIOPATH = 'Content/audio/';
var BASEPATH = 'Content/';
var DIV = '<div />';
var CLS_FIGURE = 'figure';
var CLS_MATTER = 'matter';

var directions = {
none : 0,
left : 1,
up : 2,
right : 3,
down : 4,
};
var mario_states = {
normal : 0,
fire : 1,
};
var size_states = {
small : 1,
big : 2,
};
var ground_blocking = {
none : 0,
left : 1,
top : 2,
right : 4,
bottom : 8,
all : 15,
};
var collision_type = {
none : 0,
horizontal : 1,
vertical : 2,
};
var death_modes = {
normal : 0,
shell : 1,
};
var images = {
enemies : BASEPATH + 'mario-enemies.png',
sprites : BASEPATH + 'mario-sprites.png',
objects : BASEPATH + 'mario-objects.png',
peach : BASEPATH + 'mario-peach.png',
};
var constants = {
interval : 20,
bounce : 15,
cooldown : 20,
gravity : 2,
start_lives : 3,
max_width : 400,
max_height : 15,
jumping_v : 27,
walking_v : 5,
mushroom_v : 3,
ballmonster_v : 2,
spiked_turtle_v : 1.5,
small_turtle_v : 3,
big_turtle_v : 2,
shell_v : 10,
shell_wait : 25,
star_vx : 4,
star_vy : 16,
bullet_v : 12,
max_coins : 100,
pipeplant_count : 150,
pipeplant_v : 1,
invincible : 11000,
invulnerable : 1000,
blinkfactor : 5,
};
var mushroom_mode = {
mushroom : 0,
plant : 1,
};
var c2u = function(s) {
return 'url(' + s + ')';
};
var q2q = function(figure, opponent) {
if(figure.x > opponent.x + 16)
return false;
else if(figure.x + 16 < opponent.x)
return false;
else if(figure.y + figure.state * 32 - 4 < opponent.y)
return false;
else if(figure.y + 4 > opponent.y + opponent.state * 32)
return false;

return true;
};
Math.sign = function(x) {
if(x > 0)
return 1;
else if(x < 0)
return -1;

return 0;
};
55 changes: 55 additions & 0 deletions Mario Game/Sch476/Scripts/keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
var keys = {
bind: function() {
$(document).on('keydown', function(event) {
return keys.handler(event, true);
});
$(document).on('keyup', function(event) {
return keys.handler(event, false);
});
},
reset: function() {
keys.left = false;
keys.right = false;
keys.accelerate = false;
keys.up = false;
keys.down = false;
},
unbind: function() {
$(document).off('keydown');
$(document).off('keyup');
},
handler: function(event, status) {
switch (event.keyCode) {
case 57392: // CTRL on MAC
case 17: // CTRL
case 65: // A
keys.accelerate = status;
break;
case 40: // DOWN ARROW
keys.down = status;
break;
case 39: // RIGHT ARROW
keys.right = status;
break;
case 37: // LEFT ARROW
keys.left = status;
break;
case 32: // SPACEBAR
keys.up = status;
break;
default:
return true;
}

event.preventDefault();
return false;
},
accelerate: false,
left: false,
up: false,
right: false,
down: false,
};

// Now you can bind the keys using the following line:
keys.bind();
Loading