【发布时间】:2021-04-14 13:05:18
【问题描述】:
我正在绝望地尝试在 Scratch 中重新创建一个 DDR 风格的节奏游戏克隆。 (但是,语言无关紧要,因为这个问题是关于数学的。)
我想知道;如何在控制音符速度时(游戏前)在音乐和音符之间实现不会延迟且不会破坏同步的完美同步。
需要的变量:
“math”:直接进入笔记中的“change y by”。
“dist”:直接转到其定义下方的“等待_秒”。
Sprite:注释解释器
when ????️ clicked
set map to "q w p op op owp ..."
set crawl to 8
set bpm to 100
set math to ((280 / crawl) / (bpm / 60) //needs improved formula!!
set dist to ((math * (bpm / 60)) / 100) //needs improved formula!!
comment "Y BOTTOM TO Y NOTE PRESSER DISTANCE IS 280px"
set misses to 0
set action to 0
for each v in length of map
if (letter v of map) = "q" then
broadcast SENDLEFT
else
if (letter v of map) = "w" then
broadcast SENDDOWN
else
if (letter v of map) = "o" then
broadcast SENDUP
else
if (letter v of map) = "p" then
broadcast SENDRIGHT
else
if (letter v of map) = "" then
wait dist seconds //wait until it can process next note
这就是“数学”的发展方向......
Sprite:下注
when I start as a clone
go to front layer
show
repeat until (act = "down") and (touching down?) or (touching edge?) // detects when the "DOWN" (qWop) key is pressed
change y by math //go up towards top of stage (Or note clickers if player is fast enough)
if (touching edge?) then
change misses by 1
set act to 0
delete this clone
舞台是这样的:
Stage appearance Stage appearance (with helper)
在现代 Microsoft Edge 89.0.774.76 上运行 Scratch 3.21.0; Windows 10 Home 20H2/2009(根据 Edge)
【问题讨论】:
标签: javascript math mit-scratch