goplus / spx

spx - A Scratch Compatible Go/Go+ 2D Game Engine for STEM education
https://builder.goplus.org
Apache License 2.0
103 stars 28 forks source link

Add music api #441

Closed JiepengTan closed 1 day ago

JiepengTan commented 2 days ago

1. implement:

2. test project: (please build your engine from source before run it)

16-BGM.zip

3. scene config:

{
  "bgm":"bgm",
  "zorder": [
    "Bullet"
  ]
}

4. demo script:

onStart => {
    println "onStart"
    wait 1
    play "bgm", {Music:true, Action: PlayPause}
    println "PlayPause"
    wait 1
    play "bgm", {Music:true, Action: PlayResume}
    println "PlayResume"
    wait 1
    play "bgm", {Music:true, Action: PlayStop}
    println "PlayStop"
    wait 3
    play "bgm", {Music:true, Action: PlayRewind}
    println "PlayRewind"
}

5. demo video: please download this video and play it (github can not play audio)

https://github.com/user-attachments/assets/db45ef39-3a4b-4735-9d5f-c0fc48e6611c