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: src/docs/Modding The Engine/Scripting/PlayState Scripts/Gameplay Scripts.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ function create() {
13
13
Or how to create a normal sprite:
14
14
```hx
15
15
function create() {
16
-
var sprite = new FlxSprite(x, y).loadGraphic(Paths.image("my new sprite")) //picks the png image from the ./images folder
16
+
var sprite = new FlxSprite(x, y).loadGraphic(Paths.image("my new sprite")); //picks the png image from the ./images folder
17
17
}
18
18
```
19
19
If you notice, this looks slightly like source code, aside from the usual ``override function`` or ``super.create()``, which does not exist in our scripting language.<br>
@@ -27,8 +27,8 @@ Noting other particularities, Gameplay Scripting relies heavily on **Events**, w
27
27
Which means, handling a note hit looks something like this:
28
28
```hx
29
29
function onNoteHit(event) {
30
-
trace(event.note) // the note that has been hit
31
-
trace(event.score) // how much score gained from this
30
+
trace(event.note); // the note that has been hit
31
+
trace(event.score); // how much score gained from this
32
32
event.cancel(); // cancels out any other handling (useful if you want to write custom note pressing)
Characters are actually accessed differently. Due to the modularity of having more than one Strumline, and having more than one character in a Strumline, characters are accessible like this:
51
51
```hx
52
-
trace(strumLines.members[0].characters[0]) // opponent character
53
-
trace(strumLines.members[1].characters[0]) // player character
54
-
trace(strumLines.members[2].characters[0]) // girlfriend character
52
+
trace(strumLines.members[0].characters[0]); // opponent character
53
+
trace(strumLines.members[1].characters[0]); // player character
54
+
trace(strumLines.members[2].characters[0]); // girlfriend character
55
55
```
56
56
Though we have also established a few shortcuts to avoid typing this much code
57
57
```hx
@@ -66,4 +66,4 @@ Sections do not exists, and therefore, ``mustHitSection`` no longer works. But,
66
66
67
67
```hx
68
68
if (curCameraTarget == 1) // mustHitSection == true
0 commit comments