-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
147 lines (101 loc) · 5.01 KB
/
README
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
Thrust 2010 - HTML5/Canvas game
Copyright (C) 2010 Sven Helmberger
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see http://www.gnu.org/licenses/ .
INTRODUCTION
============
These are the files for the Thrust 2010 HTML5/Canvas game.
No compilation needed, just open the index.html with a modern browser.
Shouldn't matter whether you do that from your harddrive and file:// or
if you copy it to a webserver before, unless you want others to play your
version.
.
|-- alien.js Alien control logic
|-- Class.js Simple Javascript inheritance by John Resig
|-- help.html Help-Page
|-- help.png image for help
|-- index.html main page
|-- jquery-1.4.2.min.js
|-- jquery.cookies.js
|-- json2.js Douglas Crockford's json2.js
|-- levels This subdir contains all levels. They are made
| with InkScape (http://inkscape.org)
|
|-- levels.js Definition of active levels
|-- rtree.js RTree impl
|-- synch.sh Little script to synch the project to my i
| server, build the zip
|-- thrust-base.js Thrust base object definitions
|-- thrust.js Main script.
|-- util.js various general util functions
`-- vecmath.js vector geometry stuff
CREATING NEW LEVELS
===================
The levels itself are created with InkScape ( http://inkscape.org).
I recommend you do the same since InkScape mostly spits out the code the way
Thrust2010 needs it. Might be possible to use other SVG programs, too.
The game objects are recognized by special labels put on them in InkScape.
Here a short list of labels and their requirements/semantics.
To set such a label, right click the SVG object you want to label and select
"Object Properties". Enter the label into the "Label" field starting with #
If you have problems with Thrust2010 not really loading your level correctly,
the XML-Editor built into InkScape might help you.
In general, InkScape for now only supports objects with "translate(x,y)"
transform, but not "matrix(...)" transform. If you do funny things with your
objects you might accidentally provide them with a matrix transform.
In this case simply delete the matrix transform in the XML editor
and move the object around until it sits at the right position again.
The game objects are recognized by special labels put on them in InkScape.
Here a short list of labels and their requirements/semantics.
THRUST SVG DSL
==============
Label: #scene
#scene objects make up the static background of the levels. They need to be
paths only composed out of straight lines. The polygons can be concave, but
not complex. They can't cross themselves or contain holes. This is due to
canvas lack of even odd fill rule. Found no way around that. Thrust will draw
a solid rectangular limit around the AABB of your level in the fill style of
the first #scene path.
Label: #start
Must be rectangle object. Marks the position of the base/player.
Label: #cargo
Cargo unit that must be carried to the base for points.
Label: #alien
Alien ship controlled by AI code. Must have a way path defined to work.
Label: #way-<id>-<nr>
A non-closed path can be marked with this to register it as alien way path.
<id> must be the SVG id of the alien the path belongs to
<nr> the index of the path starting at 0.
Thrust with merge way paths components that are very close to another
way path's point. This enables the alien to do backtracking walk-alongs
multiple paths.
Label: #sentinel
A turret like automatic shooter. Must be a circle shape. The center of the
circle is the sentinel position, the area of the object marks the observation
area of the sentinel.
Label: #gravpoint
An invisible point of large mass that attracts all gravity-bound objects
leading to them either orbiting the gravpoint or crashing into it. Must be a
circle shape. Center defines gravpoint location, Area defines the area
it is active. if you set the description to a JSON string like
{"force":600}
you can change the force default of 500.
Label: #gravbox
A gravbox has an area of linear gravity that can be different from the normal
gravity. It must be a path set up in a special way: The first two points of
the path define the gravbox base line which is the line everything gravitates
to in the box.
All further points just define the height of the gravbox and must be on only
one side of the base line. At the ends, the gravbox is rounded to the height
radius.
( See http://github.com/fforw/thrust2010/blob/master/image/gravbox.png for
an illustration of this)
You can also set the force via JSON description.