Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
0a1738bb
Commit
0a1738bb
authored
12 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
allow either a full <path/file> parameter or relative <file> parameter
(to load sprites from ./sprites/) updated docs
parent
51d45948
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/sprite.js
+31
-23
31 additions, 23 deletions
exec/load/sprite.js
with
31 additions
and
23 deletions
exec/load/sprite.js
+
31
−
23
View file @
0a1738bb
...
...
@@ -103,17 +103,22 @@
Creating a Sprite:
Aerial sprites (top-down):
var s = new Sprite.Aerial(
sprit
eName, parentFrame, x, y, bearing, position);
var s = new Sprite.Aerial(
fil
eName, parentFrame, x, y, bearing, position);
Profile sprites (side-view):
var s = new Sprite.Profile(
sprit
eName, parentFrame, x, y, bearing, position);
var s = new Sprite.Profile(
fil
eName, parentFrame, x, y, bearing, position);
Platform sprites (walls, floors):
var s = new Sprite.Platform(parentFrame, x, y, width, height, ch, attr);
Where 'spriteName' is the name of a pair of files in the 'sprites'
subdirectory. (Eg. if you have ./sprites/dwer.ini and
./sprites/dwer.bin, supply "dwer" for 'spriteName'.)
Where 'fileName' is the name of a pair of files in the 'sprites'
subdirectory. 'fileName' can either be an absolute path and root file name
(without extension), or it can be simply the root filename of a sprite,
if the files are located in ./sprites/
If you have ./sprites/<sprite name>.ini and ./sprites/<sprite name>.bin,
supply "<sprite name>" for 'fileName'. If you have the files elsewhere,
you must supply the full path/file name (without extension).
'parentFrame' is a reference to a Frame object of which this sprite
will be a child. You must already have created this frame, and
...
...
@@ -361,13 +366,14 @@ var Sprite = {
<sprite>.bin. file.
*/
Sprite
.
Aerial
=
function
(
spriteName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
if
(
!
file_exists
(
js
.
exec_dir
+
"
sprites/
"
+
spriteName
+
"
.ini
"
))
{
throw
(
"
Sprite file missing: sprites/
"
+
spriteName
+
"
.ini
"
);
Sprite
.
Aerial
=
function
(
fileName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
if
(
!
file_exists
(
fileName
+
"
.ini
"
))
fileName
=
js
.
exec_dir
+
"
sprites/
"
+
fileName
;
if
(
!
file_exists
(
fileName
+
"
.ini
"
))
{
throw
(
"
Sprite file missing:
"
+
fileName
+
"
.ini
"
);
}
if
(
!
file_exists
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.bin
"
))
{
throw
(
"
Sprite file missing:
sprites/
"
+
sprit
eName
+
"
.bin
"
);
if
(
!
file_exists
(
fil
eName
+
"
.bin
"
))
{
throw
(
"
Sprite file missing:
"
+
fil
eName
+
"
.bin
"
);
}
this
.
x
=
x
;
...
...
@@ -730,8 +736,8 @@ Sprite.Aerial = function(spriteName, parentFrame, x, y, bearing, position) {
this
.
frame
.
scrollTo
(
this
.
positions
[
this
.
position
],
this
.
bearings
[
this
.
bearing
]);
}
function
init
(
sprit
eName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
var
f
=
new
File
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.ini
"
);
function
init
(
fil
eName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
var
f
=
new
File
(
fil
eName
+
"
.ini
"
);
f
.
open
(
"
r
"
,
true
);
this
.
ini
=
f
.
iniGetObject
();
f
.
close
();
...
...
@@ -788,7 +794,7 @@ Sprite.Aerial = function(spriteName, parentFrame, x, y, bearing, position) {
this
.
frame
.
h_scroll
=
true
;
this
.
frame
.
transparent
=
true
;
this
.
frame
.
top
();
this
.
frame
.
load
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.bin
"
,
this
.
frame
.
load
(
fil
eName
+
"
.bin
"
,
(
this
.
ini
.
width
*
countMembers
(
this
.
positions
)),
(
this
.
ini
.
height
*
countMembers
(
this
.
bearings
)));
this
.
frame
.
scrollTo
(
this
.
positions
[
this
.
position
],
this
.
bearings
[
this
.
bearing
]);
...
...
@@ -873,14 +879,16 @@ Sprite.Aerial = function(spriteName, parentFrame, x, y, bearing, position) {
sprite.jumpStart The time when a jump began (as read from
system.timer)
*/
Sprite
.
Profile
=
function
(
spriteName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
if
(
!
file_exists
(
js
.
exec_dir
+
"
sprites/
"
+
spriteName
+
"
.ini
"
))
{
throw
(
"
Sprite file missing: sprites/
"
+
spriteName
+
"
.ini
"
);
Sprite
.
Profile
=
function
(
fileName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
if
(
!
file_exists
(
fileName
+
"
.ini
"
))
fileName
=
js
.
exec_dir
+
"
sprites/
"
+
fileName
;
if
(
!
file_exists
(
fileName
+
"
.ini
"
))
{
throw
(
"
Sprite file missing:
"
+
fileName
+
"
.ini
"
);
}
if
(
!
file_exists
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.bin
"
))
{
throw
(
"
Sprite file missing:
sprites/
"
+
sprit
eName
+
"
.bin
"
);
if
(
!
file_exists
(
fil
eName
+
"
.bin
"
))
{
throw
(
"
Sprite file missing:
"
+
fil
eName
+
"
.bin
"
);
}
this
.
x
=
x
;
this
.
y
=
y
;
this
.
bearing
=
bearing
;
...
...
@@ -1201,8 +1209,8 @@ Sprite.Profile = function(spriteName, parentFrame, x, y, bearing, position) {
this
.
frame
.
scrollTo
(
this
.
positions
[
this
.
position
],
this
.
bearings
[
this
.
bearing
]);
}
function
init
(
sprit
eName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
var
f
=
new
File
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.ini
"
);
function
init
(
fil
eName
,
parentFrame
,
x
,
y
,
bearing
,
position
)
{
var
f
=
new
File
(
fil
eName
+
"
.ini
"
);
f
.
open
(
"
r
"
,
true
);
this
.
ini
=
f
.
iniGetObject
();
f
.
close
();
...
...
@@ -1264,7 +1272,7 @@ Sprite.Profile = function(spriteName, parentFrame, x, y, bearing, position) {
this
.
frame
.
transparent
=
true
;
this
.
frame
.
v_scroll
=
true
;
this
.
frame
.
h_scroll
=
true
;
this
.
frame
.
load
(
js
.
exec_dir
+
"
sprites/
"
+
sprit
eName
+
"
.bin
"
,
this
.
frame
.
load
(
fil
eName
+
"
.bin
"
,
(
this
.
ini
.
width
*
countMembers
(
this
.
ini
.
positions
)),
(
this
.
ini
.
height
*
countMembers
(
this
.
ini
.
bearings
)));
this
.
frame
.
top
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment