This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonsterIsland.pde
70 lines (57 loc) · 1.65 KB
/
MonsterIsland.pde
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
68
69
70
import processing.opengl.*;
import java.util.Hashtable;
import hermes.*;
import hermes.hshape.*;
import hermes.animation.*;
import hermes.physics.*;
import hermes.postoffice.*;
static final int WINDOW_WIDTH = 800;
static final int WINDOW_HEIGHT = 512;
CWorldManager worldManager;
AssetManager assetManager;
void setup() {
// set window size
size(WINDOW_WIDTH, WINDOW_HEIGHT);
noSmooth();
rectMode(CORNER);
frameRate(50);
// Give the library the PApplet.
Hermes.setPApplet(this);
// Set the default font. (font by: https://managore.itch.io/m5x7)
textFont(createFont("fonts/m5x7.ttf", 32));
_preloadAssets();
_startGame();
}
void draw() {
worldManager.draw();
}
void _preloadAssets() {
assetManager = new AssetManager();
assetManager.put(
"unitSheet",
new Tileset(
loadImage(dataPath(UnitUtils.DIR + "/spritesheet.png")),
UnitUtils.WIDTH,
UnitUtils.HEIGHT
));
assetManager.put(
"arrowTower",
loadImage(dataPath(Tower.DIR + "/arrow/tower.png")));
assetManager.put(
"arrowProjectile",
loadImage(dataPath(Tower.DIR + "/arrow/projectile.png")));
assetManager.put(
"iceTower",
loadImage(dataPath(Tower.DIR + "/ice/tower.png")));
assetManager.put(
"iceProjectile",
loadImage(dataPath(Tower.DIR + "/ice/projectile.png")));
}
void _startGame() {
worldManager = new CWorldManager();
worldManager.setInitialWorld(new Game("stage01"));
// worldManager.setInitialWorld(new Game("stage02"));
// worldManager.setInitialWorld(new Game("stage03"));
// worldManager.setInitialWorld(new Game("stage04"));
worldManager.start();
}