-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.js
More file actions
executable file
·62 lines (41 loc) · 1.98 KB
/
Copy pathtemplate.js
File metadata and controls
executable file
·62 lines (41 loc) · 1.98 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
// Perlenspiel.js template.
// This is a template for creating new Perlenspiel scripts for perlenspiel.js.
// About the project: The was made for a Labor Day weekend hackathon. The original intention was to emulate the original lua version of perlenspiel as much as possible, however, this hedged the design a lot, so if I work on this again in the future I will likely redesign the whole thing to better fit with javascript and web use.
// One more quick note: I took this class when it was first offered in D Term 2010, so I was using an older version of Perlenspiel. I've dug around the new API but some of the desgin is from memory so it may not match the lastest version exactly.
// Global constants should probably be erapped per convention.
var PS_GRID_X = 8;
var PS_GRID_Y = 8;
// ps_init ()
// Initializes the game.
// The ps_init() function MUST call ps_setup (x, y), where x and y are the desired size of the grid.
// Every game MUST include a ps_init() function, and that function MUST call ps_setup() with the x and y dimensions of the grid!
ps_init = function(){
ps.setup(PS_GRID_X, PS_GRID_Y);
// Any other initialization code goes here.
};
// ps_click (x, y, button, data)
// This function is called whenever a bead is clicked.
// x = the x-position of the bead on the grid
// y = the y-position of the bead on the grid
// button = -- PS_BUTTON_LEFT if left button was clicked, else PS_BUTTON_RIGHT
// data = the data value associated with this bead, 0 if none has been set
// Every game MUST include a ps_click() function. It doesn't have to do anything.
ps_click = function(x, y button, data){
// Put code here for when a bead is clicked.
};
ps_key = function(val){
};
ps_enter = function(x, y, button, data){
};
ps_leave = function(x, y, button, data){
};
ps_release = function(x, y, button, data){
};
ps_wheel = function(x, y, button, data){
};
ps_tick = function(){
};
ps_state = function(){
};
ps_restore = function(){
};