Apple Tree Brain

Type: Assembly Brain
Level: not in gallery
Pages: 1
Description: When hit by attack this object will drop one of its attachments. This brain is in the Apple Tree assembly. The apple tree has 10 apples attached to it, but only one apple falls, regardless of how many times you attack it.


  1. WHEN [hit by attack]
  2. …WHEN [attachments] DO [detach][it]


This kode does not actually do what you would expect; i.e. detach all attachments when hit by attack. This is because it only runs through the attachments in one frame.

If you want all the apples to drop try this:

  1. WHEN [hit by attack]
  2. …WHEN[for each of] [attachments] DO [detach][it]

If you want one apple to drop for every hit

  1. WHEN [hit by attack]
  2. …WHEN DO [numvar:random attachment][equals][random number][1][to][attachments][count][as integer]
  3. …WHEN DO [for each of][attachments]
  4. …/…WHEN [current index][equal to][numvar: random attachment] DO [detach][it]

Project Spark Alphabet Video


Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: