Project Spark Wiki

Common Koding Problems

233pages on
this wiki
Add New Page
Comments9 Share

Question: How can I have multiple things happening when something is true?Edit

Answer: To do this, you simply press the number of the line you wish to add to a previous rule, then press the Ss (2014-08-14 at 05.59.48) to imbed it into the previous rule. That means that only when the parent rule works, this line will work.

Question: I can't get two brains to communicate with each other. What is wrong?Edit

Answer: A brain has to have [global] in front of every variable that is not specific to one prop. If there is no [global], then the variable is considered local, which means that it will only work within that brain. You can also specify another prop brain using the world tile picker. Find more information about brain referencing here (or variable scope here).

Question: I saw a video of someone using a tile and when I searched for it, I couldn't find it! What happened?Edit

Answer: In most cases, this is because a custom variable was used. Custom Variables can be created in Values and work as containers of information. When you create a custom variable, you can specify your own name and it will be stored in the respective folder depending on the type of variable you created. Find more about variables and their types here. If this didn't answer your question, there are other scenarios below.

Question: A brain doesn't recognize the [player] tile. It will also not appear in the WHEN section when I want to define the player's position. What is wrong?Edit

Answer: The reason that the [player] tile doesn't appear in the WHEN section, is because it relates to an object set rather than an object. [player] is the set of objects in the world that behave like players (more precisely, an object is in the [player] object set if the first page of its brain has control tiles). To avoid similar errors, go to your player's brain and create a custom object variable. Name it "player", then add the following line: 

Ss (2015-12-31 at 04.29.43)

Now, instead of using the Ss (2014-08-14 at 05.30.13) tile in any of your brains in the level, you will use Ss (2014-08-14 at 05.31.22)

See this video for more information:

What is a "Player" in Project Spark?04:06

What is a "Player" in Project Spark?

Question: I used [once] in a brain but I can't make it work again. Is it possible?Edit

Answer: No. [Once] will work only once per brain. However, there are other workarounds for using [once] again. Destroying and creating the prop again will make [once] work once more. Also, if you want to have something work once when powered on or page entered, use [started to] or [page entered]. Find more information in the links (Beginners here, advanced here).

Question: I want to make a brain work for X seconds, then stop for X seconds, then work again etc. Is it possible?Edit

Answer: Yes. Use [duration timer] [ON time in seconds][Hold][OFF time in seconds][loop]


[countdown timer][OFF time in seconds][Hold][ON time in seconds][loop], then put the rest of the lines inside this rule. For more information on timers, go here.

Question: I want to make a sound/visual effect work without looping. Is there an easy way to do it?Edit

Answer: Yes. Simply add the [started to] tile in WHEN and the sound/visual effect will play once and stop. Beware as this is not the main rule. Some sounds/visual FXs will behave differently. To see which sounds can be used with the [started to] tile, go here. To see which Visual FX have different durations, go here.

Question: I used [create] tile to spawn an enemy and I saw dozens of enemies spawn and I also got slow FPS. How can I spawn an enemy without this happening?Edit

Answer: You have not put any condition in the When side, thus the [create] tile is executed continuously, once every tic. So instead of leaving WHEN blank, you can add [started to] and it will only spawn one prop.

Question: Can I have someting work once every time I power it? [Once] doesn't work the second time.Edit

Answer: Yes. By using the [started to] tile. So WHEN [started][has power] DO etc. To understand the difference between [once] and [started to], see Timing and Logic.

Question: I saw some special tiles in a video but I can't seem to find them. Those tiles were not custom variables. Edit

Answer: This relates to three scenarios:

1)Modifiers are only found after a specific tile is placed in the same WHEN /DO category

2)Outputs are brain tiles that only appear after a specific tile is placed in a parent WHEN/DO line. Find an example of an output here.   

3)Some tiles can't appear in WHEN and only can in DO. And some tiles only appear when their type is in accordance with the type required. Finally, read-only variables can't be the first tile of a DO side. Maybe you are tryng to work with the wrong tiles in the wrong place?

Question: I used [display] to add a text in my game, but I can't see it. What happened?Edit

Answer: Did you add a screen position? If not, the text will display above the prop and if you are far away, you may not see it. If you added world space, then it will display at the world position you stated. [zero] in world position means the coordinates (0; 0; 0), so never use [zero] with [world space], only with [at screen position]. 

Question: I want to have two items display at the same screen position. How do I avoid stacking?Edit

Answer: There are two ways to do it, the easy one is to add the modifier [no stacking] after the [display] tile. For the other way and more UI information, go here

Question: I want to have something stop working after something happens. Is there an easy way to do it from another brain?Edit

Answer: Yes. If you want the kode to stop permanently, the easier way is to say [destroy][Select the prop with In-World Picker]. However, if you want the physical mesh to remain but the brain to stop, you can say [Select Prop with World Picker][brain is active][equals][false]. That will also allow you to re-enable it later on if needed (mainly for cutscenes to enable/disable player).

Question: I want to make a multiplayer game, but the logic only works for one player. How can I make it work for all players?Edit

Answer: There are specific tiles that assign kode to each player, find more info in this video.

Question: I have a sign set to display a message, but it only works for a split second! What is wrong?Edit

Answer: In most cases, this happens because you 've set the sign to work as WHEN interacted DO display etc. The "interacted" tile only works for a single iteration then stops. In order for your sign to work, you have to say:

Question: I have a player/enemy that when he dies he disappears. How can I change that?Edit

Answer: To solve this issue go to the character > press edit (LB + A on controller) > properties > combat > Health & Defenses > Destroy after death > set it OFF.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.