Deleted Script/Text Script.md
commited
commit
63499c0101a6365ebd6e2679692d31c458ffb527
... | ... | @@ -1,255 +0,0 @@ |
1 | Hi, there. If you're curious about what Fanscript is, it is basically a system where you drag-and-drop blocks and connect wires to create what we call "scripts" when they're just a bunch of blocks, really. |
|
2 | ||
3 | Similar systems have been used by other programs such as Scratch. And tell you what; all games you see inside Fancade? They're all made with those blocks! How cool is it? |
|
4 | ||
5 | # Note |
|
6 | This is a pseudo-code you use to write in Discord instead of having to go back to Fancade, screenshot the scripts, then go back to Discord and send it. If you don't understand it then there's no other way but to go to Fancade and take a look at the scripts. |
|
7 | ||
8 | This is also just a way to predict how Fanscript is gonna look if Martin decides to make a text language for Fancade. |
|
9 | ||
10 | This page is still being re-written by @Isaglish. Ping me in Discord if you have any questions. |
|
11 | ||
12 | Work-In-Progress! |
|
13 | ||
14 | [[_TOC_]] |
|
15 | ||
16 | # Folders |
|
17 | First of all, we have folders. These are the folders in your Inventory when you tap on the plus icon on the very far right of your hotbar. |
|
18 | ||
19 | ```coffeescript |
|
20 | # if you wanna use assets you've created or |
|
21 | # use pre-existing ones then you will have to do this: |
|
22 | player = MyBlocks:Player |
|
23 | bricks = Terrain:Bricks |
|
24 | grass = Terrain:Grass |
|
25 | particle = Decor:Particle |
|
26 | ``` |
|
27 | ||
28 | # Variables |
|
29 | ```coffeescript |
|
30 | # set a global variable by adding '$' at the beginning of a variable name |
|
31 | $deltaTime = Frame() |
|
32 | ||
33 | # similar to global variables, saved variables have a '!' at the prefix |
|
34 | # note that this only works for Numbers type at the moment |
|
35 | !coinMultiplier = MenuItem("Coin Multiplier", "on/off", "10 double") |
|
36 | ||
37 | # in fancade, we have six different data types |
|
38 | # variables are dynamic so you don't have to specify their type |
|
39 | age = 10 |
|
40 | gunSprite = MyBlocks:Pistol |
|
41 | positionOffset = Vector(x, y, z) |
|
42 | angle = Rotation(x, y, z) |
|
43 | banned = False |
|
44 | constraint = AddConstraint(base, part, pivot) |
|
45 | ``` |
|
46 | ||
47 | # How to use each block in each folder |
|
48 | ## Game folder |
|
49 | ```coffeescript |
|
50 | Win(delay) |
|
51 | ||
52 | Lose(delay) |
|
53 | ||
54 | SetScore(score, coins, "Most Points") |
|
55 | ||
56 | SetCamera(position, rotation, range) |
|
57 | ||
58 | SetLight(rotation) |
|
59 | ||
60 | screenWidth = ScreenSize().width |
|
61 | screenHeight = ScreenSize().height |
|
62 | ||
63 | direction = Accelerometer() |
|
64 | ||
65 | delta = Frame() |
|
66 | ||
67 | !item = MenuItem(picture, "The name of your item", "on/off", "10 double") |
|
68 | ``` |
|
69 | ||
70 | ## Objects folder |
|
71 | ```coffeescript |
|
72 | objectPosition = GetPosition(object).position |
|
73 | objectRotation = GetPosition(object).rotation |
|
74 | ||
75 | SetPosition(object, position, rotation) |
|
76 | ||
77 | hit = Raycast(from, to).hit |
|
78 | hitPosition = Raycast(from, to).hitpos |
|
79 | hitObject = Raycast(from, to).hitobj |
|
80 | ||
81 | objectSizeMin = GetSize(object).min |
|
82 | objectSizeMax = GetSize(object).max |
|
83 | ||
84 | SetVisible(object, visible) |
|
85 | ||
86 | copiedObject = CreateObject(original) |
|
87 | ||
88 | DestroyObject(object) |
|
89 | ``` |
|
90 | ||
91 | ## Sounds folder |
|
92 | ```coffeescript |
|
93 | channel = PlaySound(volume, pitch).channel |
|
94 | ||
95 | StopSound(channel) |
|
96 | ||
97 | VolumePitch(channel, volume, pitch) |
|
98 | ``` |
|
99 | ||
100 | ## Physics folder |
|
101 | ```coffeescript |
|
102 | AddForce(object, force, applyAt, torque) |
|
103 | ||
104 | velocity = GetVelocity(object).velocity |
|
105 | spin = GetVelocity(object).spin |
|
106 | ||
107 | SetVelocity(object, velocity, spin) |
|
108 | ||
109 | SetLocked(object, position, rotation) |
|
110 | ||
111 | SetMass(object, mass) |
|
112 | ||
113 | SetFriction(object, friction) |
|
114 | ||
115 | SetBounciness(object, bounciness) |
|
116 | ||
117 | SetGravity(gravity) |
|
118 | ||
119 | constraint = AddConstraint(base, part, pivot) |
|
120 | ||
121 | LinearLimits(constraint, lower, upper) |
|
122 | ||
123 | AngularLimits(constraint, lower, upper) |
|
124 | ||
125 | LinearSpring(constraint, stiffness, damping) |
|
126 | ||
127 | AngularSpring(constraint, stiffness, damping) |
|
128 | ||
129 | LinearMotor(constraint, speed, force) |
|
130 | ||
131 | AngularMotor(constraint, speed, force) |
|
132 | ``` |
|
133 | ||
134 | ## Control folder |
|
135 | ```coffeescript |
|
136 | If(condition) { |
|
137 | # do true stuff |
|
138 | } else { |
|
139 | # do false stuff |
|
140 | } |
|
141 | ||
142 | PlaySensor() { |
|
143 | # initialize stuff here |
|
144 | } |
|
145 | ||
146 | LateUpdate() { |
|
147 | # late update stuff here |
|
148 | } |
|
149 | ||
150 | BoxArtSensor() { |
|
151 | # do stuff here |
|
152 | } |
|
153 | ||
154 | # TouchSensor returns Number x and Number y in a tuple format (x, y) |
|
155 | tapX, tapY = TouchSensor("Touching") { |
|
156 | # do stuff here |
|
157 | } |
|
158 | ||
159 | direction = SwipeSensor() { |
|
160 | # do stuff here |
|
161 | } |
|
162 | ||
163 | Button("Direction") { |
|
164 | # do stuff here |
|
165 | } |
|
166 | ||
167 | Joystick("XZ") { |
|
168 | # do stuff here |
|
169 | } |
|
170 | ||
171 | object, impulse, normal = Collision(object) { |
|
172 | # do stuff here |
|
173 | } |
|
174 | ||
175 | counter = Loop(start, end) { |
|
176 | # do stuff here |
|
177 | } |
|
178 | ``` |
|
179 | ||
180 | ## Math folder |
|
181 | ```coffeescript |
|
182 | negatedNumber = Negate(number) |
|
183 | # or you can just do: |
|
184 | negatedNumber = negatedNumber * -1 |
|
185 | ||
186 | inversedRotation = Inverse(rotation) |
|
187 | ||
188 | addedVectors = Vector(x, y, z).AddVector(vector) |
|
189 | ||
190 | subtractedVectors = Vector(x, y, z).SubtractVector(vector) |
|
191 | ||
192 | scaledVector = Scale(vector, number) |
|
193 | ||
194 | rotatedVector = Rotate(vector, rotation) |
|
195 | ||
196 | combinedRotations = Combine(rotation1, rotation2) |
|
197 | ||
198 | isEqualVectors = EqualVectors(vector1, vector2) |
|
199 | ||
200 | isEqualObjects = EqualObjects(object1, object2) |
|
201 | ||
202 | isEqualTruths = EqualTruths(True, True) |
|
203 | ||
204 | random = Random(minimum, maximum) |
|
205 | ||
206 | randomSeed = RandomSeed(seed) |
|
207 | ||
208 | min = Minimum(number1, number2) |
|
209 | ||
210 | max = Maximum(number1, number2) |
|
211 | ||
212 | sin = Sin(number) |
|
213 | ||
214 | cos = Cos(number) |
|
215 | ||
216 | round = Round(number) |
|
217 | ||
218 | floor = Floor(number) |
|
219 | ||
220 | ceil = Ceiling(number) |
|
221 | ||
222 | absolute = Absolute(number) |
|
223 | ||
224 | mod = Modulo(number1, number2) |
|
225 | ||
226 | log = Logarithm(number, base) |
|
227 | ||
228 | x, y, z = BreakVector(vector) |
|
229 | ||
230 | vector = MakeVector(x, y, z) |
|
231 | ||
232 | normalize = Normalize(vector) |
|
233 | ||
234 | dot = DotProduct(vector1, vector2) |
|
235 | ||
236 | cross = CrossProduct(vector1, vector2) |
|
237 | ||
238 | x, y, z = BreakRotation(rotation) |
|
239 | ||
240 | rotation = MakeRotation(x, y, z) |
|
241 | ||
242 | dist = Distance(vector1, vector2) |
|
243 | ||
244 | lerp = LERP(from, to, amount) |
|
245 | ||
246 | axis = AxisAngle(axis, angle) |
|
247 | ||
248 | near, far = ScreenToWorld(x, y) |
|
249 | ||
250 | x, y = WorldToScreen(worldPos) |
|
251 | ||
252 | intersection = LiveVsPlane(from, to, point, normal) |
|
253 | ||
254 | lookRotation = LookRotation(direction, up) |
|
255 | ``` |
|
... | ... | \ No newline at end of file |