Play from a specific spot, not the beginning

#1

When I am coding and checking how things work I would like to be able to play from a certain point, rather than always from the beginning. Is that possible?

#2

You can start at the level of a scene. Otherwise you need to do a setup to fix the states of objects from within your code. Could you elaborate on what you mean with “play from a certain point, instead of the beginning”?

1 Like
#3

Hi @kfinklestein,

To keep a better overview of your code, you can create code tabs to split your CoBlocks program into logical chunks. This allows you to easily review where and when your space-logic should be happening :slight_smile:

Right now all scripts always start at the When Play clicked - block, but there are ways to help you organize your code even more.

Below is a remixable example that shows how you can use scene-functions!

This is how it looks in action

The scene is split into code tabs for the Girl and the Dog. They handle click events. Additionally, inside of the click events we use scene-functions (identified by the globe icon in the red blocks).

We created scene-functions in a third tab to keep track of what should happen when the girl is pointing at the dog, or the dog barks.

You can create scene-functions as shown below:

We’re working on forum tutorials to show you creative ways in which you can use scene-functions soon!

#4

If your scene logically a movie and you want to “play” (position) it from a specific time point, and even better with any (including negative) playback speed,
Then it is possible by programming (js or CoBlocks) a “Media-Player”-like CoSpaces app with required UI controls.
So then you can send command to you “scene” and it will “render” the scene (by moving items) at the specific time and any playback speed.

#6

Good because that was confusing LOL!

What I mean is I start writing the code and then I click play to see how it looks. Then I go back and add more code, but I already know the first bit works/looks good so I only want to see the code that I just added.

#7

This is a typical issue in all programing languages. code spaces doesn’t include unit test mechanism. You should include a debug variable that will be active only during your test (=true)
when debug= true create various buttons that will activate only the portion of code that you are testing
Please rember that you need to setup variable values which maybe expected before the next code execution
Zohar

1 Like