Skip to content

Commit

Permalink
Merge pull request #1 from SorkoPiko/patch-2
Browse files Browse the repository at this point in the history
fix some weird english
  • Loading branch information
OmgRod authored Aug 4, 2024
2 parents 8982676 + 7711fd0 commit a335b43
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions handbook/vol1/chap1_8.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Creating Layers

Layers are a fundamental concept when modding Geometry Dash. In this tutorial, we'll cover how to create layers (`CCLayer`s) and understand their general layout. Let's dive in!
Creating layers is a valuable skill when modding Geometry Dash. In this tutorial, we'll cover how to create layers (`CCLayer`) and understand their general layout.

## Step 1: Creating the layer

To create a layer, we need to define a class. In this tutorial, we'll name our class `MyLayer` and provide an `init` function. Here's how you can do it:
To create a layer, we need to define a class. In this tutorial, we'll name our class `MyLayer` and provide an `init` function:

```cpp
class MyLayer : CCLayer {
Expand All @@ -17,8 +17,8 @@ public:
Now, it is very important to know that the `init` function has to be a bool function. Also, you may be asking: *Why does it say `public:` above the `init` function?* Here's why:
- `Public` means that the functions under them can be accessed by other files.
- `Private` means that the functions under them can only be accessed by other functions in the file itself.
- `public` means that the functions under them can be accessed by other files.
- `private` means that the functions under them can only be accessed by other functions in the file itself.
## Step 2: Making them accessible
Expand All @@ -27,7 +27,7 @@ To make the layer accessible from other layers, we need to add 2 functions: `cre
- `create` will create an instance of the layer
- `scene` will handle the transition to the new scene
So, now that we know what these 2 functions do, let's apply them to our current code:
Let's add them:
```cpp
class MyLayer : CCLayer {
Expand All @@ -39,7 +39,7 @@ public:
}
static MyLayer* create() {
MyLayer* ret = new MyLayer();
auto ret = new MyLayer();
if (ret && ret->init()) {
ret->autorelease();
return ret;
Expand All @@ -51,4 +51,4 @@ public:
return true;
}
}
```
```

0 comments on commit a335b43

Please sign in to comment.