forked from robertkleffner/mariohtml5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flipTest.html
executable file
·31 lines (27 loc) · 959 Bytes
/
flipTest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<title>Infinite Mario - JavaScript</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<canvas id="canvas" width="320" height="240">
<p>Your browser does not support the canvas element.</p>
</canvas>
<script type="text/javascript">
var img = new Image();
img.src = "images/enemysheet.png";
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
ctx.save();
ctx.scale(-1, 1);
ctx.drawImage(img, -img.width, 0, img.width, img.height);
ctx.restore();
ctx.save();
ctx.scale(-1, 1);
ctx.translate(-320, 0);
ctx.drawImage(img, 2 * 16, 1 * 32, 16, 32, 300 - 50, 50, 16, 32);
ctx.restore();
</script>
</body>
</html>