-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathks.client.krnk
More file actions
107 lines (71 loc) · 1.88 KB
/
ks.client.krnk
File metadata and controls
107 lines (71 loc) · 1.88 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
# Client Script runs only on the client
# KrunkScript Copyright (C) Yendis Entertainment Pty Ltd
#
# Add custom actions here
# Minimal example that can only handle strings.
str TX_ID = "KS_TX";
str RX_ID = "KS_RX";
action send_js_message(str msg) {
GAME.UI.updateDIVText(TX_ID, "KS_flush");
GAME.UI.updateDIVText(TX_ID, msg);
}
action on_js_message(str msg) {
######################################
# do whatever u want with msg string #
######################################
GAME.log("Message received: " + msg);
}
public action start() {
GAME.UI.addDIV(TX_ID, false);
GAME.UI.addDIV(RX_ID, false);
}
public action onDIVClicked(str id) {
if (id == RX_ID) {
on_js_message(GAME.UI.getDIVText(RX_ID));
}
}
# Runs every game tick
public action update(num delta) {
}
# Add rendering logic in here
public action render(num delta) {
}
# Player spawns in
public action onPlayerSpawn(str id) {
}
# Player died
public action onPlayerDeath(str id, str killerID) {
}
# Player update
public action onPlayerUpdate(str id, num delta, obj inputs) {
}
# User pressed a key
public action onKeyPress(str key, num code) {
}
# User released a key
public action onKeyUp(str key, num code) {
}
# User held a key
public action onKeyHeld(str key, num code) {
}
# User pressed a button on a controller
public action onControllerPress(str key, num code) {
}
# User released a button on a controller
public action onControllerUp(str key, num code) {
}
# User held a button on a controller
public action onControllerHeld(str key, num code) {
}
# User clicked on screen
public action onMouseClick(num button, num x, num y) {
}
# User released clicked on screen
public action onMouseUp(num button, num x, num y) {
}
# User scrolled on screen
public action onMouseScroll(num dir) {
}
# Client receives network message
public action onNetworkMessage(str id, obj data) {
}