Advanced Instructions

What did you draw?
Post Reply
User avatar
testtubegames
Site Admin
Posts: 1083
Joined: Mon Nov 19, 2012 7:54 pm

Advanced Instructions

Post by testtubegames » Mon Aug 27, 2018 10:51 am

(cribbed from my earlier post here: viewtopic.php?f=7&t=535#p3579)


Here are some (all?) of the shortcuts:

-WASD or Arrows to move around
-'+' and '-' to zoom in and out
-Hold F to auto-fire an object
-Hold C while aiming an object to put it in a circular orbit around the nearest mass
-Right click acts as a cursor (selecting objects, moving the screen)
-Hold shift to select and edit multiple planets
-Ctrl-Z undoes the latest planet you've added
-Ctrl-R rewinds time a bit
-E caches a quick-save
-Q loads a quick-save
-0-9 changes what type of object you're adding
-Backspace/Delete removes the selected object(s)
-Space toggles pause
-Escape takes you to the main menu, hit escape again, and you quit the sim



A little bit about the save codes.

Okay, an example:

Code: Select all

//Gravity fun at TestTubeGames
_settings(gravity: r^(-2), zoom: 0.7084251);
_type0(m: 1000, col: 2, lcol: 3, pic: 0, noGrav);
_type1(m: 0, col: 1, lcol: 3, pic: 2);
_add(type: 0, x: -51.7, y: 17.37, t: 0);
_add(type: 0, x: 74.64, y: 20.12, t: 11.6);
_add(type: 0, x: 9.93, y: 102.62, t: 25.6);
_add(type: 1, x: -6.23, y: 57.37, a: 17, t: 48);
_add(type: 1, x: 24.35, y: 38.45, a: 235, t: 71.2);
_add(type: 1, x: -3.8, y: 29.47, a: 136, t: 84.4);
The settings line comes first, and contains the force law(s), zoom, etc. If any of the variables are missing it will just revert to that variable's default (the same goes for all the variables in the save code). The variables you can post in settings:

Code: Select all

_settings(
gravity: <written out force law, default is r^-2>,
tangravity: <written out tangential force law, default is 0>,
x: <offset of the world, default is 0>,
y: <offset of the world, default is 0>,
zoom: <default is 1>,
n: <name of save, default is blank>
);
After that, there's a list of the planet types. These contain info that's generally shared by a whole bunch of objects. This way, when you spam a whole bunch of blue planets with mass = 100, the save code just has to write all that info once. The variables you can post in type:

Code: Select all

_type'N'(
m: <mass, default is 0>,
col: <the color of the object, based on an indexed list, default is 0>,
lcol: <the color of the trail, based on an indexed list, default is 0>,
pic: <image type>,
rObj: <radius of the planet, used if it is massless. Default is 3>,
d: <density of the planet, used if it is massive.  Default is .3>,
noGrav <included if the object is fixed and ignores gravity. No value / colon needed>,
textSize: <the size of the object's text, default is 30>
);
The types, I'll note, are optional. If you'd rather, you can wrap any/all of this information into the codes for the individual objects themselves. If a variable is included for both, the individual-info overwrites the type-info.

Once that's locked down, the objects themselves follow. Depending on the prefix, different objects get added. The default "_add" just throws in a single object. The variables:

Code: Select all

_add(
name: <a written name that appears on screen. defaults to blank>,
type: <which type's properties this inherits>,
x: <the x position>,
y: <the y position>,
vx: <the x velocity>,
vy: <the y velocity>,
a: <the angle of the object, defaults to 0>,
rotspeed: <the rotational speed of the object in degrees per unit time, defaults to 0>,
t: <the world time that this object appears, defaults to 0>,
...and any of the variables from 'type'
);
You can add cool new sets of objects as well (woo!). There are lines, circles, and disks of planets. To add them:

Code: Select all

_addLine(
name: <>, type: <>, 
xMin: <the x-coordinate of one endpoint>, 
xMax: <the x-coordinate of the other endpoint>,
yMin: <the y-coordinate of one endpoint>,
yMax: <the y-coordinate of the other endpoint>,
vx:<>, vy:<>,
vt: <the tangential velocity of the line, so the whole line spins about its midpoint>,
vr: <the radial velocity, from the center of the line>,
num: <the number of planets>, 
randomColors <if included, this randomizes  the colors. No value / colon needed>,
randomAngles <if included, this randomizes the angles. No value / colon needed>,
t: <>,
...and any of the variables from 'type'
);

Code: Select all

_addCircle(
name: <>, type: <>, x:<>, y:<>, vx:<>, vy:<>, vt:<>, vr:<>,
r: <radius of circle>,
num: <>, randomColors, randomAngles, t:<>
);

Code: Select all

_addDisk(
name: <>, type: <>, x:<>, y:<>, vx:<>, vy:<>, vt:<>, vr:<>,
mMin: <optional, masses set randomly with this as min>,
mMax: <optional, masses set randomly with this as max>,
rMin: <minimum radius from center, defaults to 0>,
rMax: <maximum radius from center, defaults to 250>,
num: <>,
seed: <a random number generator seed that defines the disk.  That way we can share!>,
t:<>,
...and any of the variables from 'type'
);

Post Reply