![]() _cir := eval("scene.my._circles" + (_n)) //Get the entityid of the marble holder we want _n = string.length(_islist) //Get the number of the marble holder we want to teleport the marble to _islist = _islist ++ //ADD THE MARBLE's NUM TO ISLIST IF THE COLOR REACHES THE END FOR THE FIRST TIME. BELOW THREE LINES OF CODE IS TO CHECK WHENTHER THE MARBLE's NUM IS IN _ISLIST OR NOT Ok, so, in the teleporter's oncollide, type in (there's explaination in the code) (also, this code is sightly different than the one i use, to make it easier to understand): I recommend you to type all of these yourself, as typing instead of copying help you learn quicker :) It is to help us change a variable in a list without the need to type 10 lines of code.Įz, right? But now, the hardest part : Scripting. Lastly, the _change function is just to help us save some time. For example, if 3 red marbles and 1 orange marble reached, _num :=. For example, _l :=, then red marbles (1) should go to the marble holder with entityid 51, oranges (2) to the one with entityid 32, and so on.Īnd secondtolast, _num is to hold the number of marbles of a color that had reached the end. It i used to hold the marble holder a color should go to. Else, teleport it to the color's marble holder. If no, find an empty marble holder for the color. The _islist is to check if a color reached the end before. So before we continue, here's some explaination: The teleporter shall teleport marbles to the correct position, and break the circle when all marbles reached. Step 3: The green pad (or the teleporter) ![]() For example, to access the 5 th marble holder, we can use scene.entitybyid(scene.my._circles5). This is to make teleporting and destroying it easier. ![]() ![]() the eval function converts string to code. Set the marble holders's onspawn to below:Įval("scene.my._circles" + _num + " = entityid") Give all marble holders a variable _num, and set the value according to the number of it, as shown below. The value of _num is determined by the color of the marble. :DĮach marble have a variable _num, below. There is also a short explanation at the comments. Later during the scripting part of the tutorial, if you don't understand what are the lists are for later, check the comments. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |