-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.htm
More file actions
67 lines (52 loc) · 1.54 KB
/
Copy pathindex.htm
File metadata and controls
67 lines (52 loc) · 1.54 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<body style="background-color:black;">
<script src="sound.js"></script>
<script src="weather.js"></script>
<script src="map.js"></script>
<script src="player.js"></script>
<script src="worldCreate.js"></script>
<script src="movement.js"></script>
<script src="hitbox.js"></script>
<canvas id="game" width="500" height="680" style="border: solid 1px;display: block; margin-left: auto; margin-right: auto;"></canvas>
<canvas id="world" width="1120" height="680" style="border: solid 1px; display: none;"></canvas>
<script>
var ctx = game.getContext("2d");
var worldCtx = world.getContext('2d');
var worldCheck =
{
imageData: worldCtx.getImageData(0, 0, world.width, world.height),
x: 0,
y: 0,
width: world.width,
height: world.height
};
var keys = [];
var camera =
{
x: 0,
y: 0,
width: game.width,
height: game.height
};
player = new player(100,100, "content/player4.png");
var playerSpr = new Image;
playerSpr.src = player.spriteSrc;
level1 = new map(0);
music = new sound("sound/song1.mp3");
jumpSound = new sound("sound/jump.mp3");
weather = new weather(1); //0 - no weather, 1 - rain, 2 - snow
worldCreate = new worldCreate(level1);
movement = new movement(player,playerSpr);
setInterval(function()
{
movement.initialize();
worldCreate.ctxStart();
weather.draw();
worldCreate.draw();
movement.drawPlayer();
worldCreate.ctxRestore();
movement.camera();
music.play();
}, 1000 / 60);
movement.listeners();
</script>
</body>