@defold-typescript/types 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/go.d.ts +180 -179
- package/generated/msg.d.ts +9 -9
- package/generated/sprite.d.ts +33 -32
- package/generated/vmath.d.ts +232 -229
- package/package.json +1 -1
- package/scripts/example-store-io.ts +18 -0
- package/scripts/regen.ts +5 -1
- package/src/doc-comment.ts +2 -1
- package/src/emit-dts.ts +19 -5
- package/src/example-store.ts +44 -0
- package/src/go-overloads.d.ts +30 -0
- package/src/message-dispatch.d.ts +21 -0
- package/src/message-guard.d.ts +19 -0
- package/src/msg-overloads.d.ts +20 -0
package/generated/sprite.d.ts
CHANGED
|
@@ -28,22 +28,20 @@ declare global {
|
|
|
28
28
|
* `playback_rate`
|
|
29
29
|
* number the rate with which the animation will be played. Must be positive.
|
|
30
30
|
* @example
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* sprite.play_flipbook(url, "jump", anim_done)
|
|
46
|
-
* end
|
|
31
|
+
* ```ts
|
|
32
|
+
* // Assuming the sprite has id "sprite": play the "jump" animation followed by the
|
|
33
|
+
* // "run" animation:
|
|
34
|
+
* export default defineScript({
|
|
35
|
+
* init() {
|
|
36
|
+
* const url = msg.url("#sprite");
|
|
37
|
+
* sprite.play_flipbook(url, "jump", (self, message_id, message) => {
|
|
38
|
+
* if (message_id === hash("animation_done") && message.id === hash("jump")) {
|
|
39
|
+
* // jump animation done, chain with "run"
|
|
40
|
+
* sprite.play_flipbook(url, "run");
|
|
41
|
+
* }
|
|
42
|
+
* });
|
|
43
|
+
* },
|
|
44
|
+
* });
|
|
47
45
|
* ```
|
|
48
46
|
*/
|
|
49
47
|
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: unknown, message: unknown, sender: unknown) => void, play_properties?: { offset?: number; playback_rate?: number }): void;
|
|
@@ -55,14 +53,15 @@ declare global {
|
|
|
55
53
|
* @param url - the sprite that should flip its animations
|
|
56
54
|
* @param flip - `true` if the sprite should flip its animations, `false` if not
|
|
57
55
|
* @example
|
|
58
|
-
* ```
|
|
59
|
-
* How to flip a sprite so it faces the horizontal movement
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* // How to flip a sprite so it faces the horizontal movement (it is assumed that
|
|
58
|
+
* // the sprite component has id "sprite" and the original animation faces right):
|
|
59
|
+
* export default defineScript({
|
|
60
|
+
* update(self, dt) {
|
|
61
|
+
* // calculate self.velocity somehow
|
|
62
|
+
* sprite.set_hflip("#sprite", self.velocity.x < 0);
|
|
63
|
+
* },
|
|
64
|
+
* });
|
|
66
65
|
* ```
|
|
67
66
|
*/
|
|
68
67
|
function set_hflip(url: string | Hash | Url, flip: boolean): void;
|
|
@@ -74,14 +73,16 @@ declare global {
|
|
|
74
73
|
* @param url - the sprite that should flip its animations
|
|
75
74
|
* @param flip - `true` if the sprite should flip its animations, `false` if not
|
|
76
75
|
* @example
|
|
77
|
-
* ```
|
|
78
|
-
* How to flip a sprite in a game which negates gravity as a game mechanic
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* // How to flip a sprite in a game which negates gravity as a game mechanic (it is
|
|
78
|
+
* // assumed that the sprite component has id "sprite" and the original animation
|
|
79
|
+
* // is up-right):
|
|
80
|
+
* export default defineScript({
|
|
81
|
+
* update(self, dt) {
|
|
82
|
+
* // calculate self.up_side_down somehow, then:
|
|
83
|
+
* sprite.set_vflip("#sprite", self.up_side_down);
|
|
84
|
+
* },
|
|
85
|
+
* });
|
|
85
86
|
* ```
|
|
86
87
|
*/
|
|
87
88
|
function set_vflip(url: string | Hash | Url, flip: boolean): void;
|