You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: addons/block_code/README.md
+1-21Lines changed: 1 addition & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,7 @@ See our [pedagogy and audience documentation](docs/PEDAGOGY.md) for more info.
34
34
35
35
3. Make sure to enable the plugin in **Project** → **Project Settings** → **Plugins**.
36
36
37
-
4. You're ready to get started! Open a scene, select a node, and observe that there's a **Block Code** section within the lower central pane of the Godot editor, where you usually find debugging, animation and shader functionality. Click **Block Code** and then use the **Add Block Code** button to create a block canvas.
38
-
39
-
5. Drag blocks from the picker and snap them together to create a script. You can switch to other Block Code scripts by selecting the respective node from the scene tree.
40
-
41
-
6.**Run** the scene to see your Block Code scripts in action. Block Code scripts are saved within the scene.
37
+
You're ready to get started! You can continue reading our [user documentation](docs/USAGE.md).
42
38
43
39
If you clone the plugin's git repository and open it in Godot, you will be presented with a block-built Pong game as an example.
44
40
@@ -54,22 +50,6 @@ We will now seek feedback from learners, educators and game makers, as well as r
54
50
55
51
There is no language or data format stability implemented or expected in these early stages. If you upgrade the block coding plugin within an existing project, expect any existing block scripts to stop working and need reimplementing from scratch. For now, you probably want to avoid updating the plugin within your project if it's meeting your needs, or only doing that very sporadically. We will consider offering stability guarantees in future stages of development.
56
52
57
-
## General user guidance
58
-
59
-
Block scripts run against the node where you created them. The "Queue Free" block is going to free that node, not any other.
60
-
61
-
The selection of available blocks varies based on the node type. For example, create a block script on an `Area2D` and you will notice that you have an `On body entered` signal handling block available. Create a node script on an `AnimationPlayer` node and you will observe blocks for starting and stopping animations.
62
-
63
-
If you wish to switch context to another node, you need to define a function in that other node, and then call it. Once execution jumps into that function, blocks will now act against that other node, and you'll have access to type-specific blocks belonging to that other node. You'll need do this kind of thing if you want to trigger the freeing of another node, or trigger an animation to start playing. This is both strong in conveying the concepts of objects and encapsulation, while also a bit tedious - we may revisit in future!
64
-
65
-
We have some high level blocks for simplifying common game elements. Add a SimpleCharacter node to get a game element that can be connected to keyboard and gamepad input with just one type-specific block. Add a SimpleScoring node to display a score on-screen, accompanied by simple blocks for adjusting that score.
66
-
67
-
Lean into animations! Godot's animations functionality goes beyond just simple animations of graphics. You can do so much by combining block coding with Godot's powerful animations editor.
68
-
69
-
If you want to access the node's property, you can drag the property from the Inspector dock and drop it into the block script as a getter block. And, if you want to modify the property's value, please press & hold Ctrl key when you drop the property, then it will be a setter block of the property in the block script.
70
-
71
-
You can also drag a file from the Resource Filesystem dock and drop it into the block script as a getter block. It will become a constant value block holding the file's resource full path.
72
-
73
53
## Feedback & Discussion
74
54
75
55
Please join our [Discussion Board](https://github.com/endlessm/godot-block-coding/discussions) to provide feedback, share ideas, and ask questions about building your games with Block Coding.
Copy file name to clipboardExpand all lines: addons/block_code/types/types.gd
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
extendsNode
2
2
3
3
enumBlockType {
4
-
NONE,
5
-
ENTRY,
6
-
STATEMENT,
7
-
VALUE,
8
-
CONTROL,
4
+
NONE,## @deprecated
5
+
ENTRY,## A block that's the entry point. Statement or control blocks can be attached below it.
6
+
STATEMENT,## A block that executes a statement. Another statement or control block can be attached below it.
7
+
VALUE,## A block that represents a value. It could be a constant or the result of an operation. All blocks may have slots to attach value blocks in their body.
8
+
CONTROL,## A block that can conditionally execute other statement or control blocks. Another statement or control block can be attached below it.
Blocks can be created by adding a `BlockDefinition` resource. The global blocks live in resource files under `addons/block_code/blocks/` and are organized in folders by category. You can edit these files in the Godot editor directly, by opening them from the Filesystem Dock. As any other Godot resource, they show up in the Inspector. You can use current ones as reference.
6
+
7
+
Currently, blocks for custom nodes can't be defined in the same way. They are instead defined programmatically in their GDScript by adding two functions: `func get_custom_class()` and `static func setup_custom_blocks()`. This is expected to be fixed in the future. See the "Simple" nodes provided by this plugin for reference. For example, `addons/block_code/simple_nodes/simple_character/simple_character.gd`.
8
+
9
+
You don't have to worry for adding blocks for properties setter, getter or "changer". These are generated dynamically in `addons/block_code/code_generation/blocks_catalog.gd`.
10
+
11
+
## User Interface
12
+
13
+
The plugin adds a new tab "Block Code" to the editor bottom dock. This contains the `MainPanel` control scene. Which has the following elements:
14
+
* The `Picker`: Contains the list of blocks organized in categories.
15
+
* The `BlockCanvas`: Is where placed blocks live. It edits the `BlockScriptSerialization` that generates the code.
16
+
* The `TitleBar`: Has a dropdown to switch the BlockCode being edited and other controls.
17
+
* The `DragManager`: Determines how blocks are snapped, and what happens when you drag a block from either the `Picker` or the `BlockCanvas`.
18
+
19
+
The `DragManager` looks for the closest compatible snap point within a certain range, and if it exists, will show a preview where your `Block` will go if you drop it.
20
+
* Each `Block` has a `block_type` property, and so does each snap point. They must match to snap.
21
+
* If a `Block` has the block type `VALUE`, it should have a `variant_type` property (since it represents a value). In that case, it's `variant_type` is considered for snapping along with the snap point's `variant_type`.
22
+
23
+
The `Block` UI is a regular Godot scene. There is one per each `block_type`. One current discrepancy is that the UI for the `VALUE` block type is called `ParameterBlock`. All others match: eg. for the `CONTROL` type there is a `ControlBlock` scene.
24
+
25
+
The `BlockCanvas` is filled with blocks as defined in the `BlockScriptSerialization`. When the user interacts with the `BlockCanvas`, the `BlockScriptSerialization` regenerates its GDScript. For instance when the user attaches blocks, or changes the block text input or dropdowns (scene instances of `ParameterInput`).
0 commit comments