Login

Fancade Wiki

Replaced some images to use the new font

... ...
@@ -20,7 +20,7 @@ Output:
20 20
21 21
Here is the script for when a player shoots a bullet.
22 22
23
[[/uploads/Screenshot_20210107-112017_Fancade.jpg]]
23
[[/uploads/list_element_example1.png]]
24 24
25 25
Let me explain the script:
26 26
- We create a bullet, store it in a variable, and set its position to the player's position.
... ...
@@ -29,11 +29,11 @@ Let me explain the script:
29 29
30 30
So far so good, until the player shoots again adding another bullet. The variable can only store one value at a time, so the first bullet and its velocity are replaced with the second, the second bullet moves like it should, but the first bullet stop because it's no longer affected by the script. How do we fix that?
31 31
32
[[/uploads/Screenshot_20210107-114652_Fancade.jpg]]
32
[[/uploads/list_element_example2.png]]
33 33
34 34
Lists are like variables, but they can store more values in one, so we just have to store the bullets and their velocities like so. We have to make sure to increment the index, otherwise the next bullet would be stored in the list with the same index giving us the same problem we had with the previous script.
35 35
36
[[/uploads/Screenshot_20210107-121128_Fancade.jpg]]
36
[[/uploads/list_element_example3.png]]
37 37
38 38
Next thing we have to do is run the script for every bullet with a [[loop]]. We plug the Counter output of the loop into the Index input of our lists, so that we could access each index and the values one by one. The script runs for every bullet and our problem is solved!
39 39
... ...
@@ -41,7 +41,7 @@ Next thing we have to do is run the script for every bullet with a [[loop]]. We
41 41
42 42
Here is a simpler example that demonstrates how to create multiple objects and process them all at once:
43 43
44
[[/uploads/818666383796731924-image0.png]]
44
[[/uploads/list_element_example4.png]]
45 45
46 46
By storing every object in a list to their respective indices, you can loop from 0 to the list's length amount of times, using the current index to get the current object from the list to be processed.
47 47
Fancade Wiki