-
Notifications
You must be signed in to change notification settings - Fork 53
/
spriteengine.pde
executable file
·94 lines (74 loc) · 2.2 KB
/
spriteengine.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/***********************************
* *
* This file does nothing, *
* but allows Processing to *
* actually load the code *
* if located in a directory *
* of the same name. Feel *
* free to rename it. *
* *
***********************************/
/* @ p j s preload="docs/tutorial/graphics/mario/small/Standing-mario.gif"; */
/*
final int screenWidth = 512;
final int screenHeight = 432;
void initialize() {
addScreen("test", new TestLevel(width,height));
}
class TestLevel extends Level {
TestLevel(float w, float h) {
super(w,h);
addLevelLayer("test", new TestLayer(this));
}
void draw() {
fill(0,10);
rect(-1,-1,width+2,height+2);
super.draw();
}
}
class TestLayer extends LevelLayer {
TestObject t1;
TestLayer(Level p) {
super(p,p.width,p.height);
showBoundaries = true;
int v = 10;
t1 = new TestObject(width/2+v/2, height/2-210);
t1.setForces(5,0);
t1.setForces(0,0.01);
t1.setAcceleration(0,0.1);
addPlayer(t1);
addBoundary(new Boundary(width/2+230,height,width/2+200,0));
addBoundary(new Boundary(width/2-180,0,width/2-150,height));
addBoundary(new Boundary(width,height/2-200,0,height/2-120));
addBoundary(new Boundary(0,height/2+200,width,height/2+120));
//addBoundary(new Boundary(width/2,height/2,width/2 + v,height/2));
}
void draw() {
super.draw();
viewbox.track(parent,t1);
}
}
class TestObject extends Player {
boolean small = true;
TestObject(float x, float y) {
super("test");
addState(new State("test","docs/tutorial/graphics/mario/small/Standing-mario.gif"));
setPosition(x,y);
Decal attachment = new Decal("static.gif",width,0);
addDecal(attachment);
}
void addState(State s) {
s.sprite.anchor(CENTER, BOTTOM);
super.addState(s);
}
void keyPressed(char key, int keyCode) {
if(small) {
addState(new State("test","docs/tutorial/graphics/mario/big/Standing-mario.gif"));
}
else {
addState(new State("test","docs/tutorial/graphics/mario/small/Standing-mario.gif"));
}
small = !small;
}
}
*/